OpenVPN / tap-windows6

Windows TAP driver (NDIS 6)
Other
785 stars 237 forks source link

hlk3: Pad received packets to minimum ethernet length #78

Closed sgstair closed 5 years ago

sgstair commented 5 years ago

HLK tests require that packets are padded to the minimum ethernet length. While that isn't strictly necessary for something like tap-windows6, it has been implemented here to make the test happy. The change adds padding to the packet to be returned to the OS if necessary to meet this requirement, combining this padding with prefixing if possible (on the TUN path)

cron2 commented 5 years ago

Quite a bit of refactoring, to move two fairly similar code branches into one common TapSharedSendPacket(), cleaning up the nested levels of "if (thing != NULL) { ... if (nextthing != NULL)..." while at it.

And, adding padding on the path "minimum sized packet comes in from OpenVPN or locally generated (IndicateReceivePacket()) and needs to be sent to NDIS as a properly-minimum-sized Ethernet frame", but that part is fairly harmless after the rest got cleaned up :-)

ACK.