| Commit message (Collapse) | Author | Age | Files | Lines |
| | |
|
| | |
|
| |
|
|
| |
Fallback to zeroed timestamp when time()/localtime_r() fails.
|
| |
|
|
| |
24 KiB is precious :)
|
| | |
|
| | |
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
set_opt() was logging each option as it set them, which created a
tight coupling between option initialization and log output timing.
This was particularly problematic for daemon mode: daemonize must
happen after set_opt() (to know whether -D was passed) but before
logging (so output goes to the log file, not stdout).
Split into set_opt() -> InitializedOpts and InitializedOpts::log(),
using a typestate pattern to enforce at compile time that log() cannot
be called before set_opt(). This lets each platform's bootstrap()
handle daemonization between the two steps:
let initialized = opt.set_opt()?;
platform::bootstrap()?; // daemonize here if needed
initialized.log(); // now safe to log
Also:
- Move daemonize_1() into platform::bootstrap() on both platforms
- Make daemonize_1() / service_main() private to their platform modules
- Fix the long-standing TODO about using log_println in daemonize()
|
| |
|
|
|
|
|
|
|
| |
1. open without O_APPEND (offset = 0) and O_TRUNC (original bug)
2. dup file descripter with .try_clone() and feed it to daemonize
3. truncate file with .set_len(0) on child after daemonize.start()
succed
Fixes: https://github.com/dilluti0n/dpibreak/issues/17
|
| | |
|
| | |
|
| |
|
|
| |
Fixes: https://github.com/dilluti0n/dpibreak/issues/16
|
| |
|
|
|
| |
Prevent multiple non-daemon dpibreak instances using flock(). Show
existing PID on conflict and maintain lock until process termination.
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
| |
The bootstrap/run separation was unnecessary. Move all initialization
(cleanup + nftables setup): into run() and skip bootstrap in daemon
mode. We repurpose the bootstrap() function to only run in non-daemon
mode for future foreground-only initialization.
- Add OPT_DAEMON option to detect daemon mode
- Move cleanup() and install_rules() from bootstrap() to run()
- Make bootstrap() a no-op (only called in non-daemon mode)
|
| | |
|
| |
|
|
|
|
|
|
|
| |
Revert lock_handle()
send_to_raw cannot get a mutex since lock is not released per
iteration.
commit e08b57d281d8368dc02f06e3b6cd43edf88b2438
|
| |
|
|
|
| |
Closes: #2
Link: https://github.com/dilluti0n/dpibreak/issues/2
|
| | |
|
| |
|
|
| |
Now --fake-* options implicitly turn on --fake option.
|
| | |
|
| | |
|
| | |
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
- Introduce `EvictPriority` enum.
- Optimize `is_stale` and `evict_priority` by passing entry references
to eliminate redundant memory loads.
pkt: hoptab: derive stale age from CAP
Replace the magic `64` threshold with `STALE_AGE = CAP >> 1` and make
the stale check inclusive (`age >= STALE_AGE`). This keeps the
eviction/staleness policy consistent when CAP changes and documents
the intended half-table age cutoff.
pkt: hoptab: add compile time assertion for CAP
pkt: hoptab: add comments
|
| |
|
|
|
| |
Use ST_OCCUPIED instead of ST_EMPTY to avoid skipping valid entries;
add debug logs
|
| | |
|
| |
|
|
|
|
|
|
|
| |
- add pkt::hoptab: small fixed-size hash table keyed by
IP (v4-mapped/v6) with TTL-based staleness + simple eviction
- store (src_ip -> inferred hop) on SYN/ACK from :443
- lookup (dst_ip -> hop) when crafting fake ClientHello, fallback to
--fake-ttl on miss
- add PktView helpers: ttl(), saddr(), daddr()
|
| | |
|
| | |
|
| |
|
|
|
|
|
| |
Build WinDivert filter at runtime:
- Default: outbound TLS ClientHello packets
- --fake-autottl: also capture inbound SYN/ACK from tcp sport 443
Keep !impostor to avoid recapture.
|
| |
|
|
|
|
| |
- Add mangle/INPUT jump to DPIBREAK
- Queue tcp sport 443 SYN/ACK packets (NFQUEUE --queue-bypass)
- Cleanup removes INPUT jump as well
|
| |
|
|
| |
- simplify nftables rules by removing DPIBREAK chain
|
| | |
|
| |
|
|
|
|
|
| |
Split iptables and nftables rule management into dedicated modules.
Keep linux.rs focused on shared helpers and rule dispatch.
(cherry picked from commit 60c0011ca0cf5a463056fca17f2f747e762e19f9)
|
| | |
|
| |
|
|
| |
Introduce minimal iptables wrapper.
|
| | |
|
| | |
|
| | |
|
| | |
|
| |
|
|
|
| |
Initialize log_level from DEFAULT_LOG_LEVEL instead of duplicated
cfg(debug_assertions) branches in parse_args_1().
|
| | |
|
| | |
|
| |
|
|
|
| |
Move option parsing to opt.rs and packet handling to pkt.rs from
main.rs
|
| |
|
|
|
|
| |
- Extend split_packet_0 to optionally override TCP checksum.
- Compute L3 header length for IPv4/IPv6 and patch checksum field when requested.
- Wire fake_clienthello to set checksum to 0 when fake_badsum() is enabled.
|
| |
|
|
| |
For --fake-badsum work; Anyway, it is already calculated
|
| | |
|
| |
|
|
| |
Fake was enabled by default.....
|
| |
|
|
| |
Log runtime options on startup
|