From ead271f51cf79feb11879f4022fc660ffa99e8fe Mon Sep 17 00:00:00 2001 From: Vladimir Stoilov Date: Thu, 28 Mar 2024 18:15:13 +0200 Subject: [PATCH] Update Ipv6 connections on setting change --- firewall/interception/windowskext2/kext.go | 30 +++++++++++++++------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/firewall/interception/windowskext2/kext.go b/firewall/interception/windowskext2/kext.go index 467ea26e..31fa5f27 100644 --- a/firewall/interception/windowskext2/kext.go +++ b/firewall/interception/windowskext2/kext.go @@ -120,17 +120,29 @@ func ClearCache() error { // Updates a specific connection verdict. func UpdateVerdict(conn *network.Connection) error { + if conn.IPVersion == 4 { + update := kext_interface.UpdateV4{ + Protocol: conn.Entity.Protocol, + LocalAddress: [4]byte(conn.LocalIP), + LocalPort: conn.LocalPort, + RemoteAddress: [4]byte(conn.Entity.IP), + RemotePort: conn.Entity.Port, + Verdict: uint8(conn.Verdict.Active), + } - update := kext_interface.UpdateV4{ - Protocol: conn.Entity.Protocol, - LocalAddress: [4]byte(conn.LocalIP), - LocalPort: conn.LocalPort, - RemoteAddress: [4]byte(conn.Entity.IP), - RemotePort: conn.Entity.Port, - Verdict: uint8(conn.Verdict.Active), + return kext_interface.SendUpdateV4Command(kextFile, update) + } else if conn.IPVersion == 6 { + update := kext_interface.UpdateV6{ + Protocol: conn.Entity.Protocol, + LocalAddress: [16]byte(conn.LocalIP), + LocalPort: conn.LocalPort, + RemoteAddress: [16]byte(conn.Entity.IP), + RemotePort: conn.Entity.Port, + Verdict: uint8(conn.Verdict.Active), + } + + return kext_interface.SendUpdateV6Command(kextFile, update) } - - kext_interface.SendUpdateV4Command(kextFile, update) return nil }