VirtualBox

Changeset 51597 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Jun 10, 2014 6:35:32 PM (11 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
94321
Message:

NAT/Net: convert perror/warn/warnx to DPRINTFs.

Location:
trunk/src/VBox/NetworkServices/NAT
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/NetworkServices/NAT/fwtcp.c

    r51576 r51597  
    144144    lsock = proxy_bound_socket(fwspec->sdom, fwspec->stype, &fwspec->src.sa);
    145145    if (lsock == INVALID_SOCKET) {
    146         perror("socket");
    147146        return NULL;
    148147    }
  • trunk/src/VBox/NetworkServices/NAT/fwudp.c

    r51574 r51597  
    171171    sock = proxy_bound_socket(fwspec->sdom, fwspec->stype, &fwspec->src.sa);
    172172    if (sock == INVALID_SOCKET) {
    173         perror("socket");
    174173        return NULL;
    175174    }
     
    267266                     (struct sockaddr *)&ss, &sslen);
    268267    if (nread < 0) {
    269         perror(__func__);
     268        DPRINTF(("%s: %R[sockerr]\n", __func__, SOCKERRNO()));
    270269        return POLLIN;
    271270    }
  • trunk/src/VBox/NetworkServices/NAT/proxy.c

    r51594 r51597  
    298298    s = socket(sdom, stype_and_flags, 0);
    299299    if (s == INVALID_SOCKET) {
    300         perror("socket");
     300        DPRINTF(("socket: %R[sockerr]\n", SOCKERRNO()));
    301301        return INVALID_SOCKET;
    302302    }
     
    308308        sflags = fcntl(s, F_GETFL, 0);
    309309        if (sflags < 0) {
    310             perror("F_GETFL");
     310            DPRINTF(("F_GETFL: %R[sockerr]\n", SOCKERRNO()));
    311311            closesocket(s);
    312312            return INVALID_SOCKET;
     
    315315        status = fcntl(s, F_SETFL, sflags | O_NONBLOCK);
    316316        if (status < 0) {
    317             perror("O_NONBLOCK");
     317            DPRINTF(("O_NONBLOCK: %R[sockerr]\n", SOCKERRNO()));
    318318            closesocket(s);
    319319            return INVALID_SOCKET;
     
    329329        status = setsockopt(s, SOL_SOCKET, SO_NOSIGPIPE, &on, onlen);
    330330        if (status < 0) {
    331             perror("SO_NOSIGPIPE");
     331            DPRINTF(("SO_NOSIGPIPE: %R[sockerr]\n", SOCKERRNO()));
    332332            closesocket(s);
    333333            return INVALID_SOCKET;
     
    341341        status = ioctlsocket(s, FIONBIO, &mode);
    342342        if (status == SOCKET_ERROR) {
    343             warn("ioctl error: %d\n", WSAGetLastError());
     343            DPRINTF(("FIONBIO: %R[sockerr]\n", SOCKERRNO()));
    344344            closesocket(s);
    345345            return INVALID_SOCKET;
     
    471471    status = setsockopt(s, SOL_SOCKET, SO_REUSEADDR, (char *)&on, onlen);
    472472    if (status < 0) {           /* not good, but not fatal */
    473         warn("SO_REUSEADDR");
     473        DPRINTF(("SO_REUSEADDR: %R[sockerr]\n", SOCKERRNO()));
    474474    }
    475475
     
    479479                  : sizeof(struct sockaddr_in6));
    480480    if (status < 0) {
    481         perror("bind");
     481        DPRINTF(("bind: %R[sockerr]\n", SOCKERRNO()));
    482482        closesocket(s);
    483483        return INVALID_SOCKET;
     
    487487        status = listen(s, 5);
    488488        if (status < 0) {
    489             perror("listen");
     489            DPRINTF(("listen: %R[sockerr]\n", SOCKERRNO()));
    490490            closesocket(s);
    491491            return INVALID_SOCKET;
  • trunk/src/VBox/NetworkServices/NAT/proxy_pollmgr.c

    r51574 r51597  
    8383        status = socketpair(PF_LOCAL, SOCK_DGRAM, 0, pollmgr.chan[i]);
    8484        if (status < 0) {
    85             perror("socketpair");
     85            DPRINTF(("socketpair: %R[sockerr]\n", SOCKERRNO()));
    8686            goto cleanup_close;
    8787        }
    8888#else
    8989        status = RTWinSocketPair(PF_INET, SOCK_DGRAM, 0, pollmgr.chan[i]);
    90         AssertRCReturn(status, -1);
    91 
    9290        if (RT_FAILURE(status)) {
    93             perror("socketpair");
    9491            goto cleanup_close;
    9592        }
     
    104101        malloc(newcap * sizeof(*pollmgr.fds));
    105102    if (newfds == NULL) {
    106         perror("calloc");
     103        DPRINTF(("%s: Failed to allocate fds array\n", __func__));
    107104        goto cleanup_close;
    108105    }
     
    111108        malloc(newcap * sizeof(*pollmgr.handlers));
    112109    if (newhdls == NULL) {
    113         perror("malloc");
     110        DPRINTF(("%s: Failed to allocate handlers array\n", __func__));
    114111        free(newfds);
    115112        goto cleanup_close;
     
    180177            realloc(pollmgr.fds, newcap * sizeof(*pollmgr.fds));
    181178        if (newfds == NULL) {
    182             perror("realloc");
     179            DPRINTF(("%s: Failed to reallocate fds array\n", __func__));
    183180            handler->slot = -1;
    184181            return -1;
     
    191188            realloc(pollmgr.handlers, newcap * sizeof(*pollmgr.handlers));
    192189        if (newhdls == NULL) {
    193             perror("realloc");
     190            DPRINTF(("%s: Failed to reallocate handlers array\n", __func__));
    194191            /* if we failed to realloc here, then fds points to the
    195192             * new array, but we pretend we still has old capacity */
     
    242239    nsent = send(fd, buf, (int)nbytes, 0);
    243240    if (nsent == SOCKET_ERROR) {
    244         warn("send on chan %d", slot);
     241        DPRINTF(("send on chan %d: %R[sockerr]\n", slot, SOCKERRNO()));
    245242        return -1;
    246243    }
    247244    else if ((size_t)nsent != nbytes) {
    248         warnx("send on chan %d: datagram truncated to %u bytes",
    249               slot, (unsigned int)nsent);
     245        DPRINTF(("send on chan %d: datagram truncated to %u bytes",
     246                 slot, (unsigned int)nsent));
    250247        return -1;
    251248    }
  • trunk/src/VBox/NetworkServices/NAT/pxdns.c

    r51581 r51597  
    798798    nread = recv(fd, pollmgr_udpbuf, sizeof(pollmgr_udpbuf), 0);
    799799    if (nread < 0) {
    800         perror(__func__);
     800        DPRINTF(("%s: %R[sockerr]\n", __func__, SOCKERRNO()));
    801801        return POLLIN;
    802802    }
  • trunk/src/VBox/NetworkServices/NAT/pxping.c

    r51581 r51597  
    272272                                &dont, sizeof(dont));
    273273            if (status != 0) {
    274                 perror("IP_MTU_DISCOVER");
     274                DPRINTF(("IP_MTU_DISCOVER: %R[sockerr]\n", SOCKERRNO()));
    275275            }
    276276        }
     
    305305                            (const char *)&on, sizeof(on));
    306306        if (status < 0) {
    307             perror("IPV6_RECVPKTINFO");
     307            DPRINTF(("IPV6_RECVPKTINFO: %R[sockerr]\n", SOCKERRNO()));
    308308            /* XXX: for now this is fatal */
    309309        }
     
    315315                            (const char *)&on, sizeof(on));
    316316        if (status < 0) {
    317             perror("IPV6_RECVHOPLIMIT");
     317            DPRINTF(("IPV6_RECVHOPLIMIT: %R[sockerr]\n", SOCKERRNO()));
    318318        }
    319319
     
    495495        }
    496496        else {
    497             perror("IP_HDRINCL");
     497            DPRINTF(("IP_HDRINCL: %R[sockerr]\n", SOCKERRNO()));
    498498        }
    499499    }
     
    554554            }
    555555            else {
    556                 perror(dfoptname);
     556                DPRINTF(("%s: %R[sockerr]\n", dfoptname, SOCKERRNO()));
    557557            }
    558558        }
     
    566566            }
    567567            else {
    568                 perror("IP_TTL");
     568                DPRINTF(("IP_TTL: %R[sockerr]\n", SOCKERRNO()));
    569569            }
    570570        }
     
    578578            }
    579579            else {
    580                 perror("IP_TOS");
     580                DPRINTF(("IP_TOS: %R[sockerr]\n", SOCKERRNO()));
    581581            }
    582582        }
     
    711711        }
    712712        else {
    713             perror("IPV6_HOPLIMIT");
     713            DPRINTF(("IPV6_HOPLIMIT: %R[sockerr]\n", SOCKERRNO()));
    714714        }
    715715    }
     
    11231123                     (struct sockaddr *)&sin, &salen);
    11241124    if (nread < 0) {
    1125         perror(__func__);
     1125        DPRINTF(("%s: %R[sockerr]\n", __func__, SOCKERRNO()));
    11261126        return;
    11271127    }
     
    14841484    nread = recvmsg(pxping->sock6, &mh, 0);
    14851485    if (nread < 0) {
    1486         perror(__func__);
     1486        DPRINTF(("%s: %R[sockerr]\n", __func__, SOCKERRNO()));
    14871487        return;
    14881488    }
  • trunk/src/VBox/NetworkServices/NAT/pxudp.c

    r51581 r51597  
    579579    nread = recv(pxudp->sock, pollmgr_udpbuf, sizeof(pollmgr_udpbuf), 0);
    580580    if (nread == SOCKET_ERROR) {
    581         perror(__func__);
     581        DPRINTF(("%s: %R[sockerr]\n", __func__, SOCKERRNO()));
    582582        return POLLIN;
    583583    }
  • trunk/src/VBox/NetworkServices/NAT/winutils.h

    r51585 r51597  
    2222#  endif
    2323
    24 #  define warn(...) DPRINTF2((__VA_ARGS__))
    25 #  define warnx warn
    2624#  ifdef DEBUG
    2725#   define err(code,...) do { \
Note: See TracChangeset for help on using the changeset viewer.

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