b4 icon indicating copy to clipboard operation
b4 copied to clipboard

Import: a zapret profile with both TCP and UDP filters ignores --dpi-desync-fake-quic

Open DanielLavrushin opened this issue 3 weeks ago • 0 comments

The zapret import ignores the QUIC fake payload of a profile that filters both TCP and UDP. With --filter-tcp=443 --filter-udp=443 --dpi-desync=fake --dpi-desync-fake-quic=<value>:

  • the report lists --dpi-desync-fake-quic=... as an unknown option (unaccountedOption);
  • the set gets UDP fakes (udp.mode=fake, ports 443), but with the default empty udp.fake_payload_file, which means zero-filled fakes.

This is the same whether the value is a file path, a hex payload or an all-zero literal. --dpi-desync-fake-unknown-udp goes through the same path.

Measured with /api/convert/analyze on the PR #578 branch:

--dpi-desync-fake-quic= UDP-only profile (--filter-udp=443) TCP and UDP profile (--filter-tcp=443 --filter-udp=443)
/opt/zapret/files/fake/quic_initial_www_google_com.bin @quic_initial, approximated default (zeros), unknown option
0x0d0a0bfc saved as a QUIC payload (#578) default (zeros), unknown option
0x00000000 zeros, mapped default (zeros), unknown option

Cause

The UDP fake settings live on prof.Fake while parsing, and promoteUDPFake (src/convert/tool_zapret.go:440) copies them to prof.UDP only for UDP-only profiles. For any other profile prof.UDP stays empty, so emitUDP returns at src/convert/emit.go:320 before it reads QUICRef, QUICData or ZeroRef. The UDP mode itself comes from --dpi-desync=fake (desyncModesMapped), so the set still sends UDP fakes, just with the default payload.

Direction

  • Carry the UDP fake fields (QUICRef, QUICData, and ZeroRef, which is set on prof.UDP directly) to the set for every profile that has UDP filters, not only UDP-only ones. Then emitUDP handles them, and the hex case saves its payload the way #578 does.
  • The change touches every combined TCP and UDP zapret profile, so run it against the zapretConfigs table in src/convert/tool_zapret_test.go. Add a case per value form (file, hex, zero) for a combined profile.

Found by Copilot in the review of #578 (https://github.com/DanielLavrushin/b4/pull/578#pullrequestreview-5897134403). It predates that PR.

DanielLavrushin avatar Nov 13 '26 20:11 DanielLavrushin