GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — test_uuid: test_getnode and test_windll_getnode fail if connected to the Internet via an Android phone · Issue #75824 · python/cpython

test_uuid: test_getnode and test_windll_getnode fail if connected to the Internet via an Android phone #75824

New issue
Copy link
New issue
Copy link
Closed
Closed
test_uuid: test_getnode and test_windll_getnode fail if connected to the Internet via an Android phone#75824
Copy link
Labels
3.10 (EOL)end of lifeend of life3.11only security fixesonly security fixes3.9 (EOL)end of lifeend of lifeOS-androidtestsTests in the Lib/test dirTests in the Lib/test dirtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

Description

native-api
mannequin
opened on Sep 29, 2017
Issue body actions
BPO 31643
Nosy @warsaw, @xdegaye, @serhiy-storchaka, @native-api
PRs
  • bpo-31643: test_uuid: allow zero MAC address #4448
  • bpo-31643: test_uuid: allow zero MAC address #4804
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = None
    created_at = <Date 2017-09-29.21:37:18.944>
    labels = ['type-bug', 'tests', '3.9', '3.10', '3.11']
    title = 'test_uuid: test_getnode and test_windll_getnode fail if connected to the Internet via an Android phone'
    updated_at = <Date 2021-06-14.21:55:20.385>
    user = 'https://github.com/native-api'

    bugs.python.org fields:

    activity = <Date 2021-06-14.21:55:20.385>
    actor = 'iritkatriel'
    assignee = 'none'
    closed = False
    closed_date = None
    closer = None
    components = ['Tests']
    creation = <Date 2017-09-29.21:37:18.944>
    creator = 'Ivan.Pozdeev'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 31643
    keywords = []
    message_count = 7.0
    messages = ['303360', '303373', '308097', '308100', '308104', '308152', '308194']
    nosy_count = 5.0
    nosy_names = ['barry', '__Vano', 'xdegaye', 'serhiy.storchaka', 'Ivan.Pozdeev']
    pr_nums = ['4448', '4804']
    priority = 'normal'
    resolution = None
    stage = 'patch review'
    status = 'open'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue31643'
    versions = ['Python 3.9', 'Python 3.10', 'Python 3.11']

    Activity

    1. native-api commented on Sep 29, 2017

      @native-api
      native-apimannequin
      on Sep 29, 2017
      MannequinAuthor
      More actions

      Ethernet emulation for some devices like Android phones' tethering use all-zero MAC addresses (which is okay since they don't actually pass Ethernet frames to other NICs). This results in a node ID of 0 if I'm currently connected to the Net via such a device. Which fails range checks in the corresponding tests.

      RFC 4122 doesn't actually have any prohibitions of using a node ID of 0. Neither does IEEE 802.3 (or rather, whatever info I gathered on it since the standard's text is not freely available) assign any special meaning to an all-zero MAC address.

      The patch also corrects the check call in test_windll_getnode since the tested function always generates UUID from a MAC address.

    2. native-api
      added
      3.7 (EOL)end of lifeend of life
      3.8 (EOL)end of lifeend of life
      testsTests in the Lib/test dirTests in the Lib/test dir
      type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
      on Sep 29, 2017
    3. native-api commented on Sep 29, 2017

      @native-api
      native-apimannequin
      on Sep 29, 2017
      MannequinAuthor
      More actions

      Example failure:

      ======================================================================
      FAIL: test_windll_getnode (test.test_uuid.TestInternals)
      ----------------------------------------------------------------------

      Traceback (most recent call last):
        File "C:\Ivan\cpython\lib\test\test_uuid.py", line 501, in test_windll_getnode
          self.check_node(node)
        File "C:\Ivan\cpython\lib\test\test_uuid.py", line 449, in check_node
          "%s is not an RFC 4122 node ID" % hex)
      AssertionError: False is not true : 000000000000 is not an RFC 4122 node ID

      ======================================================================
      FAIL: test_getnode (test.test_uuid.TestUUID)
      ----------------------------------------------------------------------

      Traceback (most recent call last):
        File "C:\Ivan\cpython\lib\test\test_uuid.py", line 296, in test_getnode
          self.assertTrue(0 < node1 < (1 << 48), '%012x' % node1)
      AssertionError: False is not true : 000000000000
    4. xdegaye commented on Dec 12, 2017

      @xdegaye
      xdegayemannequin
      on Dec 12, 2017
      Mannequin
      More actions

      On a Samsung device with Android 5.1 and tethering enabled, only one network device has a MAC address and it is not an all-zero MAC address.

      Ivan can you please provide more information about this problem: which device, what Android version, what is the output of 'ip link' ?

    5. serhiy-storchaka commented on Dec 12, 2017

      @serhiy-storchaka
      serhiy-storchaka
      on Dec 12, 2017
      Member
      More actions

      I'm not sure that 000000000000 is better than a random address. Even if an all-zero MAC address is not explicitly prohibited it is used in a multiple independent devices. A random address looks more appropriate fore the purpose of generating a UUID.

    6. xdegaye commented on Dec 12, 2017

      @xdegaye
      xdegayemannequin
      on Dec 12, 2017
      Mannequin
      More actions

      I'm not sure that 000000000000 is better than a random address.

      I agree, getnode() when obtained from a MAC address should not return 0.

      RFC 4122 states (emphasis on 'uniqueness' is mine):

      This document specifies three algorithms to generate UUIDs: the
      first leverages the unique values of 802 MAC addresses to
      guarantee *uniqueness*, ...

    7. Vano commented on Dec 12, 2017

      @Vano
      Vanomannequin
      on Dec 12, 2017
      Mannequin
      More actions

      Xavier de Gaye <[email protected]> added the comment:

      On a Samsung device with Android 5.1 and tethering enabled, only one network device has a MAC address and it is not an all-zero MAC address.

      Ivan can you please provide more information about this problem: which device, what Android version, what is the output of 'ip link' ?

      C:\> ipconfig -all
      <...>
      Samsung Galaxy S7 - Ethernet адаптер:

              DNS-суффикс этого подключения . . :
              Описание  . . . . . . . . . . . . : Android USB Ethernet/RNDIS
              Физический адрес. . . . . . . . . : 00-00-00-00-00-00
              Dhcp включен. . . . . . . . . . . : да
              Автонастройка включена  . . . . . : да
              IP-адрес  . . . . . . . . . . . . : 192.168.42.2
              Маска подсети . . . . . . . . . . : 255.255.255.0
              Основной шлюз . . . . . . . . . . : 192.168.42.129
              DHCP-сервер . . . . . . . . . . . : 192.168.42.129
              DNS-серверы . . . . . . . . . . . : 192.168.42.129

      Device name: Samsung Galaxy S7
      Model number: SM-G930F
      Android version: 6.0.1
      Firmware version: G930FXXU1APGJ
      Baseband version: G930VVRS4APH1
      Build number: MMB29M.G930VVRU2APG5

      Serhiy Storchaka<[email protected]> added the comment:

      I'm not sure that 000000000000 is better than a random address. Even if an all-zero MAC address is not explicitly prohibited it is used in a multiple independent devices. A random address looks more appropriate fore the purpose of generating a UUID.
      The question is not whether it's good UUID source material. The
      question, for the purpose of the test, is whether it's valid getnode()
      output -- which it is for the current logic.

    8. xdegaye commented on Dec 13, 2017

      @xdegaye
      xdegayemannequin
      on Dec 13, 2017
      Mannequin
      More actions

      C:\> ipconfig -all

      So the all-zero MAC address occurs on a Windows box and that explains the test_windll_getnode failure (this test is skipped on Android). I missed that point in your initial post and knowing what Android device you are using is irrelevant.

    9. iritkatriel
      added
      3.9 (EOL)end of lifeend of life
      3.10 (EOL)end of lifeend of life
      3.11only security fixesonly security fixes
      and removed
      3.7 (EOL)end of lifeend of life
      3.8 (EOL)end of lifeend of life
      on Jun 14, 2021
    10. ezio-melotti
      transferred this issue fromon Apr 10, 2022
    11. encukou
      added this to Unsupported platformson Feb 1, 2024
    12. mhsmith commented on Mar 6, 2024

      @mhsmith
      mhsmith
      on Mar 6, 2024
      Member
      More actions

      According to my tests, on Android API level 21, getnode uses the ip command to return the actual MAC address of the device. On API level 34, the ip command no longer returns anything for an unprivileged user, so getnode falls back on a random address, as documented. Either way, the resulting address is non-zero.

      @encukou: So I think this issue can be closed.

      Reacted by Petr Viktorin
    13. encukou
      closed this as completedon Mar 7, 2024
    14. github-project-automation
      moved this to Done in Unsupported platformson Mar 7, 2024
    15. encukou
      added
      OS-android
      on Mar 20, 2024
    16. encukou
      removed this from Unsupported platformson Mar 20, 2024
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Assignees

    No one assigned

      Labels

      3.10 (EOL)end of lifeend of life3.11only security fixesonly security fixes3.9 (EOL)end of lifeend of lifeOS-androidtestsTests in the Lib/test dirTests in the Lib/test dirtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

      Projects

      No projects

        Milestone

        No milestone

        Relationships

        None yet

        Development

        No branches or pull requests

        Issue actions

        You are visitor 01402503 — GeezerVison does not store the pages you look up.
        Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.