diff --git a/rules/common/uid.go b/rules/common/uid.go index d5321581..f7ea4875 100644 --- a/rules/common/uid.go +++ b/rules/common/uid.go @@ -72,14 +72,14 @@ func (u *Uid) RuleType() C.RuleType { } func (u *Uid) Match(metadata *C.Metadata) bool { - srcPort, err := strconv.Atoi(metadata.SrcPort) + srcPort, err := strconv.ParseUint(metadata.SrcPort, 10, 16) if err != nil { return false } var uid int32 if metadata.Uid != nil { uid = *metadata.Uid - } else if uid, err = process.FindUid(metadata.NetWork.String(), metadata.SrcIP, srcPort); err == nil { + } else if uid, err = process.FindUid(metadata.NetWork.String(), metadata.SrcIP, int(srcPort)); err == nil { metadata.Uid = &uid } else { log.Warnln("[UID] could not get uid from %s", metadata.String()) diff --git a/tunnel/tunnel.go b/tunnel/tunnel.go index 936b2b48..b8038520 100644 --- a/tunnel/tunnel.go +++ b/tunnel/tunnel.go @@ -181,9 +181,9 @@ func preHandleMetadata(metadata *C.Metadata) error { } // pre resolve process name - srcPort, err := strconv.Atoi(metadata.SrcPort) + srcPort, err := strconv.ParseUint(metadata.SrcPort, 10, 16) if err == nil && P.ShouldFindProcess(metadata) { - uid, path, err := P.FindProcessName(metadata.NetWork.String(), metadata.SrcIP, srcPort) + uid, path, err := P.FindProcessName(metadata.NetWork.String(), metadata.SrcIP, int(srcPort)) if err != nil { if failTotal < 20 { log.Debugln("[Process] find process %s: %v", metadata.String(), err)