diff options
author | Mikael Magnusson <mikma@users.sourceforge.net> | 2021-02-20 00:24:52 +0100 |
---|---|---|
committer | Mikael Magnusson <mikma@users.sourceforge.net> | 2021-02-23 23:03:55 +0100 |
commit | 64323d22d9542e981a4dc6777fa26c9c7a5caf9c (patch) | |
tree | 52c2bcd28101cd26903077ed06b5ff932b870cd7 /pkg/tcpip | |
parent | 2b55523a949a97f16e77535ca6638c79f155847c (diff) |
Emulate golang's ListenTCPv6only
Diffstat (limited to 'pkg/tcpip')
-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{ |