From owner-freebsd-current@FreeBSD.ORG Sat May 17 08:43:22 2003 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 9E62437B401 for ; Sat, 17 May 2003 08:43:22 -0700 (PDT) Received: from mail.imp.ch (mail.imp.ch [157.161.1.2]) by mx1.FreeBSD.org (Postfix) with ESMTP id 696B043F85 for ; Sat, 17 May 2003 08:43:21 -0700 (PDT) (envelope-from mb@imp.ch) Received: from cvs.imp.ch (cvs.imp.ch [157.161.4.9]) by mail.imp.ch (8.12.6p2/8.12.3) with ESMTP id h4HFhEkP068729; Sat, 17 May 2003 17:43:15 +0200 (CEST) (envelope-from Martin.Blapp@imp.ch) Date: Sat, 17 May 2003 17:43:14 +0200 (CEST) From: Martin Blapp To: Dan Nelson , "" Message-ID: <20030517172756.L1023@cvs.imp.ch> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII cc: rwatson@freesbd.org cc: fvdl@netbsd.org Subject: [PATCH] non blocking RPC-code, found reproducable error X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 17 May 2003 15:43:22 -0000 Hi all, Here is a patch to solve the problems with amd(8) and mountd(8) (and maybe other programs): The patch can also be found here. http://people.freebsd.org/~mbr/patches/xdr_nonblock_eof_fix.diff ------------------------------------------------------------------------------ Remove the special treatment of non-blocking mode in xdrrec_eof(). This broke seriously reading serialzed xdr records. The end of a request could sometimes not be regognized. Initialize in_reclen and in_received in a second case. Return always FALSE in set_input_fragment() for non-blocking mode. --- lib/libc/xdr/xdr_rec.c.orig Thu Feb 27 13:40:01 2003 +++ lib/libc/xdr/xdr_rec.c Sat May 17 17:20:24 2003 @@ -491,14 +491,6 @@ RECSTREAM *rstrm = (RECSTREAM *)(xdrs->x_private); enum xprt_stat xstat; - if (rstrm->nonblock) { - if (__xdrrec_getrec(xdrs, &xstat, FALSE)) - return FALSE; - if (!rstrm->in_haveheader && xstat == XPRT_IDLE) - return TRUE; - return FALSE; - } - while (rstrm->fbtbc > 0 || (! rstrm->last_frag)) { if (! skip_input_bytes(rstrm, rstrm->fbtbc)) return (TRUE); @@ -617,6 +609,7 @@ } *statp = XPRT_MOREREQS; + rstrm->in_reclen = rstrm->in_received = 0; return FALSE; } @@ -719,6 +712,8 @@ { u_int32_t header; + if (rstrm->nonblock) + return FALSE; if (! get_input_bytes(rstrm, (char *)(void *)&header, sizeof(header))) return (FALSE); header = ntohl(header); ------------------------------------------------------------------------------ Martin Martin Blapp, ------------------------------------------------------------------ ImproWare AG, UNIXSP & ISP, Zurlindenstrasse 29, 4133 Pratteln, CH Phone: +41 61 826 93 00 Fax: +41 61 826 93 01 PGP: PGP Fingerprint: B434 53FC C87C FE7B 0A18 B84C 8686 EF22 D300 551E ------------------------------------------------------------------