networking - How to detect and remove ethernet padding -


i writing network stack os. while receiving data ethernet, have detect , remove padding if data less 64 bytes , set data length, standard says.

what algorithm doing this?

if data contains 'a0' , less 64 bytes , padded. if checking bytewise, second bye 0, counted padded data, not.

the type/length field tell how large payload is. wireshark has pretty explanation:

therefore, if type/length field has value 1500 or lower, it's length field, , followed 802.2 header, otherwise it's type field , followed data upper layer protocol (xxx - slight duplicate of sentence above?). note when length/type field used length field length value specified not include length of padding bytes (e.g. if raw ethernet frame sent payload containing single byte of data length field set 0x0001 , 45 padding bytes appended data field bring ethernet frame required minimum 64-byte length).


Comments