mirror of
https://github.com/safing/portmaster
synced 2025-09-01 18:19:12 +00:00
Merge pull request #108 from safing/fix/connection-direction
Fix incoming TCP connection direction
This commit is contained in:
commit
2dfc5da531
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) (
|
func (table *udpTable) lookup(pktInfo *packet.Info) (
|
||||||
|
|
|
@ -2,7 +2,6 @@ package process
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"errors"
|
|
||||||
|
|
||||||
"github.com/safing/portmaster/network/state"
|
"github.com/safing/portmaster/network/state"
|
||||||
|
|
||||||
|
@ -10,11 +9,6 @@ import (
|
||||||
"github.com/safing/portmaster/network/packet"
|
"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.
|
// GetProcessByConnection returns the process that owns the described connection.
|
||||||
func GetProcessByConnection(ctx context.Context, pktInfo *packet.Info) (process *Process, connInbound bool, err error) {
|
func GetProcessByConnection(ctx context.Context, pktInfo *packet.Info) (process *Process, connInbound bool, err error) {
|
||||||
if !enableProcessDetection() {
|
if !enableProcessDetection() {
|
||||||
|
@ -27,7 +21,7 @@ func GetProcessByConnection(ctx context.Context, pktInfo *packet.Info) (process
|
||||||
pid, connInbound, err = state.Lookup(pktInfo)
|
pid, connInbound, err = state.Lookup(pktInfo)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Tracer(ctx).Debugf("process: failed to find PID of connection: %s", err)
|
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)
|
process, err = GetOrFindPrimaryProcess(ctx, pid)
|
||||||
|
|
Loading…
Add table
Reference in a new issue