Commit Graph
19 Commits
Author SHA1 Message Date
basil00 29c6fda167 Improve & expand WinDivert test suite.
- Include tests for random*.
- Include latency timings in microseconds.
- More tests.
2018-11-19 07:21:54 +08:00
basil00 33a461eef6 Add packet/payload matching to WinDivert (#156).
Adds the follow terms to the filter language:
- packet[idx]: 8bit packet value at idx.
- packet16[idx]: 16bit packet value at idx.
- packet32[idx]: 32bit packet value at idx.
- PROTO.Payload[idx]: 8bit payload value at idx.
- PROTO.Payload16[idx]: 16bit payload value at
  idx.
- PROTO.Payload32[idx]: 32bit payload value at
  idx.
where PROTO is {tcp,udp}.

16 and 32bit values assume network byte ordering.

The index may be:
- An undecorated integer, in which case the
  packet or payload is treated as a 8/16/32bit
  value array, similar to C arrays.
- A 'b' decorated integer, (e.g, packet32[17b]),
  in which case the integer is interpreted as a
  byte offset.
- A negative (un)decorated integer, in which
  case indexing begins at the *end* of the
  packet or payload.  E.g., packet32[-1] is the
  last 32bits of the packet.

If the index is out-of-bounds, then the test
is deemed to be equivalent to "false".
2018-11-07 07:54:32 +08:00
basil00 4f7ff88664 Add batched recv/send to WinDivert (#156).
This change allows multiple packets to be
received/sent at once, reducing overheads.  To
exploit this feature, applications need to use
the WinDivertRecvEx()/WinDivertSendEx()
functions with the new addrLen parameter.  The
passthru example has been modified to use
batching.

The DEBUG flag has been retired since it
conflicts with batching, and was not very
useful anyway.
2018-11-03 08:40:34 +08:00
basil00 de4245f95e Event & REFLECT layer fixes.
- Make event bitwise-OR-able.
- Simplify event names.
- Fix REFLECT serialization.
  (setting AutomaticSerialization=TRUE does not
   work.)
- Preallocate REFLECT memory.
2018-10-29 05:40:03 +08:00
basil00 fd75e6d42a Add a new SOCKET layer to WinDivert (see #156).
Adds a new SOCKET layer for monitoring socket
events, such as BIND, LISTEN, CONNECT,
and ACCEPT.  These events occur before the
flow is established (and unlike the FLOW layer)
it is possible to block/drop SOCKET events.

Otherwise, this layer is very similar to the
FLOW layer, so the PID is available and injection
is not possible.  This commit should be
considered to be a WIP.

Other changes:
- New socketdump.exe sample.  Prints socket
  events.
- Improve IPv6 address parsing.
- New helper functions:
  * WinDivertHelperFormatIPv4Address
  * WinDivertHelperFormatIPv6Address
- Fix REFLECT bugs.
- The network 5-tuple can now be accessed at
  the NETWORK layer.
- Various cleanups.
2018-10-25 10:25:41 +08:00
basil00 2ab1ddf1d2 Make it possible to filter based on events.
E.g., "event == FLOW_ESTABLISHED".
2018-10-22 08:38:12 +08:00
basil00 f0dd1224b1 Add a new REFLECT layer to WinDivert (see #156).
Adds a new REFLECT layer for monitoring WinDivert
handles.  This includes:
- three new REFLECT events: ESTABLISHED, OPEN and
  CLOSE;
- modifying the ADDRESS for REFLECT data:
  open time, process-id, layer, flags, and
  priority of the opened handle; and
- allowing WinDivertRecv() to read a
  representation of the opened filter.

This change also includes a new "object"
representation for WinDivert filter strings.
The API has been updated as follows:
- WinDivertHelperCompileFilter (replaces
  CheckFilter) compiles filter strings into the
  object form; and
- WinDivertHelperFormatFilter can "decompile" an
  object back into a human-readable filter
  string.

Other:
- New NO_INSTALL flag.
- New windivertctl.exe sample program.
2018-10-21 10:12:19 +08:00
basil00 1543e958e6 Dual-license WinDivert under the LGPLv3 and GPLv2.
This allows projects that are strictly "GPLv2
only" to use WinDivert without licensing issues.
See the FSF's compatibility matrix here:
https://www.gnu.org/licenses/gpl-faq.en.html

This change does not affect existing projects
that can continue to use the LGPLv3 as before.

Also, bump the WinDivert version to 1.4.1.
2018-04-04 18:41:45 +08:00
basil00 21f1e1a71e Revert WinDivert back to inline packet processing.
This hardens WinDivert against other drivers that
attempt to modify packets after they were blocked
& absorbed by WinDivert, leading to BSODs.  This
is also a fix for issue #110.
2018-01-08 08:11:10 +08:00
basil00 347adf04ea Add a "false" test case.
In response to #107.
2017-11-15 08:38:03 +08:00
basil00 ba5e893f8f Update the test suite. 2017-11-14 20:41:18 +08:00
basil00 cd1bfff998 Bump copyright year. 2016-01-19 11:15:48 +08:00
basil00 f0be301f1d Expand tests & bug fixes.
Extend the number of tests to cover some of the new features.
Fix IPv6 address comparison which did not work correctly in some cases.
2015-07-25 23:16:48 +08:00
basil00 3bcf1ae7a0 Update samples & test programs to the new version. 2015-07-19 11:40:02 +08:00
basil00 130e25c05b Bump copyright year. 2015-07-17 19:13:55 +08:00
basil00 a3026de69c - Add IPv4 DNS request test cases. 2014-11-18 22:21:18 +08:00
basil00 bf19fdf2f9 - Add an ICMPv6 test packet.
- Fix missing byte-swaps for ICMPv6 fields.
- Todo: 1 test-case fails.
2014-11-17 19:25:17 +08:00
basil00 ecd9ae59d3 - Re-implement WinDivertHelperParseIPv6Address(). Previous version was just
too bug-prone, so re-try from scratch.  New version works for several tests.
- Fix broken WinDivertAToX().
- New test case: IPv6 TCP SYN.
2014-11-16 13:31:07 +08:00
basil00 5eaf312730 - Add new WinDivert testing framework. 2014-11-15 15:11:28 +08:00