Import: a zapret UDP profile is folded into the TCP set without regard to --skip
The zapret import merges a UDP-only profile into the TCP set next to it without looking at --skip. nfqws does not use a skipped profile at all, and on its own the import turns such a profile into a disabled set. Once a fold is involved, the skip is lost in one direction and spreads in the other.
Measured with convert.Analyze on main (757bacba3) and on the #583 branch, same result on both:
| Command line | Result | Expected |
|---|---|---|
--skip --filter-udp=443 --dpi-desync=fake --dpi-desync-repeats=11 --new --filter-tcp=443 --hostlist-domains=a.com --dpi-desync=fake |
One enabled set with udp.dport_filter=443 and udp.fake_seq_length=11. --skip reads udpFoldedIntoSet. |
The skipped profile's UDP settings are not applied. |
--filter-udp=443 --dpi-desync=fake --dpi-desync-repeats=11 --new --skip --filter-tcp=443 --hostlist-domains=a.com --dpi-desync=fake |
One disabled set that holds the UDP settings. --skip reads skipMapped. |
The UDP profile is in use in zapret, so it is not swallowed by a disabled set. |
--filter-tcp=443 --hostlist-domains=a.com --dpi-desync=multisplit --new --skip --filter-tcp=80 --hostlist-domains=b.com --dpi-desync=fake (no fold) |
Two sets, the second disabled with skipMapped. |
This is the correct behaviour. |
Cause
foldUDPProfiles in src/convert/parse.go picks the profile to fold with p.UDPOnly() && !p.hasOwnTargets() && !p.wantsL7() and the set that takes it with p.IsEntry() && !p.UDPOnly(). Neither condition reads p.Skip.
- A skipped UDP-only profile is folded like any other. Its tokens move to the carrier, and the carrier is not skipped, so the set stays enabled with that UDP side.
- A skipped TCP profile is a carrier like any other. The fold moves the live UDP profile into it, and
emitZapretExtrasthen disables the whole set.
Direction
- Leave skipped profiles out of the fold on both sides: a skipped UDP-only profile stays its own disabled set, and a skipped profile takes no fold.
- With the skipped profile out, the number of carriers or foldable profiles can drop to one, so a fold that did not happen before may happen now. Check the fold tests for that.
- Add a case per row of the table above next to the fold tests in
src/convert/udp_test.go.
Found while working on #583, which fixed the neighbouring case: a skipped UDP profile no longer stops a later profile from keeping its UDP fake options. The fold itself predates that PR.