[3869] in Athena Bugs

home help back first fref pref prev next nref lref last post

rpc library and net errors

daemon@ATHENA.MIT.EDU (John Carr)
Mon Jan 1 23:17:37 1990

To: bugs@ATHENA.MIT.EDU
Date: Mon, 01 Jan 90 23:17:21 EST
From: John Carr <jfc@ATHENA.MIT.EDU>

The rpc library does not handle some errors that it should.  Our kernel
passes ICMP *-unreachable errors to a UDP socket on the operation
following the write() which failed (actually, the first operation after
the ICMP message is received, but ICMP replies are fast).  Therefore, if
the rpc UDP code is changed to use write() instead of sendto(), these
errors will be reflected back to the higher level application.  Here is
the patch (for source/4.3/lib/libc/rpc/clnt_udp.c):

*** src/clnt_udp.c	Sun May 22 20:53:06 1988
--- clnt_udp.c	Mon Jan  1 23:08:39 1990
***************
*** 218,227 ****
  		return (cu->cu_error.re_status = RPC_CANTENCODEARGS);
  	outlen = (int)XDR_GETPOS(xdrs);
  	while (TRUE) {
  
! 		if (sendto(cu->cu_sock, cu->cu_outbuf, outlen, 0,
! 		    (struct sockaddr *)&(cu->cu_raddr), cu->cu_rlen)
! 		    != outlen) {
  			cu->cu_error.re_errno = errno;
  			return (cu->cu_error.re_status = RPC_CANTSEND);
  		}
--- 218,227 ----
  		return (cu->cu_error.re_status = RPC_CANTENCODEARGS);
  	outlen = (int)XDR_GETPOS(xdrs);
  	while (TRUE) {
+ 		connect(cu->cu_sock, (struct sockaddr *)&(cu->cu_raddr), cu->cu_rle);
+ 		/* Could add error check here */
  
! 		if (write(cu->cu_sock, cu->cu_outbuf, outlen) != outlen) {
  			cu->cu_error.re_errno = errno;
  			return (cu->cu_error.re_status = RPC_CANTSEND);
  		}



I tested this on some programs.  "Helen" is a machine that is up but not
serving NFS.

Without change:
	% time /urvd/etc/showmount -e helen
	showmount: RPC_PMAP_FAILURE
	0.0u 0.1s 1:04 0% 4+2k 5+1io 0pf+0w
	%

With change:
	% time /src/usr.etc/showmount -e helen
	showmount: RPC_PMAP_FAILURE
	0.0u 0.0s 0:00 116% 12+8k 0+2io 0pf+0w
	%

home help back first fref pref prev next nref lref last post