From 142f543a7e0dd23dda1d846b0e6b2bacc9bf9ec0 Mon Sep 17 00:00:00 2001 From: Krzysztof Nazarewski Date: Wed, 31 Jan 2024 10:03:49 +0100 Subject: [PATCH 1/2] getFirstListenerAvailable(): adjust logging levels and add success message it was worrying to see multiple warnings and no success message when lacking CAP_NET_BIND_SERVICE --- client/internal/dns/service_listener.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/client/internal/dns/service_listener.go b/client/internal/dns/service_listener.go index 9c783d9dfd7..17a65871afa 100644 --- a/client/internal/dns/service_listener.go +++ b/client/internal/dns/service_listener.go @@ -156,9 +156,10 @@ func (s *serviceViaListener) getFirstListenerAvailable() (string, int, error) { if err != nil { log.Errorf("got an error closing the probe listener, error: %s", err) } + log.Infof("successfully found dns binding candidate at %s", addrString) return ip, port, nil } - log.Warnf("binding dns on %s is not available, error: %s", addrString, err) + log.Debugf("binding dns on %s is not available, error: %s", addrString, err) } } return "", 0, fmt.Errorf("unable to find an unused ip and port combination. IPs tested: %v and ports %v", ips, ports) From b5f9f00814ae67f999e1ee1d722b8ea5861b3a57 Mon Sep 17 00:00:00 2001 From: Krzysztof Nazarewski Date: Wed, 31 Jan 2024 10:10:53 +0100 Subject: [PATCH 2/2] getFirstListenerAvailable() -> getFirstDNSListenerAvailable() --- client/internal/dns/service_listener.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/client/internal/dns/service_listener.go b/client/internal/dns/service_listener.go index 17a65871afa..ebaabdf9558 100644 --- a/client/internal/dns/service_listener.go +++ b/client/internal/dns/service_listener.go @@ -140,7 +140,7 @@ func (s *serviceViaListener) setListenerStatus(running bool) { s.listenerIsRunning = running } -func (s *serviceViaListener) getFirstListenerAvailable() (string, int, error) { +func (s *serviceViaListener) getFirstDNSListenerAvailable() (string, int, error) { ips := []string{defaultIP, customIP} if runtime.GOOS != "darwin" { ips = append([]string{s.wgInterface.Address().IP.String()}, ips...) @@ -170,7 +170,7 @@ func (s *serviceViaListener) evalListenAddress() (string, int, error) { return s.customAddr.Addr().String(), int(s.customAddr.Port()), nil } - return s.getFirstListenerAvailable() + return s.getFirstDNSListenerAvailable() } // shouldApplyPortFwd decides whether to apply eBPF program to capture DNS traffic on port 53.