mirror of
https://github.com/safing/portmaster
synced 2025-09-01 18:19:12 +00:00
Fix incoming TCP connection direction
This fixes a bug where incoming TCP connections without a matching process would be falsely classified as an outgoing connection.
This commit is contained in:
parent
1e62b9bb59
commit
3b063e9057
2 changed files with 2 additions and 8 deletions
|
@ -107,7 +107,7 @@ func (table *tcpTable) lookup(pktInfo *packet.Info) (
|
|||
}
|
||||
}
|
||||
|
||||
return socket.UnidentifiedProcessID, false, ErrConnectionNotFound
|
||||
return socket.UnidentifiedProcessID, pktInfo.Inbound, ErrConnectionNotFound
|
||||
}
|
||||
|
||||
func (table *udpTable) lookup(pktInfo *packet.Info) (
|
||||
|
|
|
@ -2,7 +2,6 @@ package process
|
|||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
|
||||
"github.com/safing/portmaster/network/state"
|
||||
|
||||
|
@ -10,11 +9,6 @@ import (
|
|||
"github.com/safing/portmaster/network/packet"
|
||||
)
|
||||
|
||||
// Errors
|
||||
var (
|
||||
ErrProcessNotFound = errors.New("could not find process in system state tables")
|
||||
)
|
||||
|
||||
// GetProcessByConnection returns the process that owns the described connection.
|
||||
func GetProcessByConnection(ctx context.Context, pktInfo *packet.Info) (process *Process, connInbound bool, err error) {
|
||||
if !enableProcessDetection() {
|
||||
|
@ -27,7 +21,7 @@ func GetProcessByConnection(ctx context.Context, pktInfo *packet.Info) (process
|
|||
pid, connInbound, err = state.Lookup(pktInfo)
|
||||
if err != nil {
|
||||
log.Tracer(ctx).Debugf("process: failed to find PID of connection: %s", err)
|
||||
return nil, connInbound, err
|
||||
return nil, pktInfo.Inbound, err
|
||||
}
|
||||
|
||||
process, err = GetOrFindPrimaryProcess(ctx, pid)
|
||||
|
|
Loading…
Add table
Reference in a new issue