Fix Linux process search matching the wrong socket

This commit is contained in:
世界
2026-09-06 15:51:35 +08:00
parent 288411b0b9
commit 4ef3432c0d
3 changed files with 234 additions and 28 deletions
+3 -1
View File
@@ -101,6 +101,8 @@ func (s *linuxSearcher) FindProcessInfo(ctx context.Context, network string, sou
}
func (s *linuxSearcher) resolveSocketByNetlink(network string, source netip.AddrPort, destination netip.AddrPort) (inode, uid uint32, err error) {
source = netip.AddrPortFrom(source.Addr().Unmap(), source.Port())
destination = netip.AddrPortFrom(destination.Addr().Unmap(), destination.Port())
family, protocol, err := socketDiagSettings(network, source)
if err != nil {
return 0, 0, err
@@ -118,7 +120,7 @@ func (s *linuxSearcher) resolveSocketByNetlink(network string, source netip.Addr
return 0, 0, err
}
}
return querySocketDiagOnce(family, protocol, source)
return dumpSocketDiag(family, protocol, source, destination)
}
func (s *linuxSearcher) findProcessPath(targetInode, uid uint32) (string, error) {