Issue: "Cannot assign requested address" when connecting to ::1

hi,

With a .travis.yml set to:

language: python     
python:              
    - "3.5"          
install:             
    - python3 test.py

and test.py:

import socket                                         
                                                      
s = socket.socket(socket.AF_INET6, socket.SOCK_STREAM)
s.connect(('::1', 1234))                              

As can be seen here, I’m getting this error on Travis:

[Errno 99] Cannot assign requested address

The expected behavior is:

[Errno 111] Connection refused

(Note: this is a duplicate of IPv6 sockets returning "Cannot assign requested address" · Issue #8711 · travis-ci/travis-ci · GitHub , and "Cannot assign requested address" when connecting to ::1 · Issue #10350 · travis-ci/travis-ci · GitHub which got closed)

There’s actually a Github repo dedicated to testing Travis IPv6 support! As of now, it says that only container-based Linuxes and MacOS have IPv6 addresses assigned, and only loopback and link-local at that.

Thanks for your help. I tried setting “sudo: false”, there is no noticeable change :confused:

I’ve rerun the tests, adding Xenial to the mix, too. There’s no IPv6 support in any of the Linuxes, only in MacOS.

With sudo: required, you might be able to enable it yourself if the kernel has the necessary modules.

These commands had no effect:

sysctl -w net.ipv6.conf.all.disable_ipv6=0
sysctl -w net.ipv6.conf.lo.disable_ipv6=0

https://travis-ci.org/ProgVal/test_travis/builds/460658222

sysctl -w reconfigures the kernel. Obviously, you need to run it with superuser rights.