Skip to content

Commit 048a76d

Browse files
committed
Upgrade to WinDivert 1.4.0-rc.
1 parent 68171e3 commit 048a76d

File tree

7 files changed

+24
-22
lines changed

7 files changed

+24
-22
lines changed

VERSION

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.3.1
1+
1.3.2

build.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/sh
22
# build.sh
3-
# (C) 2017, all rights reserved,
3+
# (C) 2018, all rights reserved,
44
#
55
# This program is free software: you can redistribute it and/or modify
66
# it under the terms of the GNU General Public License as published by
@@ -43,7 +43,7 @@ make client_install32
4343
make server_install
4444

4545
# Build Windows 64/32-bit
46-
DIVERT_VERSION=WinDivert-1.3.0-MINGW
46+
DIVERT_VERSION=WinDivert-1.4.0-rc-A-MINGW
4747
set +x
4848
if [ "$DIVERT" = "" ]
4949
then

configure-freebsd.ac

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# configure.ac
2-
# (C) 2017, all rights reserved,
2+
# (C) 2018, all rights reserved,
33
#
44
# This program is free software: you can redistribute it and/or modify
55
# it under the terms of the GNU General Public License as published by
@@ -45,7 +45,7 @@ case `uname -m` in
4545
;;
4646
*)
4747
AC_SUBST(BITS, 64)
48-
AC_SUBST(ARCH, amd64)
48+
AC_SUBST(ARCH, x86_64)
4949
;;
5050
esac
5151

configure-windows.ac

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# configure-windows-cross.ac
2-
# (C) 2017, all rights reserved,
2+
# (C) 2018, all rights reserved,
33
#
44
# This program is free software: you can redistribute it and/or modify
55
# it under the terms of the GNU General Public License as published by
@@ -65,8 +65,8 @@ AC_MSG_CHECKING([for $DIVERT_NAME files])
6565

6666
if test -e $DIVERT/x86/${DIVERT_NAME}32.sys -a \
6767
-e $DIVERT/x86/$DIVERT_NAME.dll -a \
68-
-e $DIVERT/amd64/${DIVERT_NAME}64.sys -a \
69-
-e $DIVERT/amd64/$DIVERT_NAME.dll -a \
68+
-e $DIVERT/x86_64/${DIVERT_NAME}64.sys -a \
69+
-e $DIVERT/x86_64/$DIVERT_NAME.dll -a \
7070
-e $DIVERT/include/$DIVERT_WORD.h
7171
then
7272
AC_MSG_RESULT([yes])
@@ -85,11 +85,11 @@ fi
8585
case "$host" in
8686
amd64-*)
8787
AC_SUBST(BITS, 64)
88-
AC_SUBST(ARCH, amd64)
88+
AC_SUBST(ARCH, x86_64)
8989
;;
9090
x86_64-*)
9191
AC_SUBST(BITS, 64)
92-
AC_SUBST(ARCH, amd64)
92+
AC_SUBST(ARCH, x86_64)
9393
;;
9494
*)
9595
AC_SUBST(BITS, 32)

configure.ac

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# configure.ac
2-
# (C) 2017, all rights reserved,
2+
# (C) 2018, all rights reserved,
33
#
44
# This program is free software: you can redistribute it and/or modify
55
# it under the terms of the GNU General Public License as published by
@@ -58,7 +58,7 @@ case `uname -m` in
5858
;;
5959
*)
6060
AC_SUBST(BITS, 64)
61-
AC_SUBST(ARCH, amd64)
61+
AC_SUBST(ARCH, x86_64)
6262
;;
6363
esac
6464

src/Makefile.windows

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Makefile.windows
2-
# (C) 2017, all rights reserved,
2+
# (C) 2018, all rights reserved,
33
#
44
# This program is free software: you can redistribute it and/or modify
55
# it under the terms of the GNU General Public License as published by
@@ -77,7 +77,7 @@ tools/file2c.exe: tools/file2c.c
7777
install: client
7878
cp "$(DIVERT_ROOT)/x86/WinDivert32.sys" \
7979
"$(ROOT)/src/$(PLATFORM)/install/WinDivert32.sys"
80-
cp "$(DIVERT_ROOT)/amd64/WinDivert64.sys" \
80+
cp "$(DIVERT_ROOT)/x86_64/WinDivert64.sys" \
8181
"$(ROOT)/src/$(PLATFORM)/install/WinDivert64.sys"
8282
cp "$(DIVERT_ROOT)/$(ARCH)/WinDivert.dll" \
8383
"$(ROOT)/src/$(PLATFORM)/install/WinDivert.dll"

src/windows/capture.c

+10-8
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* capture.c
3-
* (C) 2017, all rights reserved,
3+
* (C) 2018, all rights reserved,
44
*
55
* This program is free software: you can redistribute it and/or modify
66
* it under the terms of the GNU General Public License as published by
@@ -52,11 +52,11 @@ void init_capture(void)
5252
{
5353
handle = WinDivertOpen(
5454
"ip and "
55-
"(outbound and (tcp.DstPort == 80 or"
56-
" tcp.DstPort == 443 or "
57-
" udp.DstPort == 53) or"
58-
" inbound and icmp.Type == 11 and icmp.Code == 0) and "
59-
"ip.DstAddr != 127.0.0.1",
55+
"!loopback and "
56+
"(outbound? tcp.DstPort == 80 or"
57+
" tcp.DstPort == 443 or"
58+
" udp.DstPort == 53 :"
59+
" icmp.Type == 11 and icmp.Code == 0)",
6060
WINDIVERT_LAYER_NETWORK, -501, 0);
6161
if (handle == INVALID_HANDLE_VALUE)
6262
{
@@ -94,8 +94,8 @@ size_t get_packet(uint8_t *buff, size_t len)
9494
peth_header->pad2 = 0x0;
9595
peth_header->proto = htons(ETH_P_IP);
9696

97-
WinDivertHelperCalcChecksums((PVOID)(buff+offset), (UINT)(len-offset),
98-
WINDIVERT_HELPER_NO_REPLACE);
97+
WinDivertHelperCalcChecksums((PVOID)(buff+offset), (UINT)read_len,
98+
NULL, 0);
9999

100100
return (size_t)(read_len+offset);
101101
}
@@ -112,9 +112,11 @@ void inject_packet(uint8_t *buff, size_t len)
112112
}
113113
struct pethhdr_s *peth_header = (struct pethhdr_s *)buff;
114114
WINDIVERT_ADDRESS addr;
115+
memset(&addr, 0, sizeof(addr));
115116
addr.Direction = peth_header->direction;
116117
addr.IfIdx = peth_header->if_idx;
117118
addr.SubIfIdx = peth_header->sub_if_idx;
119+
addr.Impostor = 1;
118120

119121
len -= offset;
120122
buff += offset;

0 commit comments

Comments
 (0)