[comp.bugs.4bsd] Making UUCP TCP/IP work on Sequent Symmetry and other i386's

bruce@ogicse.ogc.edu (Bruce Jerrick) (02/10/90)

Index:	usr.bin/uucp/tio.c 4.3BSD TAHOE FIX

Description:
	On a Sequent Symmetry (and probably other i386-based machines),
	the local uucico, when using TCP/IP, fails with:

	    rmesg ... FAIL (BAD READ)

	(incidentally with a bogus errno 25).

	The problem is that ntohl and htonl (network/host byte order
	conversion) isn't being done in twrdata() and trddata().

Repeat-By:
	Run Tahoe uucico using TCP/IP on a Sequent Symmetry, with moderate
	Debug'ing (e.g., -x4 or -x7) turned on.  Observe the failure
	message mentioned above.

Fix:
	In tio.c, where there are ntohl and htonl, add
	" || defined(i386)" to the cpp #if statements enabling them:


*** /tmp/,RCSt1019477	Fri Feb  9 22:06:04 1990
--- tio.c	Fri Feb  9 22:06:05 1990
***************
*** 111,121 ****
  #endif !USG
  	while ((len = read(fileno(fp1), bufr.t_data, TBUFSIZE)) > 0) {
  		bytes += len;
! #if defined(vax) || defined(pdp11) || defined(ns32000)
  		bufr.t_nbytes = htonl((long)len);
! #else !vax and !pdp11 and !ns32000
  		bufr.t_nbytes = len;
! #endif !vax and !pdp11 and !ns32000
  		DEBUG(8,"twrdata sending %d bytes\n",len);
  		len += sizeof(long);
  		alarm(MAXMSGTIME*5);
--- 114,124 ----
  #endif !USG
  	while ((len = read(fileno(fp1), bufr.t_data, TBUFSIZE)) > 0) {
  		bytes += len;
! #if defined(vax) || defined(pdp11) || defined(ns32000) || defined(i386)
  		bufr.t_nbytes = htonl((long)len);
! #else !vax and !pdp11 and !ns32000 and !i386
  		bufr.t_nbytes = len;
! #endif !vax and !pdp11 and !ns32000 and !i386
  		DEBUG(8,"twrdata sending %d bytes\n",len);
  		len += sizeof(long);
  		alarm(MAXMSGTIME*5);
***************
*** 182,190 ****
  		alarm(0);
  		if (len != sizeof Nbytes)
  			return FAIL;
! #if defined(vax) || defined(pdp11) || defined(ns32000)
  		Nbytes = ntohl(Nbytes);
! #endif vax or pdp11 or ns32000
  		DEBUG(8,"trddata expecting %ld bytes\n",Nbytes);
  		nread = Nbytes;
  		if (nread == 0)
--- 185,193 ----
  		alarm(0);
  		if (len != sizeof Nbytes)
  			return FAIL;
! #if defined(vax) || defined(pdp11) || defined(ns32000) || defined(i386)
  		Nbytes = ntohl(Nbytes);
! #endif vax or pdp11 or ns32000 or i386
  		DEBUG(8,"trddata expecting %ld bytes\n",Nbytes);
  		nread = Nbytes;
  		if (nread == 0)

========================================================================

        Bruce Jerrick
        Oregon Graduate Center, er, uh, Institute
        InterNet:  bruce@cse.ogi.edu
        UUCP:      ogicse!bruce
        Voice:     (503) 690-1157