Skip to content

Commit b452e1c

Browse files
committed
- Fix failing test case caused by bad word ordering.
1 parent bf19fdf commit b452e1c

File tree

2 files changed

+18
-8
lines changed

2 files changed

+18
-8
lines changed

dll/windivert.c

+10
Original file line numberDiff line numberDiff line change
@@ -1014,6 +1014,16 @@ static BOOL WinDivertTokenizeFilter(const char *filter, WINDIVERT_LAYER layer,
10141014
SetLastError(0);
10151015
if (WinDivertHelperParseIPv6Address(token, tokens[tp].val))
10161016
{
1017+
// Work-around the different word orderings between the
1018+
// DLL vs SYS.
1019+
UINT32 tmp;
1020+
tmp = tokens[tp].val[0];
1021+
tokens[tp].val[0] = tokens[tp].val[3];
1022+
tokens[tp].val[3] = tmp;
1023+
tmp = tokens[tp].val[1];
1024+
tokens[tp].val[1] = tokens[tp].val[2];
1025+
tokens[tp].val[2] = tmp;
1026+
10171027
tokens[tp].kind = FILTER_TOKEN_NUMBER;
10181028
tp++;
10191029
continue;

sys/windivert.c

+8-8
Original file line numberDiff line numberDiff line change
@@ -3048,23 +3048,23 @@ static BOOL windivert_filter(PNET_BUFFER buffer, UINT32 if_idx,
30483048
field[0] = (UINT32)ipv6_header->HopLimit;
30493049
break;
30503050
case WINDIVERT_FILTER_FIELD_IPV6_SRCADDR:
3051-
field[0] =
3051+
field[3] =
30523052
(UINT32)RtlUlongByteSwap(ipv6_header->SrcAddr[0]);
3053-
field[1] =
3054-
(UINT32)RtlUlongByteSwap(ipv6_header->SrcAddr[1]);
30553053
field[2] =
3054+
(UINT32)RtlUlongByteSwap(ipv6_header->SrcAddr[1]);
3055+
field[1] =
30563056
(UINT32)RtlUlongByteSwap(ipv6_header->SrcAddr[2]);
3057-
field[3] =
3057+
field[0] =
30583058
(UINT32)RtlUlongByteSwap(ipv6_header->SrcAddr[3]);
30593059
break;
30603060
case WINDIVERT_FILTER_FIELD_IPV6_DSTADDR:
3061-
field[0] =
3061+
field[3] =
30623062
(UINT32)RtlUlongByteSwap(ipv6_header->DstAddr[0]);
3063-
field[1] =
3064-
(UINT32)RtlUlongByteSwap(ipv6_header->DstAddr[1]);
30653063
field[2] =
3064+
(UINT32)RtlUlongByteSwap(ipv6_header->DstAddr[1]);
3065+
field[1] =
30663066
(UINT32)RtlUlongByteSwap(ipv6_header->DstAddr[2]);
3067-
field[3] =
3067+
field[0] =
30683068
(UINT32)RtlUlongByteSwap(ipv6_header->DstAddr[3]);
30693069
break;
30703070
case WINDIVERT_FILTER_FIELD_ICMP_TYPE:

0 commit comments

Comments
 (0)