Skip to content

Commit

Permalink
[service] Always put ICMP in the Other Connections group instead of N…
Browse files Browse the repository at this point in the history
…etwork Noise
  • Loading branch information
dhaavi committed May 28, 2024
1 parent 47f805c commit 7e4e4c4
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions service/process/find.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"github.com/safing/portbase/log"
"github.com/safing/portmaster/service/network/netutils"
"github.com/safing/portmaster/service/network/packet"
"github.com/safing/portmaster/service/network/reference"
"github.com/safing/portmaster/service/network/state"
"github.com/safing/portmaster/service/profile"
)
Expand Down Expand Up @@ -77,10 +78,22 @@ func GetPidOfConnection(ctx context.Context, pktInfo *packet.Info) (pid int, con

// Fallback to special profiles if PID could not be found.
if pid == UndefinedProcessID {
if connInbound && !netutils.ClassifyIP(pktInfo.Dst).IsLocalhost() {
pid = UnsolicitedProcessID
} else {
switch {
case !connInbound:
pid = UnidentifiedProcessID

case netutils.ClassifyIP(pktInfo.Dst).IsLocalhost():
// Always treat localhost connections as unidentified/unknown.
pid = UnidentifiedProcessID

case reference.IsICMP(uint8(pktInfo.Protocol)):
// Always treat ICMP as unidentified/unknown, as the direction
// might change to outgoing by new ICMP echo packets.
pid = UnidentifiedProcessID

default:
// All other inbound connections are "unsolicited".
pid = UnsolicitedProcessID
}
}

Expand Down

0 comments on commit 7e4e4c4

Please sign in to comment.