VirtualBox

Ignore:
Timestamp:
Oct 7, 2021 9:27:26 PM (3 years ago)
Author:
vboxsync
Message:

NAT/tftp: ​bugref:9350 - Define symbolic constants for TFTP error
codes. Use them. Same object code is generated.

Location:
trunk/src/VBox/Devices/Network/slirp
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Network/slirp/tftp.c

    r91626 r91627  
    642642    if (RT_FAILURE(rc))
    643643    {
    644         tftpSendError(pData, pTftpSession, 2, "Option negotiation failure (file not found or inaccessible?)", pcTftpIpHeaderRecv);
     644        tftpSendError(pData, pTftpSession, TFTP_EACCESS, "Option negotiation failure (file not found or inaccessible?)", pcTftpIpHeaderRecv);
    645645        LogFlowFuncLeave();
    646646        return rc;
     
    728728    else
    729729    {
    730         tftpSendError(pData, pTftpSession, 6, "ACK is wrong", pcTftpIpHeaderRecv);
     730        tftpSendError(pData, pTftpSession, TFTP_EEXIST, "ACK is wrong", pcTftpIpHeaderRecv);
    731731        return -1;
    732732    }
     
    765765    {
    766766        m_freem(pData, m);
    767         tftpSendError(pData, pTftpSession, 1, "File not found", pcTftpIpHeaderRecv);
     767        tftpSendError(pData, pTftpSession, TFTP_ENOENT, "File not found", pcTftpIpHeaderRecv);
    768768        /* send "file not found" error back */
    769769        return -1;
     
    808808    if (RT_FAILURE(tftpSecurityFilenameCheck(pData, pTftpSession)))
    809809    {
    810         tftpSendError(pData, pTftpSession, 2, "Access violation", pTftpIpHeader);
     810        tftpSendError(pData, pTftpSession, TFTP_EACCESS, "Access violation", pTftpIpHeader);
    811811        LogFlowFuncLeave();
    812812        return;
     
    817817    if (RT_UNLIKELY(!tftpIsSupportedTransferMode(pTftpSession)))
    818818    {
    819         tftpSendError(pData, pTftpSession, 4, "Unsupported transfer mode", pTftpIpHeader);
     819        tftpSendError(pData, pTftpSession, TFTP_ENOSYS, "Unsupported transfer mode", pTftpIpHeader);
    820820        LogFlowFuncLeave();
    821821        return;
  • trunk/src/VBox/Devices/Network/slirp/tftp.h

    r82968 r91627  
    3232#define TFTP_OACK   6
    3333
     34/* error codes */
     35#define TFTP_EUNDEF     0 /* Not defined, see error message (if any). */
     36#define TFTP_ENOENT     1 /* File not found. */
     37#define TFTP_EACCESS    2 /* Access violation. */
     38#define TFTP_EFBIG      3 /* Disk full or allocation exceeded. */
     39#define TFTP_ENOSYS     4 /* Illegal TFTP operation. */
     40#define TFTP_ESRCH      5 /* Unknown transfer ID. */
     41#define TFTP_EEXIST     6 /* File already exists. */
     42#define TFTP_EUSER      7 /* No such user. */
     43/* RFC 2347 */
     44#define TFTP_EONAK      8 /* Option refused. */
     45
     46
    3447#define TFTP_FILENAME_MAX 512
    3548
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette