From 2cd7d3ae57d1377c920918a78940660e42c097ec Mon Sep 17 00:00:00 2001 From: Viktor Oreshkin Date: Sun, 13 Jul 2025 18:15:33 +0300 Subject: [PATCH] rename UDPEstablished to UDPUnconnected I've spent some time debugging issues with UDP forwarding and got sidetracked because of this constant, so I decieded to submit this PR suggesting to change it there's no "established" for the UDP, and 0x7 is usually called UNCONN in tools like net-tools or ss Signed-off-by: Viktor Oreshkin --- pkg/guestagent/guestagent_linux.go | 2 +- pkg/guestagent/procnettcp/procnettcp.go | 2 +- pkg/guestagent/procnettcp/procnettcp_test.go | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/guestagent/guestagent_linux.go b/pkg/guestagent/guestagent_linux.go index 0bcd49efa49..6a665be146c 100644 --- a/pkg/guestagent/guestagent_linux.go +++ b/pkg/guestagent/guestagent_linux.go @@ -237,7 +237,7 @@ func (a *agent) LocalPorts(_ context.Context) ([]*api.IPPort, error) { }) } case procnettcp.UDP, procnettcp.UDP6: - if f.State == procnettcp.UDPEstablished { + if f.State == procnettcp.UDPUnconnected { res = append(res, &api.IPPort{ Ip: f.IP.String(), diff --git a/pkg/guestagent/procnettcp/procnettcp.go b/pkg/guestagent/procnettcp/procnettcp.go index 4372b9517a6..b86237a2209 100644 --- a/pkg/guestagent/procnettcp/procnettcp.go +++ b/pkg/guestagent/procnettcp/procnettcp.go @@ -31,7 +31,7 @@ type State = int const ( TCPEstablished State = 0x1 TCPListen State = 0xA - UDPEstablished State = 0x7 + UDPUnconnected State = 0x7 ) type Entry struct { diff --git a/pkg/guestagent/procnettcp/procnettcp_test.go b/pkg/guestagent/procnettcp/procnettcp_test.go index b92a9c974b2..cd9c2b9de72 100644 --- a/pkg/guestagent/procnettcp/procnettcp_test.go +++ b/pkg/guestagent/procnettcp/procnettcp_test.go @@ -77,7 +77,7 @@ func TestParseUDP(t *testing.T) { assert.Check(t, net.ParseIP("127.0.0.54").Equal(entries[0].IP)) assert.Equal(t, uint16(53), entries[0].Port) - assert.Equal(t, UDPEstablished, entries[0].State) + assert.Equal(t, UDPUnconnected, entries[0].State) } func TestParseAddress(t *testing.T) {