[comp.protocols.tcp-ip] packet lengths

cyrus@hi.unm.edu (Tait Cyrus) (04/16/88)

I have been comparing the lengths of packets specified in IP headers
against actual packet lengths.  What I am seeing, ignoring IP packets
smaller than the minimum packet size, is that a fair number of machines
send out packets that are 1-3 bytes longer than is specified by the
IP length.  Although this does not hurt anything, I am wondering
why this is.  Is it because some machines short/long/quad align the
end of the packet before sending?

Also, this phenomenon appears to be protocol dependent.  For example,
I saw several 4.3 machines doing this when sending out timed packets
and routed packet, but not with other packets.  I've seen our IP/TCP
Imagen sending out UDP packets doing this.

Although this does not hurt anything, I am just curious as to the reason
why.


-- 
    @__________@    W. Tait Cyrus   (505) 277-0806
   /|         /|    University of New Mexico
  / |        / |    Dept of Electrical & Computer Engineering 
 @__|_______@  |       Parallel Processing Research Group (PPRG)
 |  |       |  |       UNM/LANL Hypercube Project
 |  |  hc   |  |    Albuquerque, New Mexico 87131
 |  @.......|..@    
 | /        | /     e-mail:      
 @/_________@/        cyrus@hc.dspo.gov

randy@LARRY.CS.WASHINGTON.EDU (Randy) (04/20/88)

What do you mean by "actual packet lengths"? If you mean the length field
specified by the ethernet header, then be aware that the smallest legal
ethernet packet is 64 bytes (counting header and checksum). If the
IP part of the ethernet packet is smaller than 48 bytes (64- header), then
the packet will be padded with garbage.

Randy Day.
Internet (ARPA): randy@cs.washington.edu
CSNET: randy%washington@relay.cs.net
UUCP: {decvax|ihnp4}!uw-beaver!uw-june!randy

geof@imagen.UUCP (Geof Cooper) (04/20/88)

 > I have been comparing the lengths of packets specified in IP headers
 > against actual packet lengths.  What I am seeing, ignoring IP packets
 > smaller than the minimum packet size, is that a fair number of machines
 > send out packets that are 1-3 bytes longer than is specified by the
 > IP length.

The Ethernet requires that packets be an integral number of 16-bit words
long.  The Ethernet also has a minimum packet size of 60 bytes.  Any IP
packet that is less than 60 bytes in length (including ethernet header)
will be padded to 60 bytes.  The IEEE 802.3 length field would allow
you to explicitly set the ethernet length, but Ethernet doesn't.

- Geof Cooper

ted@blia.BLI.COM (Ted Marshall) (04/22/88)

In article <8804191854.AA00089@apolling.imagen.uucp>, geof@imagen.UUCP (Geof Cooper) writes:
> The Ethernet requires that packets be an integral number of 16-bit words
> long.

Sorry, no. An integral number of 8-bit octets, not 16-bit words. Quoting from
page 19 of the version 1.0 Ethernet specification:

	Figure 6-1 shows the five fields of a frame: the addresses of the
	frame's source and destination, a type field [...], a data field
	[...], and the frame check sequence [...]. Of these five fields,
	all are of fixed size except the data field which my contain any
	integral number of octets between the minimum and maximum values
	^^^^^^^^^^^^^^^^^^^^^^^^^ [ ^'s are mine. TM]
	specified below (see 6.2.5).

Figure 6-1 shows the layout of a frame and also of an octet (showing 8 bits,
transmitted LSB first).

I don't have a copy of the 2.0 spec, but I don't think they changed this. If
they did, DEC is breaking the spec; I know that the VAX/VMS Ethernet cards and
drivers allow odd-byte-count length packets to be sent.

That is not to say that every Ethernet interface manufacturer built their
unit so that it can transmit an odd number of bytes. In fact, I believe that
there are some that can only transmit multiples of 4 bytes.

In general, no Ethernet protocol should be used that depends on the data
link layer to report exactly the number of bytes in the packet since
short packets must be padded to the minimum size.

-- 
Ted Marshall       ...!ucbvax!mtxinu!blia!ted <or> mtxinu!blia!ted@Berkeley.EDU
Britton Lee, Inc., 14600 Winchester Blvd, Los Gatos, Ca 95030     (408)378-7000
The opinions expressed above are those of the poster and not his employer.

geof@imagen.UUCP (Geof Cooper) (04/23/88)

 > Your statement that the Ethernet (IEEE 802.3 as well?) requires packets to
 > be in integral number of 16-bit words long is incorrect.

On reference to the original Ethernet 1 spec, I stand corrected.  The packet
length is an integral number of octets.  I must have been thinking of the
3MB experimental ethernet, as you say.

- Geof

brad@interlan.UUCP (Brad Kemp) (04/23/88)

In article <8804191854.AA00089@apolling.imagen.uucp> geof@imagen.UUCP (Geof Cooper) writes:
>
> > I have been comparing the lengths of packets specified in IP headers
> > against actual packet lengths.  What I am seeing, ignoring IP packets
> > smaller than the minimum packet size, is that a fair number of machines
> > send out packets that are 1-3 bytes longer than is specified by the
> > IP length.
>
>The Ethernet requires that packets be an integral number of 16-bit words
>long.  The Ethernet also has a minimum packet size of 60 bytes.  Any IP
>packet that is less than 60 bytes in length (including ethernet header)
>will be padded to 60 bytes.  The IEEE 802.3 length field would allow
>you to explicitly set the ethernet length, but Ethernet doesn't.

The Ethernet 2.0 spec states:

	...Of these five fields, all are fixed size except the
	data field, which may contain any integral number of octets
	between the minimum and maximum values specified below (see 6.2.5)

		Ethernet 2.0 pg 25

This means that odd length packets are legal.  IEEE 820.3 also specifies 
an intregral number of octets. (pg 26  3.2.7) Most impelemntations of
protocols pad to an even byte length to keep their more braindamaged 
bretheren from puking. IP only cares about the octets specified in its
length field, the pad octets are ignored

	Brad Kemp
	MICOM-Interlan
	{ulowell,mit-eddie}!interlan!brad