VirtualBox

Changeset 15138 in vbox for trunk/src/VBox/Devices/Network


Ignore:
Timestamp:
Dec 9, 2008 8:05:22 AM (16 years ago)
Author:
vboxsync
Message:

slirp: error handling; typos

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

Legend:

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

    r15136 r15138  
    7979#ifndef RT_OS_WINDOWS
    8080    pData->icmp_socket.s = socket(PF_INET, SOCK_RAW, IPPROTO_ICMP);
     81    if (pData->icmp_socket.s == -1)
     82    {
     83        int rc = RTErrConvertFromErrno(errno);
     84        LogRel(("NAT: ICMP/ping not available (could open ICMP socket, error %Rrc)\n", rc, rc));
     85        return 1;
     86    }
    8187    insque(pData, &pData->icmp_socket, &udb);
    8288#else /* RT_OS_WINDOWS */
     
    312318                if (status < 0)
    313319                {
    314                     LogRel(("error(%s) occured while setting TTL attribute of IP packet\n", strerror(errno)));
     320                    LogRel(("NAT: Error (%s) occurred while setting TTL attribute of IP packet\n", strerror(errno)));
    315321                }
    316322                if (sendto(pData->icmp_socket.s, icp, icmplen, 0,
     
    332338                {
    333339                    error = GetLastError();
    334                     LogRel(("error(%d) occured while sending ICMP (", error));
     340                    LogRel(("NAT: Error (%d) occurred while sending ICMP (", error));
    335341                    switch (error)
    336342                    {
  • trunk/src/VBox/Devices/Network/slirp/socket.c

    r15137 r15138  
    793793        icm = icmp_find_original_mbuf(pData, ip);
    794794       
    795         if (icm == NULL) {
    796             LogRel(("Can't find the corresponding packet for the received ICMP\n"));
     795        if (icm == NULL)
     796        {
     797            LogRel(("NAT: Can't find the corresponding packet for the received ICMP\n"));
    797798            return;
    798799        }
    799        
     800
    800801        m = icm->im_m;
    801802        Assert(m != NULL);
     
    846847        u_char code = ~0;
    847848        len = pData->pfIcmpParseReplies(pData->pvIcmpBuffer, pData->szIcmpBuffer);
    848         if (len <= 0) {
    849               LogRel(("Error (%d) occured on ICMP receiving \n", GetLastError())); 
     849        if (len <= 0)
     850        {
     851              LogRel(("NAT: Error (%d) occurred on ICMP receiving\n", GetLastError()));
    850852              return;
    851853        }
    852854        LogRel(("IcmpParseReplies returns %ld\n", len));
    853855        icr = (ICMP_ECHO_REPLY *)pData->pvIcmpBuffer;
    854         for (i = 0; i < len; ++i) {
     856        for (i = 0; i < len; ++i)
     857        {
    855858                switch(icr[i].Status)
    856859                {
     
    864867                        case IP_DEST_PORT_UNREACHABLE:
    865868                                code = (code != ~0 ? code : ICMP_UNREACH_PORT);
    866                                 icmp_error(pData, so->so_m, ICMP_UNREACH, code, 0, "Error occured!!!");
     869                                icmp_error(pData, so->so_m, ICMP_UNREACH, code, 0, "Error occurred!!!");
    867870                        break;
    868871                        case IP_SUCCESS: /* echo replied */
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