fix: resolve asymmetric packet loss (zero upload) by enforcing strict MTU caps and reducing TUN interface MTU to 1300 to prevent UDP fragmentation on outbound traffic

This commit is contained in:
ospab 2026-05-15 19:54:07 +03:00
parent 3ad3390057
commit d34a1dd29a
4 changed files with 6 additions and 4 deletions

View File

@ -533,7 +533,7 @@ impl Bridge {
psk, psk,
session_id, session_id,
handshake_payload, handshake_payload,
max_padding: 1400, // §7 FIX: Allow padding up to full MTU size to break traffic analysis fingerprints max_padding: 1280, // Safe MTU size to avoid UDP fragmentation on Windows/PPPoE
padding_strategy: PaddingStrategy::Profile(self.profile), padding_strategy: PaddingStrategy::Profile(self.profile),
obfuscation_key: obf_key, obfuscation_key: obf_key,
max_reorder: 262144, max_reorder: 262144,

View File

@ -138,6 +138,7 @@ pub async fn run_linux_tunnel(
// 4. Setup commands (Using standard /1 routing trick for fail-proof overriding) // 4. Setup commands (Using standard /1 routing trick for fail-proof overriding)
let setup_script = format!( let setup_script = format!(
"ip tuntap add name ostp_tun mode tun || true; \ "ip tuntap add name ostp_tun mode tun || true; \
ip link set dev ostp_tun mtu 1300; \
ip addr add 10.1.0.2/24 dev ostp_tun || true; \ ip addr add 10.1.0.2/24 dev ostp_tun || true; \
ip link set dev ostp_tun up; \ ip link set dev ostp_tun up; \
ip route add {} via {} dev {}; \ ip route add {} via {} dev {}; \

View File

@ -137,6 +137,7 @@ pub async fn run_wintun_tunnel(
// to the physical interface DNS servers, which are physically routed and work flawlessly. // to the physical interface DNS servers, which are physically routed and work flawlessly.
let net_setup = "\ let net_setup = "\
netsh interface ipv4 set address name=\"ostp_tun\" static 10.1.0.2 255.255.255.0 10.1.0.1\n\ netsh interface ipv4 set address name=\"ostp_tun\" static 10.1.0.2 255.255.255.0 10.1.0.1\n\
netsh interface ipv4 set subinterface \"ostp_tun\" mtu=1300 store=persistent\n\
netsh interface ipv4 set interface name=\"ostp_tun\" metric=5\n"; netsh interface ipv4 set interface name=\"ostp_tun\" metric=5\n";
let _ = Command::new("powershell") let _ = Command::new("powershell")

View File

@ -10,9 +10,9 @@ pub enum TrafficProfile {
impl TrafficProfile { impl TrafficProfile {
pub fn target_size(&self, current: usize) -> usize { pub fn target_size(&self, current: usize) -> usize {
match self { match self {
TrafficProfile::JsonRpc => align_up(current.max(220), 64).min(1408), TrafficProfile::JsonRpc => align_up(current.max(220), 64).min(1280),
TrafficProfile::HttpsBurst => align_up(current.max(1200), 128).min(1472), TrafficProfile::HttpsBurst => align_up(current.max(1200), 128).min(1280),
TrafficProfile::VideoStream => align_up(current.max(900), 188).min(1472), TrafficProfile::VideoStream => align_up(current.max(900), 188).min(1280),
} }
} }
} }