VirtualBox

Changeset 47947 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Aug 21, 2013 8:10:55 AM (11 years ago)
Author:
vboxsync
Message:

lwip-nat: fix return code (and errno) for inet_pton

inet_pton(3) returns 1 on success (network address was successfully converted). 0 is returned if src does not contain a character string representing a valid network address in the specified address family. If af does not contain a valid address family, -1 is returned and errno is set to EAFNOSUPPORT(value 97). WSA has value most close in our case:

http://msdn.microsoft.com/en-us/library/windows/desktop/ms740668(v=vs.85).aspx#WSAEAFNOSUPPORT (10047)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Network/lwip-new/vbox/winutils.h

    r47886 r47947  
    3636#  define inet_ntop(dom, pvaddr, pstrbuf, cbstrbuf) InetNtop((dom),(pvaddr),(pstrbuf),(cbstrbuf))
    3737
     38/**
     39 * inet_pton(3) returns 1 on success (network address was successfully
     40 * converted).  0 is returned if src does not contain a character string
     41 * representing a valid network address in the specified address family.
     42 * If af does not contain a valid address family, -1 is returned and
     43 * errno is set to EAFNOSUPPORT(value 97).
     44 * WSA has value most close in our case
     45 * http://msdn.microsoft.com/en-us/library/windows/desktop/ms740668(v=vs.85).aspx#WSAEAFNOSUPPORT (10047)
     46 */
    3847DECLINLINE(int) inet_pton(int af_family, const char *str, void *dst)
    3948{
    40     AssertPtrReturn(str, -1);
    41     AssertPtrReturn(dst, -1);
     49    AssertPtrReturn(str, 0);
     50    AssertPtrReturn(dst, 0);
    4251   
    4352    switch (af_family) {
     
    5665      memcpy(dst, &a6, sizeof(RTNETADDRIPV6));
    5766#else
    58       /* RTNetStrToIPv6Addr isn't implemented yet. */
     67      /* XXX: RTNetStrToIPv6Addr isn't implemented yet. */
     68      WSASetLastError(WSAEAFNOSUPPORT);
    5969      return -1;
    6070#endif
     
    6272    }
    6373    default:
     74      WSASetLastError(WSAEAFNOSUPPORT);
    6475      AssertMsgFailedReturn(("Unsupported internet family"), -1);
    6576    }
    66     return 0;
     77    return 1;
    6778}
    6879
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