Skip to content

Commit b83e741

Browse files
committed
Add an ETHERNET layer to WinDivert.
Adds a new ETHERNET layer to WinDivert. This layer is similar to the NETWORK layers in that packets can be blocked/modified/injected. This change requires Windows 8 or newer.
1 parent 091ffb3 commit b83e741

17 files changed

+2363
-1074
lines changed

dll/windivert.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -479,6 +479,7 @@ HANDLE WinDivertOpen(const char *filter, WINDIVERT_LAYER layer, INT16 priority,
479479
// Parameter checking:
480480
switch (layer)
481481
{
482+
case WINDIVERT_LAYER_ETHERNET:
482483
case WINDIVERT_LAYER_NETWORK:
483484
case WINDIVERT_LAYER_NETWORK_FORWARD:
484485
case WINDIVERT_LAYER_FLOW:

dll/windivert.def

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,10 @@ EXPORTS
1313
WinDivertHelperDecrementTTL
1414
WinDivertHelperHashPacket
1515
WinDivertHelperParsePacket
16+
WinDivertHelperParseMACAddress
1617
WinDivertHelperParseIPv4Address
1718
WinDivertHelperParseIPv6Address
19+
WinDivertHelperFormatMACAddress
1820
WinDivertHelperFormatIPv4Address
1921
WinDivertHelperFormatIPv6Address
2022
WinDivertHelperCompileFilter
@@ -26,6 +28,8 @@ EXPORTS
2628
WinDivertHelperHtonl
2729
WinDivertHelperNtohll
2830
WinDivertHelperHtonll
31+
WinDivertHelperNtohMACAddress
32+
WinDivertHelperHtonMACAddress
2933
WinDivertHelperNtohIPv6Address
3034
WinDivertHelperHtonIPv6Address
3135
WinDivertHelperNtohIpv6Address

dll/windivert_hash.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,8 @@ static UINT64 WinDivertXXH64Avalanche(UINT64 h64)
105105
* WinDivert packet hash function.
106106
*/
107107
static UINT64 WinDivertHashPacket(UINT64 seed,
108-
const WINDIVERT_IPHDR *ip_header, const WINDIVERT_IPV6HDR *ipv6_header,
109-
const WINDIVERT_ICMPHDR *icmp_header,
108+
const WINDIVERT_ETHHDR *eth_header, const WINDIVERT_IPHDR *ip_header,
109+
const WINDIVERT_IPV6HDR *ipv6_header, const WINDIVERT_ICMPHDR *icmp_header,
110110
const WINDIVERT_ICMPV6HDR *icmpv6_header,
111111
const WINDIVERT_TCPHDR *tcp_header, const WINDIVERT_UDPHDR *udp_header)
112112
{

dll/windivert_helper.c

Lines changed: 386 additions & 164 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)