jagt / clumsy

clumsy makes your network condition on Windows significantly worse, but in a controlled and interactive manner.
http://jagt.github.io/clumsy/
Other
4.96k stars 488 forks source link

Adding the support for WINDIVERT_LAYER_NETWORK_FORWARD #152

Open cyberclau opened 7 months ago

cyberclau commented 7 months ago

Hi,

In the officiel/actual version, only the WINDIVERT_LAYER_NETWORK is supported/used. That restricts the utilization of Clumsy when only forwarding the packet (layer: WINDIVERT_LAYER_NETWORK_FORWARD) on the machine (ex: Internet Connection Sharing in Windows).

My need was to use a Windows PC to simulate a WAN link to a physical firewall. The Windows PC was sharing an Internet connexion with the use of Windows ICS functionality.

The only modification I needed in Clumsy to make it work was: int divertStart(const char *filter, char buf[]) { int ix; //divertHandle = WinDivertOpen(filter, WINDIVERT_LAYER_NETWORK, DIVERT_PRIORITY, 0); divertHandle = WinDivertOpen(filter, WINDIVERT_LAYER_NETWORK_FORWARD, DIVERT_PRIORITY, 0);

I think a "nice" combo BOX can be added to the Clumsy GUI for choosing between both layer. What do you think?

Regards,

Claude-Olivier

cyberclau commented 7 months ago

I forgot to mention two points: 1) The code modification is only mandatory in \clumsy-master\src\divert.c line 83. 2) I used the filter “true” when testing. I did the same as what is shown when running “\clumsy-master\external\WinDivert-2.2.0-C\x64\flowtrack.exe”

Regards,

Claude-Olivier

jagt commented 7 months ago

Hi! You're welcome to file for a pull request. See build instructions here: https://jagt.github.io/clumsy/download.html