Skip to content

setsockopt IPV6_V6ONLY does not work #128

Closed

Description

@anders
# python
>>> import socket
>>> s = socket.socket(socket.AF_INET6, socket.SOCK_STREAM, 0)
>>> s.setsockopt(socket.IPPROTO_IPV6, socket.IPV6_V6ONLY, 1)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.7/socket.py", line 224, in meth
    return getattr(self._sock,name)(*args)
socket.error: [Errno 22] Invalid argument

Activity

  1. hungys commented on Apr 11, 2016

    @hungys

    Seems the same issue as #68

  2. sunilmut commented on Apr 12, 2016

    @sunilmut
    Member

    Anders Bergh (@anders) Can confirm from our side that the socket option IPPROTO_IPV6\IPV6_V6ONLY is not yet implemented. We have opened a bug on our side to track this. No ETA at this time.

  3. russalex commented on Jun 10, 2016

    @russalex
    Contributor

    Looks to be fixed in 14361:

    Python 2.7.6 (default, Jun 22 2015, 17:58:13)
    [GCC 4.8.2] on linux2
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import socket
    >>> s = socket.socket(socket.AF_INET6, socket.SOCK_STREAM, 0)
    >>> s.setsockopt(socket.IPPROTO_IPV6, socket.IPV6_V6ONLY, 1)
    >>>
    
  4. adcen0107 commented on Jan 18, 2021

    @adcen0107

    do this
    int flag = 1;
    int ret = setsockopt(sock_fd, IPPROTO_IPV6, IPV6_V6ONLY, &flag, sizeof(flag));

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions