Ethereal-dev: Re: [Ethereal-dev] Length/Type field in MAC frames

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: Guy Harris <guy@xxxxxxxxxxxx>
Date: Sun, 30 Jul 2006 12:18:24 -0700
-------------------
The Ethereal project is being continued at a new site.  Please go to
http://www.wireshark.org and subscribe to wireshark-dev@xxxxxxxxxxxxx.
Don't forget to unsubscribe from this list at
http://www.ethereal.com/mailman/listinfo/ethereal-dev
-------------------

Eduardo Escudero Sánchez wrote:
Hi i have a problem with MAC frames.
Suppose you have to build a MAC frame which has to transmit a bunch of data with a length value less than 46 octets. The MAC layer has to put a pad in order the frame can reach the minimum length value of 46.

Presumably you mean "in order that the frame can reach the minimum length of 64 octets"; 46 octets is the minimum amount of payload (including any 802.2 header) in a 64-octet frame, after you subtract out the 14-octet MAC-layer header and 4-octet CRC.

But in that case...¿Which value will you put in the length / type field of the frame (suppose that the meaning of the field is the length one)??: 46 or the real value of the data?

The real value of the data. The purpose of the length field in the header is to let the service running atop the MAC service be provided the real amount of data, with the padding removed.

Furthermore, I would not even add the padding myself, if I'm handing it to libpcap/WinPcap to be transmitted. The adapter driver, or common 802.3 code used by the adapter driver, should handle that. I would, for example, call pcap_sendpacket() or pcap_inject() with a size value that includes the padding; the adapter driver might, for better or worse, "fix" the outgoing MAC header to use the size value as the length field.
_______________________________________________
Ethereal-dev mailing list
Ethereal-dev@xxxxxxxxxxxx
http://www.ethereal.com/mailman/listinfo/ethereal-dev