From 763b9e3d779104a04253f924da3f347c3524b89b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=BA=90=E6=96=87=E9=9B=A8?= <41315874+fumiama@users.noreply.github.com> Date: Thu, 18 Jul 2024 15:52:50 +0900 Subject: [PATCH] fix(udplite): wrong listening addr --- gold/p2p/udplite/lite.go | 2 +- upper/services/tunnel/tunnel_test.go | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/gold/p2p/udplite/lite.go b/gold/p2p/udplite/lite.go index 6ba6d30..a65a21b 100644 --- a/gold/p2p/udplite/lite.go +++ b/gold/p2p/udplite/lite.go @@ -49,7 +49,7 @@ func (sl *sysListener) listenUDP(ctx context.Context, laddr *net.UDPAddr) (*net. sockladdr := sockaddrinterfaceinstance *(**net.UDPAddr)(unsafe.Add(unsafe.Pointer(&sockladdr), unsafe.Sizeof(uintptr(0)))) = laddr sockraddr := sockaddrinterfaceinstance - sockladdr = nil + sockraddr = nil fd, err := internetSocket(ctx, sl.network, sockladdr, sockraddr, syscall.SOCK_DGRAM, IPPROTO_UDPLITE, "listen", ctrlCtxFn) if err != nil { return nil, err diff --git a/upper/services/tunnel/tunnel_test.go b/upper/services/tunnel/tunnel_test.go index 6c82213..9fb415d 100644 --- a/upper/services/tunnel/tunnel_test.go +++ b/upper/services/tunnel/tunnel_test.go @@ -5,6 +5,7 @@ import ( "crypto/rand" "encoding/hex" "io" + "runtime" "strings" "testing" "time" @@ -193,6 +194,9 @@ func TestTunnelUDPSmallMTU(t *testing.T) { } func TestTunnelUDPLite(t *testing.T) { + if runtime.GOOS == "darwin" { + return + } logrus.SetLevel(logrus.DebugLevel) logrus.SetFormatter(&logFormat{enableColor: false}) @@ -209,6 +213,9 @@ func TestTunnelUDPLite(t *testing.T) { } func TestTunnelUDPLiteSmallMTU(t *testing.T) { + if runtime.GOOS == "darwin" { + return + } logrus.SetLevel(logrus.DebugLevel) logrus.SetFormatter(&logFormat{enableColor: false})