From 6705978fc86f48f6d882535c3180eaa7653f298f Mon Sep 17 00:00:00 2001 From: albexk Date: Sat, 10 Feb 2024 17:47:33 +0300 Subject: [PATCH] Add debug udp offload info --- conn/bind_std.go | 5 +++++ conn/bind_windows.go | 4 ++++ conn/bindtest/bindtest.go | 2 ++ conn/conn.go | 2 ++ device/device.go | 1 + 5 files changed, 14 insertions(+) diff --git a/conn/bind_std.go b/conn/bind_std.go index 46df7fd4e..b416e2225 100644 --- a/conn/bind_std.go +++ b/conn/bind_std.go @@ -298,6 +298,11 @@ func (s *StdNetBind) BatchSize() int { return 1 } +func (s *StdNetBind) GetOffloadInfo() string { + return fmt.Sprintf("ipv4TxOffload: %v, ipv4RxOffload: %v\nipv6TxOffload: %v, ipv6RxOffload: %v", + s.ipv4TxOffload, s.ipv4RxOffload, s.ipv6TxOffload, s.ipv6RxOffload) +} + func (s *StdNetBind) Close() error { s.mu.Lock() defer s.mu.Unlock() diff --git a/conn/bind_windows.go b/conn/bind_windows.go index 6cfa09968..3481f0042 100644 --- a/conn/bind_windows.go +++ b/conn/bind_windows.go @@ -328,6 +328,10 @@ func (bind *WinRingBind) BatchSize() int { return 1 } +func (bind *WinRingBind) GetOffloadInfo() string { + return "" +} + func (bind *WinRingBind) SetMark(mark uint32) error { return nil } diff --git a/conn/bindtest/bindtest.go b/conn/bindtest/bindtest.go index 42b0bb704..0df1420af 100644 --- a/conn/bindtest/bindtest.go +++ b/conn/bindtest/bindtest.go @@ -91,6 +91,8 @@ func (c *ChannelBind) Close() error { func (c *ChannelBind) BatchSize() int { return 1 } +func (c *ChannelBind) GetOffloadInfo() string { return "" } + func (c *ChannelBind) SetMark(mark uint32) error { return nil } func (c *ChannelBind) makeReceiveFunc(ch chan []byte) conn.ReceiveFunc { diff --git a/conn/conn.go b/conn/conn.go index a1f57d2b1..489cb3520 100644 --- a/conn/conn.go +++ b/conn/conn.go @@ -55,6 +55,8 @@ type Bind interface { // BatchSize is the number of buffers expected to be passed to // the ReceiveFuncs, and the maximum expected to be passed to SendBatch. BatchSize() int + + GetOffloadInfo() string } // BindSocketToInterface is implemented by Bind objects that support being diff --git a/device/device.go b/device/device.go index a9d62812e..24ae1eab6 100644 --- a/device/device.go +++ b/device/device.go @@ -545,6 +545,7 @@ func (device *Device) BindUpdate() error { } device.log.Verbosef("UDP bind has been updated") + device.log.Verbosef(netc.bind.GetOffloadInfo()) return nil }