forked from Imagelibrary/rtems
2001-12-07 Eric Norum <eric.norum@usask.ca>
* lib/tftpDriver.c: Restore write capability.
This commit is contained in:
@@ -1,3 +1,7 @@
|
|||||||
|
2001-12-07 Eric Norum <eric.norum@usask.ca>
|
||||||
|
|
||||||
|
* lib/tftpDriver.c: Restore write capability.
|
||||||
|
|
||||||
2001-11-26 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
|
2001-11-26 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
|
||||||
|
|
||||||
* arpa/Makefile.am: Remove stray lines.
|
* arpa/Makefile.am: Remove stray lines.
|
||||||
|
|||||||
@@ -378,7 +378,7 @@ getPacket (struct tftpStream *tp, int retryCount)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
printf ("TFTP: %d0-byte packet\n", len);
|
printf ("TFTP: %d-byte packet\n", len);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -725,9 +725,10 @@ static int rtems_tftp_open_worker(
|
|||||||
}
|
}
|
||||||
if (tp->writing
|
if (tp->writing
|
||||||
&& (opcode == TFTP_OPCODE_ACK)
|
&& (opcode == TFTP_OPCODE_ACK)
|
||||||
&& (ntohs (tp->pkbuf.tftpACK.blocknum) == 0)) {
|
&& ((ntohs (tp->pkbuf.tftpACK.blocknum) == 0)
|
||||||
|
|| (ntohs (tp->pkbuf.tftpACK.blocknum) == 1))) {
|
||||||
tp->nused = 0;
|
tp->nused = 0;
|
||||||
tp->blocknum = 1;
|
tp->blocknum = ntohs (tp->pkbuf.tftpACK.blocknum);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (opcode == TFTP_OPCODE_ERROR) {
|
if (opcode == TFTP_OPCODE_ERROR) {
|
||||||
@@ -879,17 +880,22 @@ static int rtems_tftp_flush ( struct tftpStream *tp )
|
|||||||
tp->pkbuf.tftpDATA.blocknum = htons (tp->blocknum);
|
tp->pkbuf.tftpDATA.blocknum = htons (tp->blocknum);
|
||||||
#ifdef RTEMS_TFTP_DRIVER_DEBUG
|
#ifdef RTEMS_TFTP_DRIVER_DEBUG
|
||||||
if (rtems_tftp_driver_debug)
|
if (rtems_tftp_driver_debug)
|
||||||
printf ("TFTP: SEND %d\n", tp->blocknum);
|
printf ("TFTP: SEND %d (%d)\n", tp->blocknum, tp->nused);
|
||||||
#endif
|
#endif
|
||||||
if (sendto (tp->socket, (char *)&tp->pkbuf, wlen, 0,
|
if (sendto (tp->socket, (char *)&tp->pkbuf, wlen, 0,
|
||||||
(struct sockaddr *)&tp->farAddress,
|
(struct sockaddr *)&tp->farAddress,
|
||||||
sizeof tp->farAddress) < 0)
|
sizeof tp->farAddress) < 0)
|
||||||
return EIO;
|
return EIO;
|
||||||
rlen = getPacket (tp, retryCount);
|
rlen = getPacket (tp, retryCount);
|
||||||
|
/*
|
||||||
|
* Our last packet won't necessarily be acknowledged!
|
||||||
|
*/
|
||||||
|
if ((rlen < 0) && (tp->nused < sizeof tp->pkbuf.tftpDATA.data))
|
||||||
|
return 0;
|
||||||
if (rlen >= (int)sizeof tp->pkbuf.tftpACK) {
|
if (rlen >= (int)sizeof tp->pkbuf.tftpACK) {
|
||||||
int opcode = ntohs (tp->pkbuf.tftpACK.opcode);
|
int opcode = ntohs (tp->pkbuf.tftpACK.opcode);
|
||||||
if ((opcode == TFTP_OPCODE_ACK)
|
if ((opcode == TFTP_OPCODE_ACK)
|
||||||
&& (ntohs (tp->pkbuf.tftpACK.blocknum) == tp->blocknum)) {
|
&& (ntohs (tp->pkbuf.tftpACK.blocknum) == (tp->blocknum + 1))) {
|
||||||
tp->nused = 0;
|
tp->nused = 0;
|
||||||
tp->blocknum++;
|
tp->blocknum++;
|
||||||
return 0;
|
return 0;
|
||||||
@@ -993,7 +999,8 @@ static rtems_filesystem_node_types_t rtems_tftp_node_type(
|
|||||||
rtems_filesystem_location_info_t *pathloc /* IN */
|
rtems_filesystem_location_info_t *pathloc /* IN */
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if (pathloc->node_access == NULL)
|
if ((pathloc->node_access == NULL)
|
||||||
|
|| (pathloc->node_access == ROOT_NODE_ACCESS))
|
||||||
return RTEMS_FILESYSTEM_MEMORY_FILE;
|
return RTEMS_FILESYSTEM_MEMORY_FILE;
|
||||||
return RTEMS_FILESYSTEM_DIRECTORY;
|
return RTEMS_FILESYSTEM_DIRECTORY;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,7 @@
|
|||||||
|
2001-12-07 Eric Norum <eric.norum@usask.ca>
|
||||||
|
|
||||||
|
* lib/tftpDriver.c: Restore write capability.
|
||||||
|
|
||||||
2001-11-26 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
|
2001-11-26 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
|
||||||
|
|
||||||
* arpa/Makefile.am: Remove stray lines.
|
* arpa/Makefile.am: Remove stray lines.
|
||||||
|
|||||||
@@ -378,7 +378,7 @@ getPacket (struct tftpStream *tp, int retryCount)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
printf ("TFTP: %d0-byte packet\n", len);
|
printf ("TFTP: %d-byte packet\n", len);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -725,9 +725,10 @@ static int rtems_tftp_open_worker(
|
|||||||
}
|
}
|
||||||
if (tp->writing
|
if (tp->writing
|
||||||
&& (opcode == TFTP_OPCODE_ACK)
|
&& (opcode == TFTP_OPCODE_ACK)
|
||||||
&& (ntohs (tp->pkbuf.tftpACK.blocknum) == 0)) {
|
&& ((ntohs (tp->pkbuf.tftpACK.blocknum) == 0)
|
||||||
|
|| (ntohs (tp->pkbuf.tftpACK.blocknum) == 1))) {
|
||||||
tp->nused = 0;
|
tp->nused = 0;
|
||||||
tp->blocknum = 1;
|
tp->blocknum = ntohs (tp->pkbuf.tftpACK.blocknum);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (opcode == TFTP_OPCODE_ERROR) {
|
if (opcode == TFTP_OPCODE_ERROR) {
|
||||||
@@ -879,17 +880,22 @@ static int rtems_tftp_flush ( struct tftpStream *tp )
|
|||||||
tp->pkbuf.tftpDATA.blocknum = htons (tp->blocknum);
|
tp->pkbuf.tftpDATA.blocknum = htons (tp->blocknum);
|
||||||
#ifdef RTEMS_TFTP_DRIVER_DEBUG
|
#ifdef RTEMS_TFTP_DRIVER_DEBUG
|
||||||
if (rtems_tftp_driver_debug)
|
if (rtems_tftp_driver_debug)
|
||||||
printf ("TFTP: SEND %d\n", tp->blocknum);
|
printf ("TFTP: SEND %d (%d)\n", tp->blocknum, tp->nused);
|
||||||
#endif
|
#endif
|
||||||
if (sendto (tp->socket, (char *)&tp->pkbuf, wlen, 0,
|
if (sendto (tp->socket, (char *)&tp->pkbuf, wlen, 0,
|
||||||
(struct sockaddr *)&tp->farAddress,
|
(struct sockaddr *)&tp->farAddress,
|
||||||
sizeof tp->farAddress) < 0)
|
sizeof tp->farAddress) < 0)
|
||||||
return EIO;
|
return EIO;
|
||||||
rlen = getPacket (tp, retryCount);
|
rlen = getPacket (tp, retryCount);
|
||||||
|
/*
|
||||||
|
* Our last packet won't necessarily be acknowledged!
|
||||||
|
*/
|
||||||
|
if ((rlen < 0) && (tp->nused < sizeof tp->pkbuf.tftpDATA.data))
|
||||||
|
return 0;
|
||||||
if (rlen >= (int)sizeof tp->pkbuf.tftpACK) {
|
if (rlen >= (int)sizeof tp->pkbuf.tftpACK) {
|
||||||
int opcode = ntohs (tp->pkbuf.tftpACK.opcode);
|
int opcode = ntohs (tp->pkbuf.tftpACK.opcode);
|
||||||
if ((opcode == TFTP_OPCODE_ACK)
|
if ((opcode == TFTP_OPCODE_ACK)
|
||||||
&& (ntohs (tp->pkbuf.tftpACK.blocknum) == tp->blocknum)) {
|
&& (ntohs (tp->pkbuf.tftpACK.blocknum) == (tp->blocknum + 1))) {
|
||||||
tp->nused = 0;
|
tp->nused = 0;
|
||||||
tp->blocknum++;
|
tp->blocknum++;
|
||||||
return 0;
|
return 0;
|
||||||
@@ -993,7 +999,8 @@ static rtems_filesystem_node_types_t rtems_tftp_node_type(
|
|||||||
rtems_filesystem_location_info_t *pathloc /* IN */
|
rtems_filesystem_location_info_t *pathloc /* IN */
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if (pathloc->node_access == NULL)
|
if ((pathloc->node_access == NULL)
|
||||||
|
|| (pathloc->node_access == ROOT_NODE_ACCESS))
|
||||||
return RTEMS_FILESYSTEM_MEMORY_FILE;
|
return RTEMS_FILESYSTEM_MEMORY_FILE;
|
||||||
return RTEMS_FILESYSTEM_DIRECTORY;
|
return RTEMS_FILESYSTEM_DIRECTORY;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,7 @@
|
|||||||
|
2001-12-07 Eric Norum <eric.norum@usask.ca>
|
||||||
|
|
||||||
|
* lib/tftpDriver.c: Restore write capability.
|
||||||
|
|
||||||
2001-11-26 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
|
2001-11-26 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
|
||||||
|
|
||||||
* arpa/Makefile.am: Remove stray lines.
|
* arpa/Makefile.am: Remove stray lines.
|
||||||
|
|||||||
@@ -378,7 +378,7 @@ getPacket (struct tftpStream *tp, int retryCount)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
printf ("TFTP: %d0-byte packet\n", len);
|
printf ("TFTP: %d-byte packet\n", len);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -725,9 +725,10 @@ static int rtems_tftp_open_worker(
|
|||||||
}
|
}
|
||||||
if (tp->writing
|
if (tp->writing
|
||||||
&& (opcode == TFTP_OPCODE_ACK)
|
&& (opcode == TFTP_OPCODE_ACK)
|
||||||
&& (ntohs (tp->pkbuf.tftpACK.blocknum) == 0)) {
|
&& ((ntohs (tp->pkbuf.tftpACK.blocknum) == 0)
|
||||||
|
|| (ntohs (tp->pkbuf.tftpACK.blocknum) == 1))) {
|
||||||
tp->nused = 0;
|
tp->nused = 0;
|
||||||
tp->blocknum = 1;
|
tp->blocknum = ntohs (tp->pkbuf.tftpACK.blocknum);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (opcode == TFTP_OPCODE_ERROR) {
|
if (opcode == TFTP_OPCODE_ERROR) {
|
||||||
@@ -879,17 +880,22 @@ static int rtems_tftp_flush ( struct tftpStream *tp )
|
|||||||
tp->pkbuf.tftpDATA.blocknum = htons (tp->blocknum);
|
tp->pkbuf.tftpDATA.blocknum = htons (tp->blocknum);
|
||||||
#ifdef RTEMS_TFTP_DRIVER_DEBUG
|
#ifdef RTEMS_TFTP_DRIVER_DEBUG
|
||||||
if (rtems_tftp_driver_debug)
|
if (rtems_tftp_driver_debug)
|
||||||
printf ("TFTP: SEND %d\n", tp->blocknum);
|
printf ("TFTP: SEND %d (%d)\n", tp->blocknum, tp->nused);
|
||||||
#endif
|
#endif
|
||||||
if (sendto (tp->socket, (char *)&tp->pkbuf, wlen, 0,
|
if (sendto (tp->socket, (char *)&tp->pkbuf, wlen, 0,
|
||||||
(struct sockaddr *)&tp->farAddress,
|
(struct sockaddr *)&tp->farAddress,
|
||||||
sizeof tp->farAddress) < 0)
|
sizeof tp->farAddress) < 0)
|
||||||
return EIO;
|
return EIO;
|
||||||
rlen = getPacket (tp, retryCount);
|
rlen = getPacket (tp, retryCount);
|
||||||
|
/*
|
||||||
|
* Our last packet won't necessarily be acknowledged!
|
||||||
|
*/
|
||||||
|
if ((rlen < 0) && (tp->nused < sizeof tp->pkbuf.tftpDATA.data))
|
||||||
|
return 0;
|
||||||
if (rlen >= (int)sizeof tp->pkbuf.tftpACK) {
|
if (rlen >= (int)sizeof tp->pkbuf.tftpACK) {
|
||||||
int opcode = ntohs (tp->pkbuf.tftpACK.opcode);
|
int opcode = ntohs (tp->pkbuf.tftpACK.opcode);
|
||||||
if ((opcode == TFTP_OPCODE_ACK)
|
if ((opcode == TFTP_OPCODE_ACK)
|
||||||
&& (ntohs (tp->pkbuf.tftpACK.blocknum) == tp->blocknum)) {
|
&& (ntohs (tp->pkbuf.tftpACK.blocknum) == (tp->blocknum + 1))) {
|
||||||
tp->nused = 0;
|
tp->nused = 0;
|
||||||
tp->blocknum++;
|
tp->blocknum++;
|
||||||
return 0;
|
return 0;
|
||||||
@@ -993,7 +999,8 @@ static rtems_filesystem_node_types_t rtems_tftp_node_type(
|
|||||||
rtems_filesystem_location_info_t *pathloc /* IN */
|
rtems_filesystem_location_info_t *pathloc /* IN */
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if (pathloc->node_access == NULL)
|
if ((pathloc->node_access == NULL)
|
||||||
|
|| (pathloc->node_access == ROOT_NODE_ACCESS))
|
||||||
return RTEMS_FILESYSTEM_MEMORY_FILE;
|
return RTEMS_FILESYSTEM_MEMORY_FILE;
|
||||||
return RTEMS_FILESYSTEM_DIRECTORY;
|
return RTEMS_FILESYSTEM_DIRECTORY;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user