From 27e15452ee50ce11159ac0bf730d3bd3a04fb2e2 Mon Sep 17 00:00:00 2001 From: Mute Date: Thu, 13 Aug 2026 08:02:28 +0000 Subject: [PATCH] fix: filter out own outgoing frames on Windows client MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Npcap in promiscuous mode loops back our own sent frames to the capture callback. Without filtering, every DATA frame the client sent was also processed as an incoming frame, duplicating the data stream. This corrupted SSH sessions (Bad packet length 0x5353482D = 'SSH-' — the version banner received twice). Fix: compare source MAC in captured frames against our own MAC and skip matches. Mirrors the PACKET_OUTGOING check on the Rust side. --- win/gatuna-client/TunnelLink.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/win/gatuna-client/TunnelLink.cs b/win/gatuna-client/TunnelLink.cs index 12b3dfa..4880303 100644 --- a/win/gatuna-client/TunnelLink.cs +++ b/win/gatuna-client/TunnelLink.cs @@ -50,6 +50,11 @@ sealed class TunnelLink : IDisposable var et = (ushort)(data[12] << 8 | data[13]); if (et != Proto.EtherType) return; + // Skip our own outgoing frames (Npcap loops them back in promiscuous mode). + if (data[6] == _ourMac[0] && data[7] == _ourMac[1] + && data[8] == _ourMac[2] && data[9] == _ourMac[3] + && data[10] == _ourMac[4] && data[11] == _ourMac[5]) + return; var srcMac = new byte[6]; Buffer.BlockCopy(data, 6, srcMac, 0, 6); var payload = data.AsSpan(Proto.EthHeaderLen);