diff --git a/mosdns/patches/110-fixed-715.patch b/mosdns/patches/110-fixed-715.patch new file mode 100644 index 000000000..5c6d43c2d --- /dev/null +++ b/mosdns/patches/110-fixed-715.patch @@ -0,0 +1,45 @@ +From 2eaae3d11ea6b6954e820c48c36b9122e3882562 Mon Sep 17 00:00:00 2001 +From: Irine Sistiana <49315432+IrineSistiana@users.noreply.github.com> +Date: Tue, 19 Sep 2023 07:59:17 +0800 +Subject: [PATCH] fixed #715 + +--- + pkg/server/udp.go | 11 ++++++----- + 1 file changed, 6 insertions(+), 5 deletions(-) + +diff --git a/pkg/server/udp.go b/pkg/server/udp.go +index a1e478b..8bb1b85 100644 +--- a/pkg/server/udp.go ++++ b/pkg/server/udp.go +@@ -66,14 +66,15 @@ func (s *UDPServer) ServeUDP(c *net.UDPConn) error { + if err != nil { + return fmt.Errorf("failed to init oob handler, %w", err) + } +- var ob *[]byte ++ var ob []byte + if oobReader != nil { +- ob = pool.GetBuf(1024) +- defer pool.ReleaseBuf(ob) ++ obp := pool.GetBuf(1024) ++ defer pool.ReleaseBuf(obp) ++ ob = *obp + } + + for { +- n, oobn, _, remoteAddr, err := c.ReadMsgUDPAddrPort(*rb, *ob) ++ n, oobn, _, remoteAddr, err := c.ReadMsgUDPAddrPort(*rb, ob) + if err != nil { + return fmt.Errorf("unexpected read err: %w", err) + } +@@ -88,7 +89,7 @@ func (s *UDPServer) ServeUDP(c *net.UDPConn) error { + var dstIpFromCm net.IP + if oobReader != nil { + var err error +- dstIpFromCm, err = oobReader((*ob)[:oobn]) ++ dstIpFromCm, err = oobReader(ob[:oobn]) + if err != nil { + s.opts.Logger.Error("failed to get dst address from oob", zap.Error(err)) + } +-- +2.34.8 +