Skip to content

Expose RFC 3542 IPv6 socket options on macOS #79750

Closed

Description

@chrysn
mannequin
BPO 35569
Nosy @ronaldoussoren, @ned-deily, @chrysn, @erlend-aasland
PRs
  • bpo-35569: Expose RFC 3542 IPv6 socket options on macOS #19526
  • bpo-35569: add Erlend to Misc/ACKS #20146
  • Files
  • 0001-bpo-35569-Expose-RFC-3542-socket-options-on-macOS.patch
  • 0002-bpo-35569-Add-unit-tests.patch
  • 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 = <Date 2020-05-17.06:37:41.536>
    created_at = <Date 2018-12-23.12:00:47.132>
    labels = ['OS-mac', 'type-feature', '3.9', 'expert-IO']
    title = 'Expose RFC 3542 IPv6 socket options on macOS'
    updated_at = <Date 2020-05-17.06:57:31.851>
    user = 'https://github.com/chrysn'

    bugs.python.org fields:

    activity = <Date 2020-05-17.06:57:31.851>
    actor = 'ned.deily'
    assignee = 'none'
    closed = True
    closed_date = <Date 2020-05-17.06:37:41.536>
    closer = 'ned.deily'
    components = ['macOS', 'IO']
    creation = <Date 2018-12-23.12:00:47.132>
    creator = 'chrysn'
    dependencies = []
    files = ['48937', '49059']
    hgrepos = []
    issue_num = 35569
    keywords = ['patch']
    message_count = 9.0
    messages = ['332389', '332391', '363032', '363830', '363831', '366323', '369095', '369096', '369098']
    nosy_count = 4.0
    nosy_names = ['ronaldoussoren', 'ned.deily', 'chrysn', 'erlendaasland']
    pr_nums = ['19526', '20146']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue35569'
    versions = ['Python 3.9']

    Activity

    1. chrysn commented on Dec 23, 2018

      chrysnmannequin
      MannequinAuthor

      Python builds on MacOS do not expose the IPV6_RECVPKTINFO flag specified in [RFC3842], which is required for UDP protocols that need control over their servers' sending ports like CoAP.

      While I don't own Apple hardware and thus can't test it, the nginx code indicates that this API is available on OSX and is just gated behind -D__APPLE_USE_RFC_3542. Searching the web for that define indicates that other interpreted langues and applications use the flag as well (PHP, Ruby; PowerDNS, nmap, libcoap).

      Please consider enabling this on future releases of Python on OSX.

    2. added
      type-feature
      on Dec 23, 2018
    3. ronaldoussoren commented on Dec 23, 2018

      @ronaldoussoren
      Contributor
      #include <netinet6/in6.h> in the macOS 10.14 SDK says:
      
      /*
       * RFC 3542 define the following socket options in a manner incompatible
       * with RFC 2292:
       *   IPV6_PKTINFO
       *   IPV6_HOPLIMIT
       *   IPV6_NEXTHOP
       *   IPV6_HOPOPTS
       *   IPV6_DSTOPTS
       *   IPV6_RTHDR
       *
       * To use the new IPv6 Sockets options introduced by RFC 3542
       * the constant __APPLE_USE_RFC_3542 must be defined before
       * including <netinet/in.h>
       *
       * To use the old IPv6 Sockets options from RFC 2292
       * the constant __APPLE_USE_RFC_2292 must be defined before
       * including <netinet/in.h>
       *
       * Note that eventually RFC 3542 is going to be the
       * default and RFC 2292 will be obsolete.
       */

      My conclusion from reading this: the name might suggest that this is an internal macro, but should be safe to use.

    4. erlend-aasland commented on Feb 29, 2020

      @erlend-aasland
      Contributor

      Proposed patch attached.

    5. chrysn commented on Mar 10, 2020

      chrysnmannequin
      MannequinAuthor

      Testing the application to current git master (on a borrowed machine with Darwin Kernel Version 18.5.0), the provided patch does enable the desired IPV6_RECVPKTINFO flag, and the received pktinfo struct complies to the spec.

    6. erlend-aasland commented on Mar 10, 2020

      @erlend-aasland
      Contributor

      Thanks for testing @chrysn. I guess I should add unit tests if this is to be applied to master.

    7. erlend-aasland commented on Apr 13, 2020

      @erlend-aasland
      Contributor

      Added (Mac OS specific) unit tests.

    8. ned-deily commented on May 17, 2020

      @ned-deily
      Member

      New changeset 9a45bfe by Erlend Egeberg Aasland in branch 'master':
      bpo-35569: Expose RFC 3542 IPv6 socket options on macOS (GH-19526)
      9a45bfe

    9. ned-deily commented on May 17, 2020

      @ned-deily
      Member

      Thanks for the PR! Merged for 3.9.0b1

    10. changed the title [-]OSX: Enable IPV6_RECVPKTINFO[/-] [+]Expose RFC 3542 IPv6 socket options on macOS[/+] on May 17, 2020
    11. ned-deily commented on May 17, 2020

      @ned-deily
      Member

      New changeset fa098b6 by Ned Deily in branch 'master':
      bpo-35569: add Erlend to Misc/ACKS (GH-20146)
      fa098b6

    12. transferred this issue fromon Apr 10, 2022
    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.9 (EOL)OS-mactopic-IOtype-feature

      Projects

      No projects

        Milestone

        No milestone

        Relationships

        None yet

        Development

        No branches or pull requests

        Issue actions