svn commit: r183993 - user/edwin/tftpd/usr.bin/tftp

Edwin Groothuis edwin at FreeBSD.org
Fri Oct 17 22:26:38 UTC 2008


Author: edwin
Date: Fri Oct 17 22:26:38 2008
New Revision: 183993
URL: http://svn.freebsd.org/changeset/base/183993

Log:
  Add OP_ prefixes to packet types as defined in arpa/tftp.h.
  Add TFTP_ prefixes to error codes as defined in arpa/tftp.h.
  
  This all to avoid confusion (which is a good thing!)
  
  Submitted by:   netchild@, rink@ and others

Modified:
  user/edwin/tftpd/usr.bin/tftp/tftp.c

Modified: user/edwin/tftpd/usr.bin/tftp/tftp.c
==============================================================================
--- user/edwin/tftpd/usr.bin/tftp/tftp.c	Fri Oct 17 22:19:08 2008	(r183992)
+++ user/edwin/tftpd/usr.bin/tftp/tftp.c	Fri Oct 17 22:26:38 2008	(r183993)
@@ -134,7 +134,7 @@ xmitfile(int peer, char *port, int fd, c
 		printf("Transfer timed out.\n");
 		return;
 	}
-	if (rp->th_opcode == ERROR) {
+	if (rp->th_opcode == OP_ERROR) {
 		printf("Got ERROR, aborted\n");
 		return;
 	}
@@ -143,10 +143,10 @@ xmitfile(int peer, char *port, int fd, c
 	 * If the first packet is an OACK instead of an ACK packet,
 	 * handle it different.
 	 */
-	if (rp->th_opcode == OACK) {
+	if (rp->th_opcode == OP_OACK) {
 		if (!options_rfc_enabled) {
 			printf("Got OACK while options are not enabled!\n");
-			send_error(peer, EBADOP);
+			send_error(peer, TFTP_EBADOP);
 			return;
 		}
 
@@ -230,7 +230,7 @@ recvfile(int peer, char *port, int fd, c
 		break;
 	}
 
-	if (rp->th_opcode == ERROR) {
+	if (rp->th_opcode == OP_ERROR) {
 		tftp_log(LOG_ERR, "Error code %d: %s", rp->th_code, rp->th_msg);
 		return;
 	}
@@ -246,10 +246,10 @@ recvfile(int peer, char *port, int fd, c
 	 * If the first packet is an OACK packet instead of an DATA packet,
 	 * handle it different.
 	 */
-	if (rp->th_opcode == OACK) {
+	if (rp->th_opcode == OP_OACK) {
 		if (!options_rfc_enabled) {
 			printf("Got OACK while options are not enabled!\n");
-			send_error(peer, EBADOP);
+			send_error(peer, TFTP_EBADOP);
 			return;
 		}
 


More information about the svn-src-user mailing list