| Commit message (Collapse) | Author | Age | Files | Lines |
| | |
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
Query the service state with `sc query windivert` at startup, as this
is observed to resolve the bad state described in commit 168a88b8
("windows: fix some kind of race").
This is a defensive measure against the driver uninstall introduced by
that commit. Normally the uninstall is attempted only after all
handles opened by the current process are closed, but if another
process still holds an open WinDivert handle at that point, the driver
can remain stuck in a bad state on subsequent runs.
Link: https://github.com/basil00/WinDivert/issues/406
|
| |
|
|
|
| |
It is unlikely that there is a `paexit` call in the service path, but
there is no harm in checking for it.
|
| |
|
|
|
|
|
|
| |
loop on CTRL_CLOSE_EVENT handler causes pause occurs when the user
closes the console by clicking the 'X' button, which degrades user
experience.
This change terminates program immediately if no error occurs.
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
| |
Uninstalling before all handles were closed resulted in a os error
1058 when try to open windivert. (sc stop windivert fixed it)
Assumed the uninstallation would fail if the handle was still
active, but it seems the initial uninstallation actually succeeded,
while the subsequent attempt to close the remaining handles failed.
Closing send handle that hadn't been closed previously and then
explicitly performed the uninstallation fixes the issue.
|
| |
|
|
|
|
|
| |
This allows the WinDivert.sys can be removed after the program
terminates, without needing to run `sc stop windivert`.
Bug: https://github.com/dilluti0n/dpibreak/issues/21
|
| | |
|
| |
|
|
|
| |
This inturrupts blocking recv() calls resulting WinDivert service can
be safely removed.
|
| |
|
|
| |
See error message
|
| | |
|
| |
|
|
| |
Result should be unusable after Pkt is dropped, not rx is dropped.
|
| |
|
|
|
|
|
|
|
| |
While solving it, introduced Pkt abstraction so that advance() is
automatically executed upon dropping it.
This change still allows access to mmapped pointers within the
Pkt.net() and enables the addition of other slice fields (such as mac)
later.
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| |
|
|
|
|
|
|
|
| |
cleanup_rules() relies on the global flag IS_NFT_NOT_SUPPORTED, which
is always False before install_rule is called. Fixed it to always
attempt cleanup for ipt/ip6/nft at startup.
At the same time, implement Drop so that firewall cleanup occurs when
dies due to ?.
|
| |
|
|
| |
This makes windows users able to see the error message.
|
| | |
|
| | |
|
| |
|
|
|
|
| |
It would be better if libc_s did not provide signalfd. The
open_signalfd() function itself has issues, such as sigprocmask being
applied elsewhere before opening it.
|
| |\
| |
| |
| |
| | |
Drop nix and add libc_s wrappers (with nix::fcntl like setsockopt
abstraction).
|
| | |
| |
| |
| |
| | |
This is likely new feature in kernel. (mayby 5.6 or something near
there)
|
| | | |
|
| | |
| |
| |
| |
| |
| |
| | |
Here mmap/munmap wrapper remain unsafe since mmap returns a pointer
causes a memory leak when munmap is not called while dropping, and
munmap has strict rule (PAGE_SIZE aligned) for addr defined on
munmap(2).
|
| | | |
|
| | |
| |
| |
| |
| |
| |
| |
| |
| | |
The existing implementation was unsafe because UB could occur if a
user-space pointer referenced by the struct sock_fprog was incorrectly
passed. Rust safe model allows pointer creation and makes
dereferencing unsafe. In this case, dereferencing happenes in
kernel-space, Rust cannot guarantee this. So it must be handled
separately.
|
| | |
| |
| |
| |
| |
| | |
Treating optval as just a &[u8] in setsockopt() is not appropriate for
usage patterns where a struct is put into optval. Rust treats casting
a struct to &[u8] as unsafe.
|
| | | |
|
| | | |
|
| | | |
|
| | |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
When I updated nix to 0.31, `nix::fcntl::flock` became deprecated and
unusable. At first I try to refactor `lock_pid_file()` to use the
`lock` method of the `nix::fcntl::Flock` struct, but a situation arose
where `set_len(0)` could not be called due to ownership issues. Linux
system calls are fundamentally simple, stable, and backward
compatible. Therefore, a compat layer is not necessary.
Anticipating that this might happen again, this commit introduce the
`libc_s`, which handles simple error processing for unsafe ffis in
libc syscall bindings.
|
| | | |
|
| |/ |
|
| |
|
|
|
|
| |
Keeping poll_once() separate just caused more headaches. It was also
rebuilding the fds array every single time. Since poll() only
overwrites revents, doing that on every loop was totally unnecessary.
|
| |
|
|
|
|
| |
This integrates well with the main poll loop and removes the global
AtomicBool RUNNING, which previously did nothing but detect interrupts
before entering the loop.
|
| |
|
|
|
|
| |
UAC elevation spawns a new console that closes when the process
exits, cutting off --help output and error messages. Add a pause
on Windows-only exit paths via _getch().
|
| |
|
|
|
|
|
|
| |
When both fds are ready in the same wakeup, the SYN/ACK that triggered
rx_ready is causally prior to the ClientHello waiting in the nfqueue.
Process the rxring first so HopTab is populated before handle_packet
runs find_hop, reducing the race window for HopLookupError::NotFound
under load.
|
| |
|
|
|
| |
Previously checked `argv == "--loglevel"` by mistake, copied from the
--loglevel deprecation pattern. Now correctly checks `argv == "-D"`.
|
| | |
|
| | |
|
| | |
|
| |
|
|
|
|
| |
Replace hardcoded [0,1] split with send_split accepting &[Segment].
Segments exceeding payload length are warned and skipped. Add Segment
type to opt.rs with Display/Debug showing [start,end) notation.
|
| |
|
|
|
|
| |
Parse comma-separated split points into sorted segment ranges as
(start, end): pairs. Display shows original input with computed
ranges, e.g. "5,1,0,3 ([5,end), [1,3), [0,1), [3,5))".
|
| |
|
|
|
|
|
| |
SegmentOrder parses a comma-separated list of u32 split points, sorts
them, and precomputes segment ranges as (start, end) pairs for use in
send_split. The original input string is retained for Display. Parsing
logic is unimplemented and will follow in the next commit.
|
| | |
|