diff options
Diffstat (limited to 'pkg/tcpip/adapters')
-rw-r--r-- | pkg/tcpip/adapters/gonet/gonet.go | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/pkg/tcpip/adapters/gonet/gonet.go b/pkg/tcpip/adapters/gonet/gonet.go index c188aaa18..2c5a654f3 100644 --- a/pkg/tcpip/adapters/gonet/gonet.go +++ b/pkg/tcpip/adapters/gonet/gonet.go @@ -72,6 +72,9 @@ func ListenTCP(s *stack.Stack, addr tcpip.FullAddress, network tcpip.NetworkProt return nil, errors.New(err.String()) } + // Emulate golang's ListenTCP which is always ipv4-only or ipv6-only + ep.SocketOptions().SetV6Only(true) + if err := ep.Bind(addr); err != nil { ep.Close() return nil, &net.OpError{ |