Changeset 86d9ca2 in rtems


Ignore:
Timestamp:
12/07/01 12:59:12 (22 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10, 4.11, 4.8, 4.9, 5, master
Children:
63bb806
Parents:
85ca769
Message:

2001-12-07 Eric Norum <eric.norum@…>

  • lib/tftpDriver.c: Restore write capability.
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • c/src/exec/libnetworking/ChangeLog

    r85ca769 r86d9ca2  
     12001-12-07      Eric Norum <eric.norum@usask.ca>
     2
     3        * lib/tftpDriver.c: Restore write capability.
     4
    152001-11-26      Ralf Corsepius <corsepiu@faw.uni-ulm.de>
    26
  • c/src/exec/libnetworking/lib/tftpDriver.c

    r85ca769 r86d9ca2  
    379379        }
    380380        else {
    381             printf ("TFTP: %d0-byte packet\n", len);
     381            printf ("TFTP: %d-byte packet\n", len);
    382382        }
    383383    }
     
    726726            if (tp->writing
    727727             && (opcode == TFTP_OPCODE_ACK)
    728              && (ntohs (tp->pkbuf.tftpACK.blocknum) == 0)) {
     728             && ((ntohs (tp->pkbuf.tftpACK.blocknum) == 0)
     729              || (ntohs (tp->pkbuf.tftpACK.blocknum) == 1))) {
    729730                tp->nused = 0;
    730                 tp->blocknum = 1;
     731                tp->blocknum = ntohs (tp->pkbuf.tftpACK.blocknum);
    731732                break;
    732733            }
     
    880881#ifdef RTEMS_TFTP_DRIVER_DEBUG
    881882        if (rtems_tftp_driver_debug)
    882             printf ("TFTP: SEND %d\n", tp->blocknum);
     883            printf ("TFTP: SEND %d (%d)\n", tp->blocknum, tp->nused);
    883884#endif
    884885        if (sendto (tp->socket, (char *)&tp->pkbuf, wlen, 0,
     
    887888            return EIO;
    888889        rlen = getPacket (tp, retryCount);
     890        /*
     891         * Our last packet won't necessarily be acknowledged!
     892         */
     893        if ((rlen < 0) && (tp->nused < sizeof tp->pkbuf.tftpDATA.data))
     894                return 0;
    889895        if (rlen >= (int)sizeof tp->pkbuf.tftpACK) {
    890896            int opcode = ntohs (tp->pkbuf.tftpACK.opcode);
    891897            if ((opcode == TFTP_OPCODE_ACK)
    892              && (ntohs (tp->pkbuf.tftpACK.blocknum) == tp->blocknum)) {
     898             && (ntohs (tp->pkbuf.tftpACK.blocknum) == (tp->blocknum + 1))) {
    893899                tp->nused = 0;
    894900                tp->blocknum++;
     
    9941000)
    9951001{
    996     if (pathloc->node_access == NULL)
     1002    if ((pathloc->node_access == NULL)
     1003     || (pathloc->node_access == ROOT_NODE_ACCESS))
    9971004        return RTEMS_FILESYSTEM_MEMORY_FILE;
    9981005    return RTEMS_FILESYSTEM_DIRECTORY;
  • c/src/libnetworking/ChangeLog

    r85ca769 r86d9ca2  
     12001-12-07      Eric Norum <eric.norum@usask.ca>
     2
     3        * lib/tftpDriver.c: Restore write capability.
     4
    152001-11-26      Ralf Corsepius <corsepiu@faw.uni-ulm.de>
    26
  • c/src/libnetworking/lib/tftpDriver.c

    r85ca769 r86d9ca2  
    379379        }
    380380        else {
    381             printf ("TFTP: %d0-byte packet\n", len);
     381            printf ("TFTP: %d-byte packet\n", len);
    382382        }
    383383    }
     
    726726            if (tp->writing
    727727             && (opcode == TFTP_OPCODE_ACK)
    728              && (ntohs (tp->pkbuf.tftpACK.blocknum) == 0)) {
     728             && ((ntohs (tp->pkbuf.tftpACK.blocknum) == 0)
     729              || (ntohs (tp->pkbuf.tftpACK.blocknum) == 1))) {
    729730                tp->nused = 0;
    730                 tp->blocknum = 1;
     731                tp->blocknum = ntohs (tp->pkbuf.tftpACK.blocknum);
    731732                break;
    732733            }
     
    880881#ifdef RTEMS_TFTP_DRIVER_DEBUG
    881882        if (rtems_tftp_driver_debug)
    882             printf ("TFTP: SEND %d\n", tp->blocknum);
     883            printf ("TFTP: SEND %d (%d)\n", tp->blocknum, tp->nused);
    883884#endif
    884885        if (sendto (tp->socket, (char *)&tp->pkbuf, wlen, 0,
     
    887888            return EIO;
    888889        rlen = getPacket (tp, retryCount);
     890        /*
     891         * Our last packet won't necessarily be acknowledged!
     892         */
     893        if ((rlen < 0) && (tp->nused < sizeof tp->pkbuf.tftpDATA.data))
     894                return 0;
    889895        if (rlen >= (int)sizeof tp->pkbuf.tftpACK) {
    890896            int opcode = ntohs (tp->pkbuf.tftpACK.opcode);
    891897            if ((opcode == TFTP_OPCODE_ACK)
    892              && (ntohs (tp->pkbuf.tftpACK.blocknum) == tp->blocknum)) {
     898             && (ntohs (tp->pkbuf.tftpACK.blocknum) == (tp->blocknum + 1))) {
    893899                tp->nused = 0;
    894900                tp->blocknum++;
     
    9941000)
    9951001{
    996     if (pathloc->node_access == NULL)
     1002    if ((pathloc->node_access == NULL)
     1003     || (pathloc->node_access == ROOT_NODE_ACCESS))
    9971004        return RTEMS_FILESYSTEM_MEMORY_FILE;
    9981005    return RTEMS_FILESYSTEM_DIRECTORY;
  • cpukit/libnetworking/ChangeLog

    r85ca769 r86d9ca2  
     12001-12-07      Eric Norum <eric.norum@usask.ca>
     2
     3        * lib/tftpDriver.c: Restore write capability.
     4
    152001-11-26      Ralf Corsepius <corsepiu@faw.uni-ulm.de>
    26
  • cpukit/libnetworking/lib/tftpDriver.c

    r85ca769 r86d9ca2  
    379379        }
    380380        else {
    381             printf ("TFTP: %d0-byte packet\n", len);
     381            printf ("TFTP: %d-byte packet\n", len);
    382382        }
    383383    }
     
    726726            if (tp->writing
    727727             && (opcode == TFTP_OPCODE_ACK)
    728              && (ntohs (tp->pkbuf.tftpACK.blocknum) == 0)) {
     728             && ((ntohs (tp->pkbuf.tftpACK.blocknum) == 0)
     729              || (ntohs (tp->pkbuf.tftpACK.blocknum) == 1))) {
    729730                tp->nused = 0;
    730                 tp->blocknum = 1;
     731                tp->blocknum = ntohs (tp->pkbuf.tftpACK.blocknum);
    731732                break;
    732733            }
     
    880881#ifdef RTEMS_TFTP_DRIVER_DEBUG
    881882        if (rtems_tftp_driver_debug)
    882             printf ("TFTP: SEND %d\n", tp->blocknum);
     883            printf ("TFTP: SEND %d (%d)\n", tp->blocknum, tp->nused);
    883884#endif
    884885        if (sendto (tp->socket, (char *)&tp->pkbuf, wlen, 0,
     
    887888            return EIO;
    888889        rlen = getPacket (tp, retryCount);
     890        /*
     891         * Our last packet won't necessarily be acknowledged!
     892         */
     893        if ((rlen < 0) && (tp->nused < sizeof tp->pkbuf.tftpDATA.data))
     894                return 0;
    889895        if (rlen >= (int)sizeof tp->pkbuf.tftpACK) {
    890896            int opcode = ntohs (tp->pkbuf.tftpACK.opcode);
    891897            if ((opcode == TFTP_OPCODE_ACK)
    892              && (ntohs (tp->pkbuf.tftpACK.blocknum) == tp->blocknum)) {
     898             && (ntohs (tp->pkbuf.tftpACK.blocknum) == (tp->blocknum + 1))) {
    893899                tp->nused = 0;
    894900                tp->blocknum++;
     
    9941000)
    9951001{
    996     if (pathloc->node_access == NULL)
     1002    if ((pathloc->node_access == NULL)
     1003     || (pathloc->node_access == ROOT_NODE_ACCESS))
    9971004        return RTEMS_FILESYSTEM_MEMORY_FILE;
    9981005    return RTEMS_FILESYSTEM_DIRECTORY;
Note: See TracChangeset for help on using the changeset viewer.