[comp.sys.ibm.pc.rt] bug in ethernet driver for IBM 6152

webb@ibmpa.awdpa.ibm.com (Bill Webb) (05/03/91)

I happened to fix this bug locally, and although we are no longer 
supporting this system I thought it would be a good idea to post
the change here. I (and IBM) take no responsibility for the correctness
or applicability of this fix etc., etc.

The problem that showed up this problem was that you couldn't store
a file into an AFS 3.1 server running on a Risc System 6000 if the
IBM 6152 machine was on the ethernet. Further investigation showed
a simple test case:

	ping system_6000 2000

If you dodn't get any response to the ping, and a shorter ping works,
then you have the problem.

The cause was that the driver was incorectly calculating the length
of the packet to transmit, so the packet was 14 bytes (the ethernet
header size) longer than it should have been. Most machines appear
to handle the extra bytes without complaint. The following patch changes
the length so be the data length, which fixes the ETHERMIN length 
calcuation which would otherwise be done incorrectly.

Here is a context diff suitable for feeding into "patch" that should
fix the problem (I've deleted some additional minor changes so don't
worry if the line numbers don't exactly match up).

*** if_un.c	Thu May  2 16:27:58 1991
--- if_un.c.fix	Thu May  2 16:25:12 1991
***************
*** 842,848 ****
   */
  unxmit(bufnum, len, iv)
  u_int bufnum;
! u_int len;	/* Length of entire packet, including header */
  u_int iv;	/* which board */
  {
  	register struct tcb *tcbp;
--- 850,856 ----
   */
  unxmit(bufnum, len, iv)
  u_int bufnum;
! u_int len;	/* Length of packet, excluding header */
  u_int iv;	/* which board */
  {
  	register struct tcb *tcbp;
***************
*** 1157,1162 ****
--- 1165,1171 ----
  				htons(length - sizeof(struct eth_mac_header));
  		}
  #endif IFF_IEEE
+ 		length -= sizeof (struct ether_header);	/* don't include header length */
  		length = MAX(length, ETHERMIN);
  		m_freem(m);
  

----------------------------------------------------------------
The above views are my own, not those of my employer.
Bill Webb (IBM PSP Palo Alto, Ca.), (415) 855-4457.
UUCP: ...!uunet!ibmsupt!webb INTERNET: webb@ibminet.awdpa.ibm.com