Mercurial > ecos-v2_0-branch
changeset 270:42332443fea2
Fix TFTP for large (16MB+) files.
| author | gthomas |
|---|---|
| date | Wed, 07 Aug 2002 14:42:28 +0000 |
| parents | 7fffb214536c |
| children | 8d47e3001deb |
| files | packages/net/common/current/ChangeLog packages/net/common/current/include/arpa/tftp.h packages/net/common/current/src/tftp_client.c packages/net/common/current/src/tftp_server.c packages/redboot/current/ChangeLog packages/redboot/current/include/net/tftp.h packages/redboot/current/src/net/tftp_client.c |
| diffstat | 7 files changed, 23 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/packages/net/common/current/ChangeLog +++ b/packages/net/common/current/ChangeLog @@ -1,3 +1,10 @@ +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>
--- a/packages/net/common/current/include/arpa/tftp.h +++ b/packages/net/common/current/include/arpa/tftp.h @@ -74,7 +74,7 @@ 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;
--- a/packages/net/common/current/src/tftp_client.c +++ b/packages/net/common/current/src/tftp_client.c @@ -58,7 +58,7 @@ tftp_get(char *filename, 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; @@ -226,7 +226,7 @@ tftp_put(char *filename, 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;
--- a/packages/net/common/current/src/tftp_server.c +++ b/packages/net/common/current/src/tftp_server.c @@ -114,7 +114,8 @@ tftpd_write_file(struct tftp_server *ser 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; @@ -265,7 +266,8 @@ tftpd_read_file(struct tftp_server *serv 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;
--- a/packages/redboot/current/ChangeLog +++ b/packages/redboot/current/ChangeLog @@ -1,3 +1,9 @@ +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.
--- a/packages/redboot/current/include/net/tftp.h +++ b/packages/redboot/current/include/net/tftp.h @@ -9,6 +9,7 @@ // ------------------------------------------- // 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 @@ -118,7 +119,7 @@ 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;
--- a/packages/redboot/current/src/net/tftp_client.c +++ b/packages/redboot/current/src/net/tftp_client.c @@ -66,7 +66,7 @@ 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)];
