From owner-freebsd-bugs@FreeBSD.ORG Wed Oct 24 14:20:02 2007 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C836E16A417 for ; Wed, 24 Oct 2007 14:20:02 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id B4DD013C4A8 for ; Wed, 24 Oct 2007 14:20:02 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.14.1/8.14.1) with ESMTP id l9OEK2qX050091 for ; Wed, 24 Oct 2007 14:20:02 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.1/8.14.1/Submit) id l9OEK2sx050090; Wed, 24 Oct 2007 14:20:02 GMT (envelope-from gnats) Resent-Date: Wed, 24 Oct 2007 14:20:02 GMT Resent-Message-Id: <200710241420.l9OEK2sx050090@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Spencer Minear Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6181516A417 for ; Wed, 24 Oct 2007 14:14:54 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21]) by mx1.freebsd.org (Postfix) with ESMTP id 5F1C513C4A8 for ; Wed, 24 Oct 2007 14:14:54 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (localhost [127.0.0.1]) by www.freebsd.org (8.14.1/8.14.1) with ESMTP id l9OEERrG000509 for ; Wed, 24 Oct 2007 14:14:27 GMT (envelope-from nobody@www.freebsd.org) Received: (from nobody@localhost) by www.freebsd.org (8.14.1/8.14.1/Submit) id l9OEERSE000508; Wed, 24 Oct 2007 14:14:27 GMT (envelope-from nobody) Message-Id: <200710241414.l9OEERSE000508@www.freebsd.org> Date: Wed, 24 Oct 2007 14:14:27 GMT From: Spencer Minear To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Cc: Subject: bin/117452: The fix for PR 103206 is incorrect X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Oct 2007 14:20:02 -0000 >Number: 117452 >Category: bin >Synopsis: The fix for PR 103206 is incorrect >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Wed Oct 24 14:20:02 UTC 2007 >Closed-Date: >Last-Modified: >Originator: Spencer Minear >Release: 6.2 >Organization: Secure Computing Corporation >Environment: FreeBSD freebe1.scur.com 6.2-RELEASE FreeBSD 6.2-RELEASE #0: Fri Jan 12 10:40:27 UTC 2007 root@dessler.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC i386 >Description: The change that was made for PR 103206 results in tftp returns an error code even if a send operation succeeds. The txrx_error = 1 that was added at the end of the processing needs to be placed at each point where and abort is detected. >How-To-Repeat: Use tftp to download a file and check the error status you will find that it sets the error status to 1 even when the file is successfully downloaded. Before the fix the following occurs: echo "get configs/10.69.222.75.cfg" | ./tftp 10.69.222.30 Received 963 bytes in 0.0 seconds alpha:Admn {14} % echo $? 1 After the fix I've proposed the same command has a 0 exit code. alpha:Admn {11} % echo "get configs/10.69.222.75.cfg" | tftp 10.69.222.30 Received 963 bytes in 0.0 seconds alpha:Admn {12} % echo $? 0 >Fix: % diff -c /usr/src/usr.bin/tftp/tftp.c . *** /usr/src/usr.bin/tftp/tftp.c Mon Oct 2 13:43:57 2006 --- ./tftp.c Wed Sep 19 10:58:23 2007 *************** *** 143,148 **** --- 143,149 ---- (struct sockaddr *)&peer, peer.ss_len); if (n != size + 4) { warn("sendto"); + txrx_error = 1; goto abort; } read_ahead(file, convert); *************** *** 156,161 **** --- 157,163 ---- alarm(0); if (n < 0) { warn("recvfrom"); + txrx_error = 1; goto abort; } if (!serv.ss_family) *************** *** 163,168 **** --- 165,171 ---- else if (!cmpport((struct sockaddr *)&serv, (struct sockaddr *)&from)) { warn("server port mismatch"); + txrx_error = 1; goto abort; } peer = from; *************** *** 205,211 **** stopclock(); if (amount > 0) printstats("Sent", amount); - txrx_error = 1; } /* --- 208,213 ---- *************** *** 261,266 **** --- 263,269 ---- peer.ss_len) != size) { alarm(0); warn("sendto"); + txrx_error = 1; goto abort; } write_behind(file, convert); *************** *** 274,279 **** --- 277,283 ---- alarm(0); if (n < 0) { warn("recvfrom"); + txrx_error = 1; goto abort; } if (!serv.ss_family) *************** *** 281,286 **** --- 285,291 ---- else if (!cmpport((struct sockaddr *)&serv, (struct sockaddr *)&from)) { warn("server port mismatch"); + txrx_error = 1; goto abort; } peer = from; *************** *** 331,337 **** stopclock(); if (amount > 0) printstats("Received", amount); - txrx_error = 1; } static int --- 336,341 ---- >Release-Note: >Audit-Trail: >Unformatted: