fix: udp handling and ipv4 and ipv6 filtering
This commit is contained in:
@@ -246,11 +246,6 @@ func getSocketInfo(pid, fd int, procName string, uid int, user string) (Connecti
|
||||
raddr = ipv6ToString(info.raddr6)
|
||||
}
|
||||
|
||||
state := ""
|
||||
if info.sock_type == C.SOCK_STREAM {
|
||||
state = tcpStateToString(int(info.state))
|
||||
}
|
||||
|
||||
if laddr == "0.0.0.0" || laddr == "::" {
|
||||
laddr = "*"
|
||||
}
|
||||
@@ -258,6 +253,18 @@ func getSocketInfo(pid, fd int, procName string, uid int, user string) (Connecti
|
||||
raddr = "*"
|
||||
}
|
||||
|
||||
state := ""
|
||||
if info.sock_type == C.SOCK_STREAM {
|
||||
state = tcpStateToString(int(info.state))
|
||||
} else if info.sock_type == C.SOCK_DGRAM {
|
||||
// udp is connectionless - infer state from remote address
|
||||
if raddr == "*" && int(info.rport) == 0 {
|
||||
state = "LISTEN"
|
||||
} else {
|
||||
state = "ESTABLISHED"
|
||||
}
|
||||
}
|
||||
|
||||
conn := Connection{
|
||||
TS: time.Now(),
|
||||
Proto: proto,
|
||||
|
||||
Reference in New Issue
Block a user