Skip to content

Add formal support for UDPLITE protocol #81526

Closed

Description

@gappleto97
BPO 37345
Nosy @asvetlov, @miss-islington, @gappleto97
PRs
  • bpo-37345: Add formal UDPLITE support #14258
  • 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 2019-06-24.09:59:46.086>
    created_at = <Date 2019-06-20.06:35:47.354>
    labels = ['type-feature', 'library', '3.9']
    title = 'Add formal support for UDPLITE protocol'
    updated_at = <Date 2019-06-24.09:59:46.085>
    user = 'https://github.com/gappleto97'

    bugs.python.org fields:

    activity = <Date 2019-06-24.09:59:46.085>
    actor = 'asvetlov'
    assignee = 'none'
    closed = True
    closed_date = <Date 2019-06-24.09:59:46.086>
    closer = 'asvetlov'
    components = ['Library (Lib)']
    creation = <Date 2019-06-20.06:35:47.354>
    creator = 'gappleto97'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 37345
    keywords = ['patch']
    message_count = 10.0
    messages = ['346103', '346112', '346120', '346182', '346183', '346188', '346269', '346272', '346283', '346361']
    nosy_count = 3.0
    nosy_names = ['asvetlov', 'miss-islington', 'gappleto97']
    pr_nums = ['14258']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue37345'
    versions = ['Python 3.9']

    Activity

    1. gappleto97 commented on Jun 20, 2019

      gappleto97mannequin
      MannequinAuthor

      At the moment you can definitely use UDPLITE sockets on Linux systems, but it would be good if this support were formalized such that you can detect support at runtime easily.

      At the moment, to make and use a UDPLITE socket requires something like the following code:

      >> import socket
      >> a = socket.socket(socket.AF_INET, socket.SOCK_DGRAM, 136)
      >> b = socket.socket(socket.AF_INET, socket.SOCK_DGRAM, 136)
      >> a.bind(('localhost', 44444))
      >> b.sendto(b'test'*256, ('localhost', 44444))
      >> b.setsockopt(136, 10, 16)
      >> b.sendto(b'test'*256, ('localhost', 44444))
      >> b.setsockopt(136, 10, 32)
      >> b.sendto(b'test'*256, ('localhost', 44444))
      >> b.setsockopt(136, 10, 64)
      >> b.sendto(b'test'*256, ('localhost', 44444))

      If you look at this through Wireshark, you can see that the packets are different in that the checksums and checksum coverages change.

      With the pull request that I am submitting momentarily, you could do the following code instead:

      >> import socket
      >> a = socket.socket(socket.AF_INET, socket.SOCK_DGRAM, socket.IPPROTO_UDPLITE)
      >> b = socket.socket(socket.AF_INET, socket.SOCK_DGRAM, socket.IPPROTO_UDPLITE)
      >> a.bind(('localhost', 44444))
      >> b.sendto(b'test'*256, ('localhost', 44444))
      >> b.set_send_checksum_coverage(16)
      >> b.sendto(b'test'*256, ('localhost', 44444))
      >> b.set_send_checksum_coverage(32)
      >> b.sendto(b'test'*256, ('localhost', 44444))
      >> b.set_send_checksum_coverage(64)
      >> b.sendto(b'test'*256, ('localhost', 44444))

      One can also detect support for UDPLITE just by checking

      >> hasattr(socket, 'IPPROTO_UDPLITE')

    2. added
      stdlibStandard Library Python modules in the Lib/ directory
      type-featureA feature request or enhancement
      on Jun 20, 2019
    3. asvetlov commented on Jun 20, 2019

      @asvetlov
      Contributor

      Adding new constants like socket.IPPROTO_UDPLITE is fine.
      The question is: why we need a new function?
      There is no set_send_checksum_coverage() on C level IIRC

    4. gappleto97 commented on Jun 20, 2019

      gappleto97mannequin
      MannequinAuthor

      Its true that this doesnt exist at the C level, however I worry that having it purely through getsockopt() and setsockopt() would make things more confusing, so I added it as a helper function.

      I can remove it in lieu of documentation if that would block merging, though I dont think that is the right move here.

      On June 20, 2019 10:54:58 AM UTC, Andrew Svetlov <report@bugs.python.org> wrote:

      Andrew Svetlov <andrew.svetlov@gmail.com> added the comment:

      Adding new constants like socket.IPPROTO_UDPLITE is fine.
      The question is: why we need a new function?
      There is no set_send_checksum_coverage() on C level IIRC

      ----------
      nosy: +asvetlov


      Python tracker <report@bugs.python.org>
      <https://bugs.python.org/issue37345\>


    5. asvetlov commented on Jun 21, 2019

      @asvetlov
      Contributor

      We have no setsockopt() shortcut helpers.
      socket.setblocking() uses fcntl() internally.

    6. gappleto97 commented on Jun 21, 2019

      gappleto97mannequin
      MannequinAuthor

      I just want to be explicit so I don't mess up on protocol, since I am new to this project. Does that mean that you want me to remove the helper function and put documentation in about that sockopt, or that an exception could be made in this case?

    7. asvetlov commented on Jun 21, 2019

      @asvetlov
      Contributor

      Sorry.
      Please drop helper methods but keep IPPROTO_UDPLITE, UDPLITE_SEND_CSCOV, UDPLITE_RECV_CSCOV constants.

    8. gappleto97 commented on Jun 22, 2019

      gappleto97mannequin
      MannequinAuthor

      Okay, I removed the helper functions and added some additional documentation. Does that look okay now?

    9. changed the title [-]Add formal support for UDPLITE protococl[/-] [+]Add formal support for UDPLITE protocol[/+] on Jun 22, 2019
    10. asvetlov commented on Jun 22, 2019

      @asvetlov
      Contributor

      3.8 is in beta stage, public API is frozen

    11. gappleto97 commented on Jun 22, 2019

      gappleto97mannequin
      MannequinAuthor

      I didn't realize that when I submitted this the first time, but I corrected that in the documentation when someone else removed it from the tags. If I re-added it it was by mistake. I notice that my browser had that auto-highlighted. Should be fixed now.

    12. miss-islington commented on Jun 24, 2019

      @miss-islington
      Contributor

      New changeset 2ac3bab by Miss Islington (bot) (Gabe Appleton) in branch 'master':
      bpo-37345: Add formal UDPLITE support (GH-14258)
      2ac3bab

    13. 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)end of lifestdlibStandard Library Python modules in the Lib/ directorytype-featureA feature request or enhancement

      Projects

      No projects

        Milestone

        No milestone

        Relationships

        None yet

        Development

        No branches or pull requests

        Issue actions