Reputation: 1
I Have an issue with WinDivert. DivertSend does not work, GetLastError() return 1237 ?
I have a another question. I want to divert traffic based on an IP list, I have a CSV file with more than 20000 records, each record contain an IP range, the problem is I can just call DivertOpen with only 500 record of my CSV file as a filter string. if I call DivertOpen with more than 500 record as filter I got "filter syntax error". How can i fix this issue. Thanks
Upvotes: 0
Views: 1259
Reputation: 1021
WinDivert is not designed to handle long/complicated filter strings (such as a list of 20,000 IP addresses). This is briefly mentioned in the WinDivert documentation: namely, the filter string should ideally be both selective and short, and the more shorter/selective the better.
For your kind of application, where a short string is not possible, you are better off capturing all network traffic (e.g. with a call to DivertOpen("true", ...)
) and doing the filtering in the user-mode application using some efficient method (such as binary search). Simply re-inject the packets that do not match.
PS: Thanks for the report of the 1237 error issue.
Upvotes: 1