kbandla / dpkt

fast, simple packet creation / parsing, with definitions for the basic TCP/IP protocols
Other
1.08k stars 270 forks source link

Fix/GRE packing byteorder #538

Closed crocogorical closed 3 years ago

crocogorical commented 3 years ago

GRE class previously unpacked its optional headers with network byte order, but then repacked them with an unspecified order (Line 117). In this case, struct uses the native byte order.

This would result in a byte order swapping for anyone on a little-endian machine who unpacks and repacks a GRE class with optional headers.

Corrected previous test which assumed implementation was correct, and extended testing too.

crocogorical commented 3 years ago

@brifordwylie was this left off of the previous merges deliberately? Anything I need to update?