VirtualBox

Changeset 2396 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Apr 27, 2007 12:54:06 PM (18 years ago)
Author:
vboxsync
Message:

Fixes to Linux host networking and a manual update

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/ConsoleImpl.cpp

    r2393 r2396  
    56475647              pszArgs, strerror(iErr)));
    56485648        LogFlowThisFunc(("rc=E_FAIL\n"));
    5649         return setError(E_FAIL, "Failed to start the TAP interface setup script %s, error text: %s\n",
     5649        return setError(E_FAIL, tr ("Failed to run the host networking set up command %s: %s"),
    56505650                        pszArgs, strerror(iErr));
    56515651    }
     
    56595659        Log(("The TAP interface setup script did not return the name of a TAP device.\n"));
    56605660        LogFlowThisFunc(("rc=E_FAIL\n"));
    5661         return setError(E_FAIL, "The TAP interface setup script did not return the name of a TAP device.\n");
     5661        return setError(E_FAIL, tr ("The host networking set up command did not supply an interface name"));
    56625662    }
    56635663    acBuffer[cBufSize - 1] = 0;
     
    56685668        Log(("The TAP interface setup script terminated abnormally.\n"));
    56695669        LogFlowThisFunc(("rc=E_FAIL\n"));
    5670         return setError(E_FAIL, "The TAP interface setup script terminated abnormally.\n");
     5670        return setError(E_FAIL, tr ("The host networking set up command did not run correctly"));
    56715671    }
    56725672    if (WEXITSTATUS(rc) != 0)
     
    56745674        Log(("The TAP interface setup script returned a non-zero exit code.\n"));
    56755675        LogFlowThisFunc(("rc=E_FAIL\n"));
    5676         return setError(E_FAIL, "The TAP interface setup script returned a non-zero exit code.\n");
     5676        return setError(E_FAIL, tr ("The host networking set up command returned a non-zero exit code"));
    56775677    }
    56785678    LogFlowThisFunc(("rc=S_OK\n"));
     
    57605760                {
    57615761                    Log(("No setup application was supplied for the TAP interface.\n"));
    5762                     rc = setError(E_FAIL, "No setup application was supplied for the TAP interface.\n");
     5762                    rc = setError(E_FAIL, tr ("No setup application was supplied for the host networking interface"));
    57635763                }
    57645764                else
     
    58045804                        AssertMsgFailed(("Configuration error: Failed to configure /dev/net/tun non blocking. errno=%d\n", errno));
    58055805                        rcVBox = VERR_HOSTIF_BLOCKING;
    5806                         rc = setError(E_FAIL, "Failed to set /dev/net/tun to non blocking. errno=%d\n", errno);
     5806                        rc = setError(E_FAIL, tr ("could not set up the host networking device for non blocking access: %s"),
     5807                                              strerror(errno));
    58075808                    }
    58085809                }
     
    58115812                    AssertMsgFailed(("Configuration error: Failed to configure /dev/net/tun. errno=%d\n", errno));
    58125813                    rcVBox = VERR_HOSTIF_IOCTL;
    5813                     rc = setError(E_FAIL, "Failed to configure /dev/net/tun. errno = %d\n", errno);
     5814                    rc = setError(E_FAIL, tr ("Could not set up the host networking device: %s"),
     5815                                          strerror(errno));
    58145816                }
    58155817            }
     
    58255827                    break;
    58265828                default:
    5827                     rc = setError(E_FAIL, "Failed to open /dev/net/tun rc = %Vrc\n", rcVBox);
     5829                    rc = setError(E_FAIL, tr ("Could not set up the host networking device: %Vrc"), rcVBox);
    58285830                    break;
    58295831            }
     
    58465848    return rc;
    58475849}
    5848 
    5849 #if 0
    5850 /* Old code for this function. */
    5851 HRESULT Console::detachFromHostInterface(INetworkAdapter *networkAdapter)
    5852 {
    5853     /* sanity check */
    5854     AssertReturn (isLockedOnCurrentThread(), E_FAIL);
    5855 
    5856     HRESULT rc = S_OK;
    5857 #ifdef DEBUG
    5858     /* paranoia */
    5859     NetworkAttachmentType_T attachment;
    5860     networkAdapter->COMGETTER(AttachmentType)(&attachment);
    5861     Assert(attachment == NetworkAttachmentType_HostInterfaceNetworkAttachment);
    5862 #endif /* DEBUG */
    5863 
    5864 #ifdef VBOX_WITH_UNIXY_TAP_NETWORKING
    5865 
    5866     ULONG slot = 0;
    5867     rc = networkAdapter->COMGETTER(Slot)(&slot);
    5868     AssertComRC(rc);
    5869 
    5870     /* is there an open TAP device? */
    5871     if (maTapFD[slot] != NIL_RTFILE)
    5872     {
    5873         /*
    5874          * Execute term command and close the file handle.
    5875          */
    5876         Bstr tapTerminateApplication;
    5877         networkAdapter->COMGETTER(TAPTerminateApplication)(tapTerminateApplication.asOutParam());
    5878         if (tapTerminateApplication)
    5879         {
    5880             /*
    5881              * Create the argument list
    5882              */
    5883             const char *apszArgs[4];
    5884             /* 0. The program name. */
    5885             Utf8Str tapTermAppUtf8(tapTerminateApplication);
    5886             apszArgs[0] = tapTermAppUtf8.raw();
    5887 
    5888             /* 1. The file descriptor. */
    5889             char szFD[32];
    5890             RTStrPrintf(szFD, sizeof(szFD), "%RTfile", maTapFD[slot]);
    5891             apszArgs[1] = szFD;
    5892 
    5893             /* 2. Device name (optional). */
    5894             apszArgs[2] = maTAPDeviceName[slot].isEmpty() ? NULL : maTAPDeviceName[slot].raw();
    5895 
    5896             /* 3. The end. */
    5897             apszArgs[3] = NULL;
    5898 
    5899             /*
    5900              * Create the process and wait for it to complete.
    5901              */
    5902             RTPROCESS Process;
    5903             int rcVBox = RTProcCreate(apszArgs[0], &apszArgs[0], NULL, 0, &Process);
    5904             if (VBOX_SUCCESS(rcVBox))
    5905             {
    5906                 /* wait for the process to exit */
    5907                 RTPROCSTATUS ProcStatus;
    5908                 rcVBox = RTProcWait(Process, RTPROCWAIT_FLAGS_BLOCK, &ProcStatus);
    5909                 AssertRC(rcVBox);
    5910                 /* ignore return code? */
    5911             }
    5912             else
    5913                 AssertMsgFailed(("Configuration error: Failed to start terminate program \"%s\", rc=%Vra\n", apszArgs[0], rcVBox)); /** @todo last error candidate. */
    5914             if (VBOX_FAILURE(rcVBox))
    5915                 rc = E_FAIL;
    5916         }
    5917 
    5918         /*
    5919          * Now we can close the file handle.
    5920          */
    5921         int rcVBox = RTFileClose(maTapFD[slot]);
    5922         AssertRC(rcVBox);
    5923         /* the TAP device name and handle are no longer valid */
    5924         maTapFD[slot] = NIL_RTFILE;
    5925         maTAPDeviceName[slot] = "";
    5926     }
    5927 #endif
    5928     return rc;
    5929 }
    5930 #endif
    59315850
    59325851/**
     
    59785897            /* Build the command line. */
    59795898            char szCommand[4096];
    5980             RTStrPrintf(szCommand, sizeof(szCommand), "%s %RTfile %s", tapTermAppUtf8.raw(),
    5981                         maTapFD[slot],
     5899            RTStrPrintf(szCommand, sizeof(szCommand), "%s %s", tapTermAppUtf8.raw(),
    59825900                        maTAPDeviceName[slot].isEmpty() ? "" : maTAPDeviceName[slot].raw());
    59835901
     
    59955913            {
    59965914                Log(("The TAP interface clean up script terminated abnormally.\n"));
    5997                 rc = setError(E_FAIL, "The TAP interface clean up script terminated abnormally.\n");
     5915                rc = setError(E_FAIL, tr ("The TAP interface clean up script terminated abnormally"));
    59985916            }
    59995917            if (WEXITSTATUS(rc) != 0)
    60005918            {
    60015919                Log(("The TAP interface clean up script returned a non-zero exit code.\n"));
    6002                 rc = setError(E_FAIL, "The TAP interface clean up script returned a non-zero exit code.\n");
     5920                rc = setError(E_FAIL, tr ("The TAP interface clean up script returned a non-zero exit code"));
    60035921            }
    60045922        }
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