Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 11 Feb 2012 23:58:07 +0000 (UTC)
From:      Craig Rodrigues <rodrigc@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
Subject:   svn commit: r231540 - stable/7/usr.bin/tftp
Message-ID:  <201202112358.q1BNw7D9056059@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: rodrigc
Date: Sat Feb 11 23:58:07 2012
New Revision: 231540
URL: http://svn.freebsd.org/changeset/base/231540

Log:
  MFC 170382 through 231539
     - this records svn:mergeinfo for previously merged changesets
  
  This pulls in changes such as:
  
  MFC 216370
    - Remove adertising clause from UCB copyrighted files in usr.bin
  
  MFC 222534
    - Fix a couple of spelling errors.
  
  MFC 223493
    - Remove duplicated header files
  
  MFC 223135 - 223491
    - man page updates
  
  MFC 229403
    - Replace index() and rindex() calls with strchr() and strrchr().
  
  MFC 230044
    - fgets(3) returns a pointer, so compare against NULL, not integer 0.

Modified:
  stable/7/usr.bin/tftp/main.c
  stable/7/usr.bin/tftp/tftp.1
  stable/7/usr.bin/tftp/tftp.c
  stable/7/usr.bin/tftp/tftp.h
Directory Properties:
  stable/7/usr.bin/tftp/   (props changed)

Modified: stable/7/usr.bin/tftp/main.c
==============================================================================
--- stable/7/usr.bin/tftp/main.c	Sat Feb 11 23:39:53 2012	(r231539)
+++ stable/7/usr.bin/tftp/main.c	Sat Feb 11 23:58:07 2012	(r231540)
@@ -10,10 +10,6 @@
  * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in the
  *    documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *    must display the following acknowledgement:
- *	This product includes software developed by the University of
- *	California, Berkeley and its contributors.
  * 4. Neither the name of the University nor the names of its contributors
  *    may be used to endorse or promote products derived from this software
  *    without specific prior written permission.
@@ -56,7 +52,6 @@ __FBSDID("$FreeBSD$");
 #include <sys/socket.h>
 #include <sys/sysctl.h>
 #include <sys/file.h>
-#include <sys/param.h>
 #include <sys/stat.h>
 
 #include <netinet/in.h>
@@ -82,7 +77,7 @@ __FBSDID("$FreeBSD$");
 #define	MAXLINE		200
 #define	TIMEOUT		5		/* secs between rexmt's */
 
-static struct	sockaddr_storage peeraddr;
+typedef struct	sockaddr_storage peeraddr;
 static int	connected;
 static char	mode[32];
 jmp_buf		toplevel;
@@ -159,7 +154,7 @@ static struct cmd cmdtab[] = {
 	{ "options",	setoptions,
 	  "enable or disable RFC2347 style options" },
 	{ "help",	help,		"print help information"	},
-	{ "packetdrop",	setpacketdrop,	"artifical packetloss feature"	},
+	{ "packetdrop",	setpacketdrop,	"artificial packetloss feature"	},
 	{ "?",		help,		"print help information"	},
 	{ NULL,		NULL,		NULL				}
 };
@@ -442,16 +437,16 @@ put(int argc, char *argv[])
 		return;
 	}
 	targ = argv[argc - 1];
