From nobody@FreeBSD.org  Fri Mar  2 17:11:17 2001
Return-Path: <nobody@FreeBSD.org>
Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21])
	by hub.freebsd.org (Postfix) with ESMTP id 31D9A37B718
	for <freebsd-gnats-submit@FreeBSD.org>; Fri,  2 Mar 2001 17:11:17 -0800 (PST)
	(envelope-from nobody@FreeBSD.org)
Received: (from nobody@localhost)
	by freefall.freebsd.org (8.11.1/8.11.1) id f231BH452359;
	Fri, 2 Mar 2001 17:11:17 -0800 (PST)
	(envelope-from nobody)
Message-Id: <200103030111.f231BH452359@freefall.freebsd.org>
Date: Fri, 2 Mar 2001 17:11:17 -0800 (PST)
From: jbrowne@jbrowne.com
To: freebsd-gnats-submit@FreeBSD.org
Subject: TFTP in libstand(3) fails on all transactions after first failure
X-Send-Pr-Version: www-1.0

>Number:         25502
>Category:       misc
>Synopsis:       TFTP in libstand(3) fails on all transactions after first failure
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    mikeh
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Mar 02 17:20:01 PST 2001
>Closed-Date:    Sat Jul 14 07:00:09 PDT 2001
>Last-Modified:  Sat Jul 14 07:00:36 PDT 2001
>Originator:     Jim Browne
>Release:        4.2 RELEASE
>Organization:
>Environment:
FreeBSD XX.XX.com 4.2-STABLE FreeBSD 4.2-STABLE #0: Wed Jan 17 19:10:29 PST 2001     root@XX.XX.com:/usr/src/sys/compile/GENERIC  i386

>Description:
When using the TFTP functionality in libstand(3), I noticed that all
TFTP transactions would fail after the first failure.  For example,
if you try to TFTP a file that does not exist, all subsequent TFTP
requests will fail with the same error.  A patch to fix is included
below.
>How-To-Repeat:

>Fix:
The problem is the fact that recvtftp() in tftp.c does not clear
errno.  All of the other clients of sendrecv() do so (e.g. ARP,
RPC, BOOTP, etc.).  It's not pretty, but it is how the other
protocols do it.

Here's a patch against 4.2 RELEASE:
 
bash-2.04$ grep \$FreeBSD /usr/src/lib/libstand/tftp.c
 * $FreeBSD: src/lib/libstand/tftp.c,v 1.2.6.2 2000/05/04 13:47:52 ps Exp $
bash-2.04$ diff -c2p /usr/src/lib/libstand/tftp.c /tmp/tftp.c
*** /usr/src/lib/libstand/tftp.c        Thu May  4 06:47:52 2000
--- /tmp/tftp.c Fri Mar  2 17:02:47 2001
*************** recvtftp(d, pkt, len, tleft)
*** 118,121 ****
--- 118,123 ----
        struct tftphdr *t;
  
+       errno = 0;
+ 
        len = readudp(d, pkt, len, tleft);

>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: mikeh 
State-Changed-When: Fri Jun 29 16:24:58 PDT 2001 
State-Changed-Why:  


http://www.FreeBSD.org/cgi/query-pr.cgi?pr=25502 
State-Changed-From-To: closed->open 
State-Changed-By: mikeh 
State-Changed-When: Fri Jun 29 16:25:32 PDT 2001 
State-Changed-Why:  
Meant to take ownership, not close. 


Responsible-Changed-From-To: freebsd-bugs->mikeh 
Responsible-Changed-By: mikeh 
Responsible-Changed-When: Fri Jun 29 16:25:32 PDT 2001 
Responsible-Changed-Why:  
Looks reasonable, I'll look it over more later. 

http://www.FreeBSD.org/cgi/query-pr.cgi?pr=25502 
State-Changed-From-To: open->analyzed 
State-Changed-By: mikeh 
State-Changed-When: Sat Jun 30 20:48:11 PDT 2001 
State-Changed-Why:  
Committed, thanks! (MFC in 2 weeks) 

http://www.FreeBSD.org/cgi/query-pr.cgi?pr=25502 
State-Changed-From-To: analyzed->closed 
State-Changed-By: mikeh 
State-Changed-When: Sat Jul 14 07:00:09 PDT 2001 
State-Changed-Why:  
Fix MFC'd. 

http://www.FreeBSD.org/cgi/query-pr.cgi?pr=25502 
>Unformatted:
