Fix rebase error and clean up

This commit is contained in:
Daniel 2022-10-10 14:24:14 +02:00
parent 57d515b344
commit f0449c402b

View file

@ -13,7 +13,6 @@ import (
"github.com/tevino/abool" "github.com/tevino/abool"
"golang.org/x/sync/singleflight" "golang.org/x/sync/singleflight"
"github.com/safing/portbase/config"
"github.com/safing/portbase/log" "github.com/safing/portbase/log"
"github.com/safing/portbase/modules" "github.com/safing/portbase/modules"
"github.com/safing/portmaster/compat" "github.com/safing/portmaster/compat"
@ -45,12 +44,6 @@ var (
ownPID = os.Getpid() ownPID = os.Getpid()
) )
// Config variables for interception module.
var (
devMode config.BoolOption
apiListenAddress config.StringOption
)
const ( const (
configChangeEvent = "config change" configChangeEvent = "config change"
profileConfigChangeEvent = "profile config change" profileConfigChangeEvent = "profile config change"
@ -121,28 +114,11 @@ func resetAllConnectionVerdicts() {
// this will set new verdicts if configuration was update or spn has been disabled or enabled. // this will set new verdicts if configuration was update or spn has been disabled or enabled.
log.Info("interception: marking all connections for re-evaluation") log.Info("interception: marking all connections for re-evaluation")
// reset all connection firewall handlers. This will tell the master to rerun the firewall checks.
// for _, conn := range network.GetAllConnections() {
// isSPNConnection := captain.IsExcepted(conn.Entity.IP) && conn.Process().Pid == ownPID
// // mark all non SPN connections to be processed by the firewall.
// if !isSPNConnection {
// conn.Lock()
// conn.SetFirewallHandler(initialHandler)
// // Don't keep the previous tunneled value.
// conn.Tunneled = false
// // Reset entity if it exists.
// if conn.Entity != nil {
// conn.Entity.ResetLists()
// }
// conn.Unlock()
// }
// }
// Create tracing context. // Create tracing context.
ctx, tracer := log.AddTracer(context.Background()) ctx, tracer := log.AddTracer(context.Background())
defer tracer.Submit() defer tracer.Submit()
// Re-evaluate all connections.
for _, conn := range network.GetAllConnections() { for _, conn := range network.GetAllConnections() {
func() { func() {
conn.Lock() conn.Lock()
@ -542,6 +518,9 @@ func filterConnection(ctx context.Context, conn *network.Connection, pkt packet.
conn.TunnelContext == nil { conn.TunnelContext == nil {
err := requestTunneling(ctx, conn) err := requestTunneling(ctx, conn)
if err != nil { if err != nil {
// Set connection to failed, but keep tunneling data.
// The tunneling data makes connection easy to recognize as a failed SPN
// connection and the data will help with debugging and displaying in the UI.
conn.Failed(fmt.Sprintf("failed to request tunneling: %s", err), "") conn.Failed(fmt.Sprintf("failed to request tunneling: %s", err), "")
finalizeVerdict(conn) finalizeVerdict(conn)
} }