-	if (rindex(argv[argc - 1], ':')) {
+	if (strrchr(argv[argc - 1], ':')) {
 		char *lcp;
 
 		for (n = 1; n < argc - 1; n++)
-			if (index(argv[n], ':')) {
+			if (strchr(argv[n], ':')) {
 				putusage(argv[0]);
 				return;
 			}
 		lcp = argv[argc - 1];
-		targ = rindex(lcp, ':');
+		targ = strrchr(lcp, ':');
 		*targ++ = 0;
 		if (lcp[0] == '[' && lcp[strlen(lcp) - 1] == ']') {
 			lcp[strlen(lcp) - 1] = '\0';
@@ -482,7 +477,7 @@ put(int argc, char *argv[])
 	}
 				/* this assumes the target is a directory */
 				/* on a remote unix system.  hmmmm.  */
-	cp = index(targ, '\0');
+	cp = strchr(targ, '\0');
 	*cp++ = '/';
 	for (n = 1; n < argc - 1; n++) {
 		strcpy(cp, tail(argv[n]));
@@ -537,7 +532,7 @@ get(int argc, char *argv[])
 	}
 	if (!connected) {
 		for (n = 1; n < argc ; n++)
-			if (rindex(argv[n], ':') == 0) {
+			if (strrchr(argv[n], ':') == 0) {
 				printf("No remote host specified and "
 				    "no host given for file '%s'\n", argv[n]);
 				getusage(argv[0]);
@@ -545,7 +540,7 @@ get(int argc, char *argv[])
 			}
 	}
 	for (n = 1; n < argc ; n++) {
-		src = rindex(argv[n], ':');
+		src = strrchr(argv[n], ':');
 		if (src == NULL)
 			src = argv[n];
 		else {
@@ -686,7 +681,7 @@ tail(char *filename)
 	char *s;
 
 	while (*filename) {
-		s = rindex(filename, '/');
+		s = strrchr(filename, '/');
 		if (s == NULL)
 			break;
 		if (s[1])
@@ -739,7 +734,7 @@ command(void)
                         history(hist, &he, H_ENTER, bp);
 		} else {
 			line[0] = 0;
-			if (fgets(line, sizeof line , stdin) == 0) {
+			if (fgets(line, sizeof line , stdin) == NULL) {
 				if (feof(stdin)) {
 					exit(txrx_error);
 				} else {
@@ -844,8 +839,8 @@ help(int argc, char *argv[])
 			printf("%-*s\t%s\n", (int)HELPINDENT, c->name, c->help);
 
 		printf("\n[-] : You shouldn't use these ones anymore.\n");
-		printf("[*] : RFC2834 options support required.\n");
-		printf("[**] : Non-standard RFC2834 option.\n");
+		printf("[*] : RFC2347 options support required.\n");
+		printf("[**] : Non-standard RFC2347 option.\n");
 		return;
 	}
 	while (--argc > 0) {
@@ -959,7 +954,7 @@ setblocksize(int argc, char *argv[])
 
 	if (!options_rfc_enabled)
 		printf("RFC2347 style options are not enabled "
-		    "(but proceding anyway)\n");
+		    "(but proceeding anyway)\n");
 
 	if (argc != 1) {
 		int size = atoi(argv[1]);
@@ -997,7 +992,7 @@ setblocksize2(int argc, char *argv[])
 	if (!options_rfc_enabled || !options_extra_enabled)
 		printf(
 		    "RFC2347 style or non-RFC defined options are not enabled "
-		    "(but proceding anyway)\n");
+		    "(but proceeding anyway)\n");
 
 	if (argc != 1) {
 		int size = atoi(argv[1]);

Modified: stable/7/usr.bin/tftp/tftp.1
==============================================================================
--- stable/7/usr.bin/tftp/tftp.1	Sat Feb 11 23:39:53 2012	(r231539)
+++ stable/7/usr.bin/tftp/tftp.1	Sat Feb 11 23:58:07 2012	(r231540)
@@ -9,10 +9,6 @@
 .\" 2. Redistributions in binary form must reproduce the above copyright
 .\"    notice, this list of conditions and the following disclaimer in the
 .\"    documentation and/or other materials provided with the distribution.
-.\" 3. All advertising materials mentioning features or use of this software
-.\"    must display the following acknowledgement:
-.\"	This product includes software developed by the University of
-.\"	California, Berkeley and its contributors.
 .\" 4. Neither the name of the University nor the names of its contributors
 .\"    may be used to endorse or promote products derived from this software
 .\"    without specific prior written permission.
@@ -32,7 +28,7 @@
 .\"     @(#)tftp.1	8.2 (Berkeley) 4/18/94
 .\" $FreeBSD$
 .\"
-.Dd October 1, 2003
+.Dd June 22, 2011
 .Dt TFTP 1
 .Os
 .Sh NAME
@@ -74,6 +70,21 @@ Shorthand for "mode ascii"
 .It Cm binary
 Shorthand for "mode binary"
 .Pp
+.It Cm blocksize Ar [size]
+Sets the TFTP blksize option in TFTP Read Request or Write Request packets
+to
+.Ar [size]
+as specified in RFC 2348.  Valid values are between 8 and 65464.
+If no blocksize is specified, then by default a blocksize of 512 bytes
+will be used.
+.Pp
+.It Cm blocksize2 Ar [size]
+Sets the TFTP blksize2 option in TFTP Read Request or Write Request packets
+to
+.Ar [size] .
+Values are restricted to powers of 2 between 8 and 32768.  This is a
+non-standard TFTP option. 
+.Pp
 .It Cm connect Ar host Op Ar port
 Set the
 .Ar host
@@ -97,6 +108,14 @@ or
 .Cm put
 commands.
 .Pp
+.It Cm debug Ar level
+Enable or disable debugging levels during verbose output.  The value of 
+.Ar level
+can be one of
+.Cm packet, simple, options,
+or
+.Cm access.
+.Pp
 .It Cm get Oo Ar host : Oc Ns Ar file Op Ar localname
 .It Cm get Xo
 .Oo Ar host1 : Oc Ns Ar file1
@@ -134,6 +153,11 @@ or
 The default is
 .Em ascii .
 .Pp
+.It Cm packetdrop [arg]
+Randomly drop
+.Ar arg
+out of 100 packets during a transfer.  This is a debugging feature.
+.Pp
 .It Cm put Ar file Op Oo Ar host : Oc Ns Ar remotename
 .It Cm put Ar file1 file2 ... fileN Op Oo Ar host : Oc Ns Ar remote-directory
 Put a file or set of files to the remote host.
@@ -153,6 +177,17 @@ see the example under the
 .Cm get
 command.
 .Pp
+.It Cm options Ar [arg]
+Enable or disable support for TFTP options.  The valid values of
+.Ar arg
+are
+.Cm on
+(enable RFC 2347 options),
+.Cm off
+(disable RFC 2347 options), and
+.Cm extra
+(toggle support for non-RFC defined options).   
+.Pp
 .It Cm quit
 Exit
 .Nm .
@@ -161,6 +196,15 @@ An end of file also exits.
 .It Cm rexmt Ar retransmission-timeout
 Set the per-packet retransmission timeout, in seconds.
 .Pp
+.It Cm rollover [arg]
+Specify the rollover option in TFTP Read Request or Write
+Request packets.  After 65535 packets have been transmitted, set the block
+counter to
+.Ar arg .
+Valid values of
+.Ar arg
+are 0 and 1.  This is a non-standard TFTP option.
+.Pp
 .It Cm status
 Show current status.
 .Pp
@@ -173,12 +217,52 @@ Toggle packet tracing.
 .It Cm verbose
 Toggle verbose mode.
 .El
+.Sh SEE ALSO
+.Xr tftpd 8
+.Pp
+The following RFC's are supported:
+.Rs
+RFC 1350
+.%T The TFTP Protocol (Revision 2)
+.Re
+.Rs
+RFC 2347
+.%T TFTP Option Extension
+.Re
+.Rs
+RFC 2348
+.%T TFTP Blocksize Option
+.Re
+.Rs
+RFC 2349
+.%T TFTP Timeout Interval and Transfer Size Options
+.Re
+.Rs
+RFC 3617
+.%T Uniform Resource Identifier (URI) Scheme and Applicability Statement for the Trivial File Transfer Protocol (TFTP) 
+.Re
+.Pp
+The non-standard
+.Cm rollover
+and
+.Cm blksize2
+TFTP options are mentioned here:
+.Rs
+.%T Extending TFTP
+.%U http://www.compuphase.com/tftp.htm
+.Re
 .Sh HISTORY
 The
 .Nm
 command appeared in
 .Bx 4.3 .
-.Sh BUGS
+.Pp
+Edwin Groothuis <edwin@FreeBSD.org> performed a major rewrite of the
+.Xr tftpd 8
+and
+.Nm
+code to support RFC2348.
+.Sh NOTES
 Because there is no user-login or validation within
 the
 .Tn TFTP
@@ -189,4 +273,5 @@ exact methods are specific to each site 
 difficult to document here.
 .Pp
 Files larger than 33488896 octets (65535 blocks) cannot be transferred
-without client and server supporting blocksize negotiation (RFC1783).
+without client and server supporting the TFTP blocksize option (RFC2348),
+or the non-standard TFTP rollover option.

Modified: stable/7/usr.bin/tftp/tftp.c
==============================================================================
--- stable/7/usr.bin/tftp/tftp.c	Sat Feb 11 23:39:53 2012	(r231539)
+++ stable/7/usr.bin/tftp/tftp.c	Sat Feb 11 23:58:07 2012	(r231540)
@@ -10,10 +10,6 @@
  * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in the
  *    documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *    must display the following acknowledgement:
- *	This product includes software developed by the University of
- *	California, Berkeley and its contributors.
  * 4. Neither the name of the University nor the names of its contributors
  *    may be used to endorse or promote products derived from this software
  *    without specific prior written permission.

Modified: stable/7/usr.bin/tftp/tftp.h
==============================================================================
--- stable/7/usr.bin/tftp/tftp.h	Sat Feb 11 23:39:53 2012	(r231539)
+++ stable/7/usr.bin/tftp/tftp.h	Sat Feb 11 23:58:07 2012	(r231540)
@@ -10,10 +10,6 @@
  * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in the
  *    documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *    must display the following acknowledgement:
- *	This product includes software developed by the University of
- *	California, Berkeley and its contributors.
  * 4. Neither the name of the University nor the names of its contributors
  *    may be used to endorse or promote products derived from this software
  *    without specific prior written permission.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201202112358.q1BNw7D9056059>