From eba378e4a10f10e1dadadd07d70b65a2eaf47426 Mon Sep 17 00:00:00 2001 From: Anis Eleuch Date: Wed, 7 Jun 2023 17:53:05 +0100 Subject: [PATCH] vrf: Fix testing for loopback coming from the address (#17372) --- internal/http/dial_linux.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/internal/http/dial_linux.go b/internal/http/dial_linux.go index 4c73aacca..fd2fb61c1 100644 --- a/internal/http/dial_linux.go +++ b/internal/http/dial_linux.go @@ -73,6 +73,9 @@ func setTCPParametersFn(opts TCPOptions) func(network, address string, c syscall _ = syscall.SetsockoptInt(fd, syscall.IPPROTO_TCP, unix.TCP_USER_TIMEOUT, opts.UserTimeout) if opts.Interface != "" { + if h, _, err := net.SplitHostPort(address); err == nil { + address = h + } // Create socket on specific vrf device. // To catch all kinds of special cases this filters specifically for loopback networks. if ip := net.ParseIP(address); ip != nil && !ip.IsLoopback() {