From owner-svn-src-stable@FreeBSD.ORG Fri Nov 4 15:57:39 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2EACC106566C; Fri, 4 Nov 2011 15:57:39 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 04CBA8FC0A; Fri, 4 Nov 2011 15:57:39 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pA4FvcVK024685; Fri, 4 Nov 2011 15:57:38 GMT (envelope-from sbruno@svn.freebsd.org) Received: (from sbruno@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pA4Fvc5o024683; Fri, 4 Nov 2011 15:57:38 GMT (envelope-from sbruno@svn.freebsd.org) Message-Id: <201111041557.pA4Fvc5o024683@svn.freebsd.org> From: Sean Bruno Date: Fri, 4 Nov 2011 15:57:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r227083 - stable/8/libexec/tftpd X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Nov 2011 15:57:39 -0000 Author: sbruno Date: Fri Nov 4 15:57:38 2011 New Revision: 227083 URL: http://svn.freebsd.org/changeset/base/227083 Log: MFC r224536: Confirmed behavior of a Cisco 6509 in production. In the old TFTP server, there was an undocumented behavior where the block counter would rollover to 0 if a file larger than 65535 blocks was transferred. With the default block size of 512 octets per block, this is a file size of approximately 32 megabytes. The new TFTP server code would report an error and stop transferring the file if a file was larger than 65535 blocks. This patch restores the old TFTP server's behavior to the new TFTP server code. If a TFTP client transfers a file larger than 65535 blocks, and does *not* specify the "rollover" option, then automatically rollover the block counter to 0 every time we reach 65535 blocks. This restores interoperability with the FreeBSD 6 TFTP client. Without this change, if a FreeBSD 6 TFTP client tried to retrieve a file larger than 65535 blocks from a FreeBSD 9 TFTP server, the transfer would fail. The same file could be retrieved successfully if the same FreeBSD 6 TFTP client was used against a FreeBSD 6 TFTP server. Modified: stable/8/libexec/tftpd/tftp-transfer.c Modified: stable/8/libexec/tftpd/tftp-transfer.c ============================================================================== --- stable/8/libexec/tftpd/tftp-transfer.c Fri Nov 4 15:34:31 2011 (r227082) +++ stable/8/libexec/tftpd/tftp-transfer.c Fri Nov 4 15:57:38 2011 (r227083) @@ -129,14 +129,16 @@ tftp_send(int peer, uint16_t *block, str (*block)++; if (oldblock > *block) { if (options[OPT_ROLLOVER].o_request == NULL) { - tftp_log(LOG_ERR, - "Block rollover but not allowed."); - send_error(peer, EBADOP); - gettimeofday(&(ts->tstop), NULL); - return; + /* + * "rollover" option not specified in + * tftp client. Default to rolling block + * counter to 0. + */ + *block = 0; + } else { + *block = atoi(options[OPT_ROLLOVER].o_request); } - *block = atoi(options[OPT_ROLLOVER].o_request); ts->rollovers++; } gettimeofday(&(ts->tstop), NULL); @@ -196,14 +198,16 @@ tftp_receive(int peer, uint16_t *block, (*block)++; if (oldblock > *block) { if (options[OPT_ROLLOVER].o_request == NULL) { - tftp_log(LOG_ERR, - "Block rollover but not allowed."); - send_error(peer, EBADOP); - gettimeofday(&(ts->tstop), NULL); - return; + /* + * "rollover" option not specified in + * tftp client. Default to rolling block + * counter to 0. + */ + *block = 0; + } else { + *block = atoi(options[OPT_ROLLOVER].o_request); } - *block = atoi(options[OPT_ROLLOVER].o_request); ts->rollovers++; }