OpenVPN / tap-windows6

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

hlk6: Implement packet priority handling #81

Closed sgstair closed 5 years ago

sgstair commented 5 years ago

This change leads to some basic 802.1Q header parsing/removal on the receive path, and moving any found QoS/VLAN information into the proper NDIS structure for the OS to use. By default, 802.1Q headers are not added to outgoing packets (for compatibility purposes), but an IOCTL has been added to configure this behavior at runtime. See TAP_WIN_IOCTL_PRIORITY_BEHAVIOR - it accepts a DWORD input with the following options: TAP_PRIORITY_BEHAVIOR_NOPRIORITY = default behavior (no 802.1Q header applied to outbound packets) TAP_PRIORITY_BEHAVIOR_ENABLED = Add a 802.1Q header to outgoing packets when QoS/VLAN data exists TAP_PRIORITY_BEHAVIOR_ADDALWAYS = Always add the 802.1Q header to outgoing packets.

cron2 commented 5 years ago

After quite a bit of staring to the code and discussions on IRC, I think this is good. So, ACK.

The code does quite a bit of copying around ethernet headers "in place" to make room for the 802.1q header (for the priority field on the wire) or to remove it again afterwards, thus adding quite a bit of extra buffer offsetting. But all of it should be properly sized and size-checked.