diff --git a/tunnel/intercept/proxy/proxy.go b/tunnel/intercept/proxy/proxy.go index 46b883a37..865269783 100644 --- a/tunnel/intercept/proxy/proxy.go +++ b/tunnel/intercept/proxy/proxy.go @@ -158,7 +158,7 @@ type udpReader struct { func (reader *udpReader) generateReadEvents(manager udp_vconn.Manager) { log := pfxlog.Logger().WithField("service", reader.service) - bufPool := mempool.NewPool(16, info.MaxPacketSize) + bufPool := mempool.NewPool(16, info.MaxUdpPacketSize) for { buf := bufPool.AcquireBuffer() n, srcAddr, err := reader.conn.ReadFromUDP(buf.Buf) diff --git a/tunnel/intercept/tproxy/tproxy_linux.go b/tunnel/intercept/tproxy/tproxy_linux.go index 8c217dfd2..ca0d0e46b 100644 --- a/tunnel/intercept/tproxy/tproxy_linux.go +++ b/tunnel/intercept/tproxy/tproxy_linux.go @@ -172,12 +172,12 @@ func (t *tProxyInterceptor) acceptUDP(context ziti.Context) { func (t *tProxyInterceptor) generateReadEvents(manager udp_vconn.Manager) { oobSize := 1600 - bufPool := mempool.NewPool(16, info.MaxPacketSize+oobSize) + bufPool := mempool.NewPool(16, info.MaxUdpPacketSize+oobSize) for { pooled := bufPool.AcquireBuffer() - oob := pooled.Buf[info.MaxPacketSize:] - pooled.Buf = pooled.Buf[:info.MaxPacketSize] + oob := pooled.Buf[info.MaxUdpPacketSize:] + pooled.Buf = pooled.Buf[:info.MaxUdpPacketSize] n, oobn, _, srcAddr, err := t.udpLn.ReadMsgUDP(pooled.Buf, oob) if err != nil { manager.QueueError(err) diff --git a/tunnel/tunnel.go b/tunnel/tunnel.go index d4194b342..e98c93697 100644 --- a/tunnel/tunnel.go +++ b/tunnel/tunnel.go @@ -67,7 +67,7 @@ func myCopy(dst net.Conn, src net.Conn, done chan int64) { defer dst.Close() defer log.WithFields(loggerFields).Info("stopping pipe") - copyBuf := make([]byte, info.MaxPacketSize) + copyBuf := make([]byte, info.MaxUdpPacketSize) n, err := io.CopyBuffer(dst, src, copyBuf) done <- n