This is the mail archive of the ecos-patches@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RedBoot & NET - Fix TFTP for large files


Index: redboot/current/ChangeLog
===================================================================
RCS file: /misc/cvsfiles/ecos/packages/redboot/current/ChangeLog,v
retrieving revision 1.65
diff -u -5 -p -r1.65 ChangeLog
--- redboot/current/ChangeLog	6 Aug 2002 14:29:11 -0000	1.65
+++ redboot/current/ChangeLog	7 Aug 2002 14:40:17 -0000
@@ -1,5 +1,11 @@
+2002-08-07  Gary Thomas  <gary@chez-thomas.org>
+
+	* src/net/tftp_client.c: 
+	* include/net/tftp.h: Make block numbers unsigned to handle files
+	larger than 16MB.
+
 2002-08-06  Gary Thomas  <gary@chez-thomas.org>
 
 	* src/crc.c: POSIX crc code is now separate.
 	
 	* src/mfill.c: 
Index: redboot/current/include/net/tftp.h
===================================================================
RCS file: /misc/cvsfiles/ecos/packages/redboot/current/include/net/tftp.h,v
retrieving revision 1.4
diff -u -5 -p -r1.4 tftp.h
--- redboot/current/include/net/tftp.h	23 May 2002 23:08:29 -0000	1.4
+++ redboot/current/include/net/tftp.h	7 Aug 2002 14:39:49 -0000
@@ -7,10 +7,11 @@
 //==========================================================================
 //####ECOSGPLCOPYRIGHTBEGIN####
 // -------------------------------------------
 // This file is part of eCos, the Embedded Configurable Operating System.
 // Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
+// Copyright (C) 2002 Gary Thomas
 //
 // eCos is free software; you can redistribute it and/or modify it under
 // the terms of the GNU General Public License as published by the Free
 // Software Foundation; either version 2 or (at your option) any later version.
 //
@@ -116,11 +117,11 @@
 #define	ERROR	05			/* error code */
 
 struct	tftphdr {
 	short	th_opcode;		/* packet type */
 	union {
-		short	tu_block;	/* block # */
+		unsigned short	tu_block;	/* block # */
 		short	tu_code;	/* error code */
 		char	tu_stuff[1];	/* request packet stuff */
 	} __attribute__ ((packed)) th_u;
 	char	th_data[0];		/* data or error string */
 } __attribute__ ((packed));
Index: redboot/current/src/net/tftp_client.c
===================================================================
RCS file: /misc/cvsfiles/ecos/packages/redboot/current/src/net/tftp_client.c,v
retrieving revision 1.11
diff -u -5 -p -r1.11 tftp_client.c
--- redboot/current/src/net/tftp_client.c	18 Jul 2002 20:05:23 -0000	1.11
+++ redboot/current/src/net/tftp_client.c	7 Aug 2002 14:34:42 -0000
@@ -64,11 +64,11 @@
 static int get_port = 7700;
 
 static struct {
     bool open;
     int  total_timeouts;
-    int  last_good_block;
+    unsigned short last_good_block;
     int  avail, actual_len;
     struct sockaddr_in local_addr, from_addr;
     char data[SEGSIZE+sizeof(struct tftphdr)];
     char *bufp;
 } tftp_stream;
Index: net/common/current/ChangeLog
===================================================================
RCS file: /misc/cvsfiles/ecos-opt/net/net/common/current/ChangeLog,v
retrieving revision 1.9
diff -u -5 -p -r1.9 ChangeLog
--- net/common/current/ChangeLog	26 Jul 2002 15:06:38 -0000	1.9
+++ net/common/current/ChangeLog	7 Aug 2002 14:41:59 -0000
@@ -1,5 +1,12 @@
+2002-08-07  Gary Thomas  <gary@chez-thomas.org>
+
+	* src/tftp_server.c: 
+	* src/tftp_client.c: 
+	* include/arpa/tftp.h: Make block numbers unsigned to handle files
+	larger than 16MB.
+
 2002-07-26  Gary Thomas  <gary@chez-thomas.org>
 2002-07-26  Ken Cox <jkc@redhat.com>
 
 	* src/dhcp_prot.c: The IPv6 link local address would not be 
 	recognized if configured to use dhcp.  When dhcp reconfigures 
