From 116cac053e2e4e167caa9707439065af7c7b82b3 Mon Sep 17 00:00:00 2001 From: Andrei Vagin Date: Wed, 3 Jul 2019 13:57:24 -0700 Subject: netstack/udp: connect with the AF_UNSPEC address family means disconnect PiperOrigin-RevId: 256433283 --- pkg/tcpip/transport/tcp/endpoint.go | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'pkg/tcpip/transport/tcp/endpoint.go') diff --git a/pkg/tcpip/transport/tcp/endpoint.go b/pkg/tcpip/transport/tcp/endpoint.go index ee60ebf58..cb40fea94 100644 --- a/pkg/tcpip/transport/tcp/endpoint.go +++ b/pkg/tcpip/transport/tcp/endpoint.go @@ -1271,6 +1271,11 @@ func (e *endpoint) checkV4Mapped(addr *tcpip.FullAddress) (tcpip.NetworkProtocol // Connect connects the endpoint to its peer. func (e *endpoint) Connect(addr tcpip.FullAddress) *tcpip.Error { + if addr.Addr == "" && addr.Port == 0 { + // AF_UNSPEC isn't supported. + return tcpip.ErrAddressFamilyNotSupported + } + return e.connect(addr, true, true) } -- cgit v1.2.3