Skip to content

Commit 861948f

Browse files
committed
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 keep old UDPEstablished for backwards compatibility Signed-off-by: Viktor Oreshkin <[email protected]>
1 parent c841df5 commit 861948f

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

pkg/guestagent/guestagent_linux.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ func (a *agent) LocalPorts(_ context.Context) ([]*api.IPPort, error) {
237237
})
238238
}
239239
case procnettcp.UDP, procnettcp.UDP6:
240-
if f.State == procnettcp.UDPEstablished {
240+
if f.State == procnettcp.UDPUnconnected {
241241
res = append(res,
242242
&api.IPPort{
243243
Ip: f.IP.String(),

pkg/guestagent/procnettcp/procnettcp.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,9 @@ type State = int
3131
const (
3232
TCPEstablished State = 0x1
3333
TCPListen State = 0xA
34-
UDPEstablished State = 0x7
34+
UDPUnconnected State = 0x7
35+
// Deprecated: Use UDPUnconnected directly instead.
36+
UDPEstablished State = UDPUnconnected
3537
)
3638

3739
type Entry struct {

pkg/guestagent/procnettcp/procnettcp_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ func TestParseUDP(t *testing.T) {
7777

7878
assert.Check(t, net.ParseIP("127.0.0.54").Equal(entries[0].IP))
7979
assert.Equal(t, uint16(53), entries[0].Port)
80-
assert.Equal(t, UDPEstablished, entries[0].State)
80+
assert.Equal(t, UDPUnconnected, entries[0].State)
8181
}
8282

8383
func TestParseAddress(t *testing.T) {

0 commit comments

Comments
 (0)