Index: net/common/current/include/arpa/tftp.h
===================================================================
RCS file: /misc/cvsfiles/ecos-opt/net/net/common/current/include/arpa/tftp.h,v
retrieving revision 1.1
diff -u -5 -p -r1.1 tftp.h
--- net/common/current/include/arpa/tftp.h	20 May 2002 22:25:03 -0000	1.1
+++ net/common/current/include/arpa/tftp.h	7 Aug 2002 14:41:53 -0000
@@ -72,11 +72,11 @@
 #define	ERROR	05			/* error code */
 
 struct	tftphdr {
 	short	th_opcode;		/* packet type */
 	union {
-		short	tu_block;	/* block # */
+		unsigned short	tu_block;	/* block # */
 		short	tu_code;	/* error code */
 		char	tu_stuff[1];	/* request packet stuff */
 	} __attribute__ ((packed)) th_u;
 	char	th_data[1];		/* data or error string */
 } __attribute__ ((packed));
Index: net/common/current/src/tftp_client.c
===================================================================
RCS file: /misc/cvsfiles/ecos-opt/net/net/common/current/src/tftp_client.c,v
retrieving revision 1.1
diff -u -5 -p -r1.1 tftp_client.c
--- net/common/current/src/tftp_client.c	20 May 2002 22:25:05 -0000	1.1
+++ net/common/current/src/tftp_client.c	7 Aug 2002 14:38:11 -0000
@@ -56,11 +56,11 @@ tftp_get(char *filename,
     struct sockaddr_in local_addr, server_addr, from_addr;
     char data[SEGSIZE+sizeof(struct tftphdr)];
     struct tftphdr *hdr = (struct tftphdr *)data;
     char *cp, *fp;
     struct timeval timeout;
-    int last_good_block = 0;
+    unsigned short last_good_block = 0;
     struct servent *server_info;
     fd_set fds;
     int total_timeouts = 0;
 
     *err = 0;  // Just in case
@@ -224,11 +224,11 @@ tftp_put(char *filename,
     struct sockaddr_in local_addr, server_addr, from_addr;
     char data[SEGSIZE+sizeof(struct tftphdr)];
     struct tftphdr *hdr = (struct tftphdr *)data;
     char *cp, *fp, *sfp;
     struct timeval timeout;
-    int last_good_block = 0;
+    unsigned short last_good_block = 0;
     struct servent *server_info;
     fd_set fds;
     int total_timeouts = 0;
 
     *err = 0;  // Just in case
Index: net/common/current/src/tftp_server.c
===================================================================
RCS file: /misc/cvsfiles/ecos-opt/net/net/common/current/src/tftp_server.c,v
retrieving revision 1.1
diff -u -5 -p -r1.1 tftp_server.c
--- net/common/current/src/tftp_server.c	20 May 2002 22:25:05 -0000	1.1
+++ net/common/current/src/tftp_server.c	7 Aug 2002 14:38:10 -0000
@@ -112,11 +112,12 @@ tftpd_write_file(struct tftp_server *ser
 {
     char data_out[SEGSIZE+sizeof(struct tftphdr)];
     char data_in[SEGSIZE+sizeof(struct tftphdr)];
     struct tftphdr *reply = (struct tftphdr *)data_out;
     struct tftphdr *response = (struct tftphdr *)data_in;
-    int fd, block, len, ok, tries, closed, data_len, s;
+    int fd, len, ok, tries, closed, data_len, s;
+    unsigned short block;
     struct timeval timeout;
     fd_set fds;
     int total_timeouts = 0;
     struct sockaddr_in client_addr, local_addr;
     int client_len;
@@ -263,11 +264,12 @@ tftpd_read_file(struct tftp_server *serv
 {
     char data_out[SEGSIZE+sizeof(struct tftphdr)];
     char data_in[SEGSIZE+sizeof(struct tftphdr)];
     struct tftphdr *reply = (struct tftphdr *)data_out;
     struct tftphdr *response = (struct tftphdr *)data_in;
-    int fd, block, len, tries, ok, data_len, s;
+    int fd, len, tries, ok, data_len, s;
+    unsigned short block;
     struct timeval timeout;
     fd_set fds;
     int total_timeouts = 0;
     struct sockaddr_in client_addr, local_addr;
     int client_len;


-- 
------------------------------------------------------------
Gary Thomas                  |
eCosCentric, Ltd.            |  
+1 (970) 229-1963            |  eCos & RedBoot experts
gthomas@ecoscentric.com      |
http://www.ecoscentric.com/  |
------------------------------------------------------------


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]