Subject: Re: port-mac68k/32583: mac68k netbsd-2 panics during rcp(1)
To: None <port-mac68k-maintainer@netbsd.org, gnats-admin@netbsd.org,>
From: Dave Huang <khym@azeotrope.org>
List: netbsd-bugs
Date: 09/03/2006 12:10:10
The following reply was made to PR port-mac68k/32583; it has been noted by GNATS.

From: Dave Huang <khym@azeotrope.org>
To: Hauke Fath <hauke@Espresso.Rhein-Neckar.DE>
Cc: Scott Reynolds <scottr@clank.org>,
	port-mac68k-maintainer@netbsd.org, gnats-bugs@netbsd.org
Subject: Re: port-mac68k/32583: mac68k netbsd-2 panics during rcp(1)
Date: Sun, 3 Sep 2006 03:36:07 -0500

 > From: Hauke Fath <hauke@Espresso.Rhein-Neckar.DE>
 > To: gnats-bugs@netbsd.org
 > Cc: port-mac68k-maintainer@netbsd.org
 > Subject: Re: port-mac68k/32583: mac68k netbsd-2 panics during rcp(1)
 > Date: Sat, 28 Jan 2006 23:25:31 +0100
 > 
 >  At 8:20 Uhr +0000 26.1.2006, Scott Reynolds wrote:
 >  > The appended patch should do the trick. Please try it out and let me know
 >  > the result.
 >  
 >  [hauke@mirth] ~ > rcp pizza:/etc/amd.conf /tmp/
 >  rcp: rcmd: poll: protocol failure in circuit setup
 >  [hauke@mirth] ~ >
 >  
 >  -- close, but not quite... dito ftp:
 
 Ah, yeah, I see the bug Scott's talking about... if the original
 packet that needs to be padded has an odd length, it'll write one
 extra word of padding (I don't know if that actually causes any
 problems though; it seems like it'd be harmless :)
 
 However, Scott's patch has a minor bug where if the packet is exactly
 one byte too short, the function will write the correct data out to
 the ethernet chip, but will report that it wrote one byte less than it
 actually did (i.e., it'll write 60 bytes, but report that it wrote 59).
 
 What about this?
 
 Index: if_ae.c
 ===================================================================
 RCS file: /cvsroot/src/sys/arch/mac68k/dev/if_ae.c,v
 retrieving revision 1.77
 diff -u -r1.77 if_ae.c
 --- if_ae.c	11 Dec 2005 12:18:02 -0000	1.77
 +++ if_ae.c	3 Sep 2006 08:27:17 -0000
 @@ -165,15 +165,18 @@
  		}
  	}
  
 +	len = ETHER_MIN_LEN - ETHER_CRC_LEN - totlen;
  	if (wantbyte) {
  		savebyte[1] = 0;
  		bus_space_write_region_2(sc->sc_buft, sc->sc_bufh,
  		    buf, (u_int16_t *)savebyte, 1);
 -		    buf += 2;
 +		buf += 2;
 +		if (len-- > 0)
 +			totlen++;
  	}
 -	if (totlen < ETHER_MIN_LEN - ETHER_CRC_LEN) {
 +	if (len > 0) {
  		bus_space_set_region_2(sc->sc_buft, sc->sc_bufh, buf, 0,
 -		    (ETHER_MIN_LEN - ETHER_CRC_LEN - totlen) >> 1);
 +		    len >> 1);
  		totlen = ETHER_MIN_LEN - ETHER_CRC_LEN;
  	}
  	return (totlen);
 
 
 -- 
 Name: Dave Huang         |  Mammal, mammal / their names are called /
 INet: khym@azeotrope.org |  they raise a paw / the bat, the cat /
 FurryMUCK: Dahan         |  dolphin and dog / koala bear and hog -- TMBG
 Dahan: Hani G Y+C 30 Y++ L+++ W- C++ T++ A+ E+ S++ V++ F- Q+++ P+ B+ PA+ PL++