From 7e4e4c47a8342a7ff77a3adca32fc0f244322576 Mon Sep 17 00:00:00 2001 From: Daniel Date: Tue, 28 May 2024 16:32:28 +0200 Subject: [PATCH] [service] Always put ICMP in the Other Connections group instead of Network Noise --- service/process/find.go | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/service/process/find.go b/service/process/find.go index 98681832..8438ecfd 100644 --- a/service/process/find.go +++ b/service/process/find.go @@ -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" ) @@ -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 } }