VirtualBox

Changeset 17217 in vbox for trunk


Ignore:
Timestamp:
Feb 27, 2009 5:13:14 PM (16 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
43524
Message:

make VBOX_WITH_NETFLT= compile on Linux hosts again

Location:
trunk/src/VBox
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/include/VBoxVMSettingsNetwork.h

    r16927 r17217  
    7171    void naTypeChanged (const QString &aString);
    7272    void genMACClicked();
    73 #if defined (Q_WS_X11) && !defined (VBOX_WITH_NETFLT)
    74     void tapSetupClicked();
    75     void tapTerminateClicked();
    76 #endif
    7773
    7874private:
  • trunk/src/VBox/Frontends/VirtualBox/src/VBoxVMSettingsNetwork.cpp

    r17115 r17217  
    6666#if !defined (Q_WS_X11) || defined (VBOX_WITH_NETFLT)
    6767    setTapVisible (false);
    68 #else
    69     /* Setup iconsets */
    70     mTbSetup_x11->setIcon (VBoxGlobal::iconSet (":/select_file_16px.png",
    71                                                 ":/select_file_dis_16px.png"));
    72     mTbTerminate_x11->setIcon (VBoxGlobal::iconSet (":/select_file_16px.png",
    73                                                     ":/select_file_dis_16px.png"));
    7468#endif
    7569
     
    116110#if defined (Q_WS_X11) && !defined (VBOX_WITH_NETFLT)
    117111    mLeInterface_x11->setText (aAdapter.GetHostInterface());
    118     mLeSetup_x11->setText (aAdapter.GetTAPSetupApplication());
    119     mLeTerminate_x11->setText (aAdapter.GetTAPTerminateApplication());
    120112#endif
    121113}
     
    168160        QString iface = mLeInterface_x11->text();
    169161        mAdapter.SetHostInterface (iface.isEmpty() ? QString::null : iface);
    170         QString setup = mLeSetup_x11->text();
    171         mAdapter.SetTAPSetupApplication (setup.isEmpty() ? QString::null : setup);
    172         QString term = mLeTerminate_x11->text();
    173         mAdapter.SetTAPTerminateApplication (term.isEmpty() ? QString::null : term);
    174162#endif
    175163    }
     
    200188             mValidator, SLOT (revalidate()));
    201189    connect (mPbMAC, SIGNAL (clicked()), this, SLOT (genMACClicked()));
    202 #if defined (Q_WS_X11) && !defined (VBOX_WITH_NETFLT)
    203     connect (mTbSetup_x11, SIGNAL (clicked()), this, SLOT (tapSetupClicked()));
    204     connect (mTbTerminate_x11, SIGNAL (clicked()), this, SLOT (tapTerminateClicked()));
    205 #endif
    206190
    207191    mValidator->revalidate();
     
    218202    setTabOrder (mPbMAC, mCbCable);
    219203    setTabOrder (mCbCable, mLeInterface_x11);
    220     setTabOrder (mLeInterface_x11, mLeSetup_x11);
    221     setTabOrder (mLeSetup_x11, mTbSetup_x11);
    222     setTabOrder (mTbSetup_x11, mLeTerminate_x11);
    223     setTabOrder (mLeTerminate_x11, mTbTerminate_x11);
    224     return mTbTerminate_x11;
     204    return mLeInterface_x11;
    225205}
    226206
     
    289269    mLeMAC->setText (mAdapter.GetMACAddress());
    290270}
    291 
    292 #if defined (Q_WS_X11) && !defined (VBOX_WITH_NETFLT)
    293 void VBoxVMSettingsNetwork::tapSetupClicked()
    294 {
    295     QString selected = QFileDialog::getOpenFileName (
    296         this, tr ("Select TAP setup application"), "/");
    297 
    298     if (!selected.isEmpty())
    299         mLeSetup_x11->setText (selected);
    300 }
    301 
    302 void VBoxVMSettingsNetwork::tapTerminateClicked()
    303 {
    304     QString selected = QFileDialog::getOpenFileName (
    305         this, tr ("Select TAP terminate application"), "/");
    306 
    307     if (!selected.isEmpty())
    308         mLeTerminate_x11->setText (selected);
    309 }
    310 #endif
    311271
    312272void VBoxVMSettingsNetwork::prepareComboboxes()
     
    374334    mLbInterface_x11->setEnabled (aEnabled);
    375335    mLeInterface_x11->setEnabled (aEnabled);
    376     mLbSetup_x11->setEnabled (aEnabled);
    377     mLeSetup_x11->setEnabled (aEnabled);
    378     mTbSetup_x11->setEnabled (aEnabled);
    379     mLbTerminate_x11->setEnabled (aEnabled);
    380     mLeTerminate_x11->setEnabled (aEnabled);
    381     mTbTerminate_x11->setEnabled (aEnabled);
    382336}
    383337
     
    387341    mLbInterface_x11->setVisible (aVisible);
    388342    mLeInterface_x11->setVisible (aVisible);
    389     mLbSetup_x11->setVisible (aVisible);
    390     mLeSetup_x11->setVisible (aVisible);
    391     mTbSetup_x11->setVisible (aVisible);
    392     mLbTerminate_x11->setVisible (aVisible);
    393     mLeTerminate_x11->setVisible (aVisible);
    394     mTbTerminate_x11->setVisible (aVisible);
    395343#ifdef Q_WS_MAC
    396344    /* Make sure the layout is recalculated (Important on the mac). */
  • trunk/src/VBox/Frontends/VirtualBox/ui/VBoxVMSettingsNetwork.ui

    r12030 r17217  
    217217       </widget>
    218218      </item>
    219       <item row="7" column="0" >
    220        <widget class="QLabel" name="mLbSetup_x11" >
    221         <property name="text" >
    222          <string>&amp;Setup Application:</string>
    223         </property>
    224         <property name="alignment" >
    225          <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
    226         </property>
    227         <property name="buddy" >
    228          <cstring>mLeSetup_x11</cstring>
    229         </property>
    230        </widget>
    231       </item>
    232       <item row="7" column="1" >
    233        <widget class="QLineEdit" name="mLeSetup_x11" >
    234         <property name="sizePolicy" >
    235          <sizepolicy vsizetype="Fixed" hsizetype="Preferred" >
    236           <horstretch>0</horstretch>
    237           <verstretch>0</verstretch>
    238          </sizepolicy>
    239         </property>
    240         <property name="whatsThis" >
    241          <string>Displays the command executed to set up the TAP interface.</string>
    242         </property>
    243        </widget>
    244       </item>
    245       <item row="7" column="2" >
    246        <widget class="QToolButton" name="mTbSetup_x11" >
    247         <property name="whatsThis" >
    248          <string>Selects the setup application.</string>
    249         </property>
    250         <property name="autoRaise" >
    251          <bool>true</bool>
    252         </property>
    253        </widget>
    254       </item>
    255       <item row="8" column="0" >
    256        <widget class="QLabel" name="mLbTerminate_x11" >
    257         <property name="text" >
    258          <string>&amp;Terminate Application:</string>
    259         </property>
    260         <property name="alignment" >
    261          <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
    262         </property>
    263         <property name="buddy" >
    264          <cstring>mLeTerminate_x11</cstring>
    265         </property>
    266        </widget>
    267       </item>
    268       <item row="8" column="1" >
    269        <widget class="QLineEdit" name="mLeTerminate_x11" >
    270         <property name="sizePolicy" >
    271          <sizepolicy vsizetype="Fixed" hsizetype="Preferred" >
    272           <horstretch>0</horstretch>
    273           <verstretch>0</verstretch>
    274          </sizepolicy>
    275         </property>
    276         <property name="whatsThis" >
    277          <string>Displays the command executed to terminate the TAP interface.</string>
    278         </property>
    279        </widget>
    280       </item>
    281       <item row="8" column="2" >
    282        <widget class="QToolButton" name="mTbTerminate_x11" >
    283         <property name="whatsThis" >
    284          <string>Selects the terminate application.</string>
    285         </property>
    286         <property name="autoRaise" >
    287          <bool>true</bool>
    288         </property>
    289        </widget>
    290       </item>
    291219     </layout>
    292220    </widget>
  • trunk/src/VBox/Main/ConsoleImpl.cpp

    r16966 r17217  
    56485648#endif /* VBOX_WITH_USB */
    56495649
    5650 /**
    5651   * Call the initialisation script for a dynamic TAP interface.
    5652   *
    5653   * The initialisation script should create a TAP interface, set it up and write its name to
    5654   * standard output followed by a carriage return.  Anything further written to standard
    5655   * output will be ignored.  If it returns a non-zero exit code, or does not write an
    5656   * intelligible interface name to standard output, it will be treated as having failed.
    5657   * For now, this method only works on Linux.
    5658   *
    5659   * @returns COM status code
    5660   * @param   tapDevice           string to store the name of the tap device created to
    5661   * @param   tapSetupApplication the name of the setup script
    5662   */
    5663 HRESULT Console::callTapSetupApplication(bool isStatic, RTFILE tapFD, Bstr &tapDevice,
    5664                                          Bstr &tapSetupApplication)
    5665 {
    5666     LogFlowThisFunc(("\n"));
    5667 #ifdef RT_OS_LINUX
    5668     /* Command line to start the script with. */
    5669     char szCommand[4096];
    5670     /* Result code */
    5671     int rc;
    5672 
    5673     /* Get the script name. */
    5674     Utf8Str tapSetupAppUtf8(tapSetupApplication), tapDeviceUtf8(tapDevice);
    5675     RTStrPrintf(szCommand, sizeof(szCommand), "%s %d %s", tapSetupAppUtf8.raw(),
    5676                 isStatic ? tapFD : 0, isStatic ? tapDeviceUtf8.raw() : "");
    5677     /*
    5678      * Create the process and read its output.
    5679      */
    5680     Log2(("About to start the TAP setup script with the following command line: %s\n",
    5681           szCommand));
    5682     FILE *pfScriptHandle = popen(szCommand, "r");
    5683     if (pfScriptHandle == 0)
    5684     {
    5685         int iErr = errno;
    5686         LogRel(("Failed to start the TAP interface setup script %s, error text: %s\n",
    5687               szCommand, strerror(iErr)));
    5688         LogFlowThisFunc(("rc=E_FAIL\n"));
    5689         return setError(E_FAIL, tr ("Failed to run the host networking set up command %s: %s"),
    5690                         szCommand, strerror(iErr));
    5691     }
    5692     /* If we are using a dynamic TAP interface, we need to get the interface name. */
    5693     if (!isStatic)
    5694     {
    5695         /* Buffer to read the application output to.  It doesn't have to be long, as we are only
    5696             interested in the first few (normally 5 or 6) bytes. */
    5697         char acBuffer[64];
    5698         /* The length of the string returned by the application.  We only accept strings of 63
    5699            characters or less. */
    5700         size_t cBufSize;
    5701 
    5702         /* Read the name of the device from the application. */
    5703         fgets(acBuffer, sizeof(acBuffer), pfScriptHandle);
    5704         cBufSize = strlen(acBuffer);
    5705         /* The script must return the name of the interface followed by a carriage return as the
    5706           first line of its output.  We need a null-terminated string. */
    5707         if ((cBufSize < 2) || (acBuffer[cBufSize - 1] != '\n'))
    5708         {
    5709             pclose(pfScriptHandle);
    5710             LogRel(("The TAP interface setup script did not return the name of a TAP device.\n"));
    5711             LogFlowThisFunc(("rc=E_FAIL\n"));
    5712             return setError(E_FAIL, tr ("The host networking set up command did not supply an interface name"));
    5713         }
    5714         /* Overwrite the terminating newline character. */
    5715         acBuffer[cBufSize - 1] = 0;
    5716         tapDevice = acBuffer;
    5717     }
    5718     rc = pclose(pfScriptHandle);
    5719     if (!WIFEXITED(rc))
    5720     {
    5721         LogRel(("The TAP interface setup script terminated abnormally.\n"));
    5722         LogFlowThisFunc(("rc=E_FAIL\n"));
    5723         return setError(E_FAIL, tr ("The host networking set up command did not run correctly"));
    5724     }
    5725     if (WEXITSTATUS(rc) != 0)
    5726     {
    5727         LogRel(("The TAP interface setup script returned a non-zero exit code.\n"));
    5728         LogFlowThisFunc(("rc=E_FAIL\n"));
    5729         return setError(E_FAIL, tr ("The host networking set up command returned a non-zero exit code"));
    5730     }
    5731     LogFlowThisFunc(("rc=S_OK\n"));
    5732     return S_OK;
    5733 #else /* RT_OS_LINUX not defined */
    5734     LogFlowThisFunc(("rc=E_NOTIMPL\n"));
    5735     ReturnComNotImplemented();  /* not yet supported */
    5736 #endif
    5737 }
    57385650
    57395651/**
     
    57575669    return S_OK;
    57585670
    5759 #else /* RT_OS_LINUX */
     5671#else /* RT_OS_LINUX && !VBOX_WITH_NETFLT */
     5672
    57605673    LogFlowThisFunc(("\n"));
    57615674    /* sanity check */
     
    57765689
    57775690    /*
    5778      * Try get the FD.
     5691     * Allocate a host interface device
    57795692     */
    5780     LONG        ltapFD;
    5781     rc = networkAdapter->COMGETTER(TAPFileDescriptor)(&ltapFD);
    5782     if (SUCCEEDED(rc))
    5783         maTapFD[slot] = (RTFILE)ltapFD;
     5693    int rcVBox = RTFileOpen(&maTapFD[slot], "/dev/net/tun",
     5694                            RTFILE_O_READWRITE | RTFILE_O_OPEN | RTFILE_O_DENY_NONE | RTFILE_O_INHERIT);
     5695    if (VBOX_SUCCESS(rcVBox))
     5696    {
     5697        /*
     5698         * Set/obtain the tap interface.
     5699         */
     5700        struct ifreq IfReq;
     5701        memset(&IfReq, 0, sizeof(IfReq));
     5702        /* The name of the TAP interface we are using */
     5703        Bstr tapDeviceName;
     5704        rc = networkAdapter->COMGETTER(HostInterface)(tapDeviceName.asOutParam());
     5705        if (FAILED(rc))
     5706            tapDeviceName.setNull();  /* Is this necessary? */
     5707        if (tapDeviceName.isEmpty())
     5708        {
     5709            LogRel(("No TAP device name was supplied.\n"));
     5710            rc = setError(E_FAIL, tr ("No TAP device name was supplied for the host networking interface"));
     5711        }
     5712
     5713        if (SUCCEEDED(rc))
     5714        {
     5715            /* If we are using a static TAP device then try to open it. */
     5716            Utf8Str str(tapDeviceName);
     5717            if (str.length() <= sizeof(IfReq.ifr_name))
     5718                strcpy(IfReq.ifr_name, str.raw());
     5719            else
     5720                memcpy(IfReq.ifr_name, str.raw(), sizeof(IfReq.ifr_name) - 1); /** @todo bitch about names which are too long... */
     5721            IfReq.ifr_flags = IFF_TAP | IFF_NO_PI;
     5722            rcVBox = ioctl(maTapFD[slot], TUNSETIFF, &IfReq);
     5723            if (rcVBox != 0)
     5724            {
     5725                LogRel(("Failed to open the host network interface %ls\n", tapDeviceName.raw()));
     5726                rc = setError(E_FAIL, tr ("Failed to open the host network interface %ls"),
     5727                              tapDeviceName.raw());
     5728            }
     5729        }
     5730        if (SUCCEEDED(rc))
     5731        {
     5732            /*
     5733             * Make it pollable.
     5734             */
     5735            if (fcntl(maTapFD[slot], F_SETFL, O_NONBLOCK) != -1)
     5736            {
     5737                Log(("attachToHostInterface: %RTfile %ls\n", maTapFD[slot], tapDeviceName.raw()));
     5738                /*
     5739                 * Here is the right place to communicate the TAP file descriptor and
     5740                 * the host interface name to the server if/when it becomes really
     5741                 * necessary.
     5742                 */
     5743                maTAPDeviceName[slot] = tapDeviceName;
     5744                rcVBox = VINF_SUCCESS;
     5745            }
     5746            else
     5747            {
     5748                int iErr = errno;
     5749
     5750                LogRel(("Configuration error: Failed to configure /dev/net/tun non blocking. Error: %s\n", strerror(iErr)));
     5751                rcVBox = VERR_HOSTIF_BLOCKING;
     5752                rc = setError(E_FAIL, tr ("could not set up the host networking device for non blocking access: %s"),
     5753                                          strerror(errno));
     5754            }
     5755        }
     5756    }
    57845757    else
    5785         maTapFD[slot] = NIL_RTFILE;
    5786 
    5787     /*
    5788      * Are we supposed to use an existing TAP interface?
    5789      */
    5790     if (maTapFD[slot] != NIL_RTFILE)
    5791     {
    5792         /* nothing to do */
    5793         Assert(ltapFD >= 0);
    5794         Assert((LONG)maTapFD[slot] == ltapFD);
    5795         rc = S_OK;
    5796     }
    5797     else
    5798     {
    5799         /*
    5800          * Allocate a host interface device
    5801          */
    5802         int rcVBox = RTFileOpen(&maTapFD[slot], "/dev/net/tun",
    5803                                 RTFILE_O_READWRITE | RTFILE_O_OPEN | RTFILE_O_DENY_NONE | RTFILE_O_INHERIT);
    5804         if (VBOX_SUCCESS(rcVBox))
    5805         {
    5806             /*
    5807              * Set/obtain the tap interface.
    5808              */
    5809             bool isStatic = false;
    5810             struct ifreq IfReq;
    5811             memset(&IfReq, 0, sizeof(IfReq));
    5812             /* The name of the TAP interface we are using and the TAP setup script resp. */
    5813             Bstr tapDeviceName, tapSetupApplication;
    5814             rc = networkAdapter->COMGETTER(HostInterface)(tapDeviceName.asOutParam());
    5815             if (FAILED(rc))
    5816             {
    5817                 tapDeviceName.setNull();  /* Is this necessary? */
    5818             }
    5819             else if (!tapDeviceName.isEmpty())
    5820             {
    5821                 isStatic = true;
    5822                 /* If we are using a static TAP device then try to open it. */
    5823                 Utf8Str str(tapDeviceName);
    5824                 if (str.length() <= sizeof(IfReq.ifr_name))
    5825                     strcpy(IfReq.ifr_name, str.raw());
    5826                 else
    5827                     memcpy(IfReq.ifr_name, str.raw(), sizeof(IfReq.ifr_name) - 1); /** @todo bitch about names which are too long... */
    5828                 IfReq.ifr_flags = IFF_TAP | IFF_NO_PI;
    5829                 rcVBox = ioctl(maTapFD[slot], TUNSETIFF, &IfReq);
    5830                 if (rcVBox != 0)
    5831                 {
    5832                     LogRel(("Failed to open the host network interface %ls\n", tapDeviceName.raw()));
    5833                     rc = setError(E_FAIL, tr ("Failed to open the host network interface %ls"),
    5834                                           tapDeviceName.raw());
    5835                 }
    5836             }
    5837             if (SUCCEEDED(rc))
    5838             {
    5839                 networkAdapter->COMGETTER(TAPSetupApplication)(tapSetupApplication.asOutParam());
    5840                 if (tapSetupApplication.isEmpty())
    5841                 {
    5842                     if (tapDeviceName.isEmpty())
    5843                     {
    5844                         LogRel(("No setup application was supplied for the TAP interface.\n"));
    5845                         rc = setError(E_FAIL, tr ("No setup application was supplied for the host networking interface"));
    5846                     }
    5847                 }
    5848                 else
    5849                 {
    5850                     rc = callTapSetupApplication(isStatic, maTapFD[slot], tapDeviceName,
    5851                                                  tapSetupApplication);
    5852                 }
    5853             }
    5854             if (SUCCEEDED(rc))
    5855             {
    5856                 if (!isStatic)
    5857                 {
    5858                     Utf8Str str(tapDeviceName);
    5859                     if (str.length() <= sizeof(IfReq.ifr_name))
    5860                         strcpy(IfReq.ifr_name, str.raw());
    5861                     else
    5862                         memcpy(IfReq.ifr_name, str.raw(), sizeof(IfReq.ifr_name) - 1); /** @todo bitch about names which are too long... */
    5863                     IfReq.ifr_flags = IFF_TAP | IFF_NO_PI;
    5864                     rcVBox = ioctl(maTapFD[slot], TUNSETIFF, &IfReq);
    5865                     if (rcVBox != 0)
    5866                     {
    5867                         LogRel(("Failed to open the host network interface %ls returned by the setup script", tapDeviceName.raw()));
    5868                         rc = setError(E_FAIL, tr ("Failed to open the host network interface %ls returned by the setup script"), tapDeviceName.raw());
    5869                     }
    5870                 }
    5871                 if (SUCCEEDED(rc))
    5872                 {
    5873                     /*
    5874                     * Make it pollable.
    5875                     */
    5876                     if (fcntl(maTapFD[slot], F_SETFL, O_NONBLOCK) != -1)
    5877                     {
    5878                         Log(("attachToHostInterface: %RTfile %ls\n", maTapFD[slot], tapDeviceName.raw()));
    5879 
    5880                         /*
    5881                         * Here is the right place to communicate the TAP file descriptor and
    5882                         * the host interface name to the server if/when it becomes really
    5883                         * necessary.
    5884                         */
    5885                         maTAPDeviceName[slot] = tapDeviceName;
    5886                         rcVBox = VINF_SUCCESS;
    5887                     }
    5888                     else
    5889                     {
    5890                         int iErr = errno;
    5891 
    5892                         LogRel(("Configuration error: Failed to configure /dev/net/tun non blocking. Error: %s\n", strerror(iErr)));
    5893                         rcVBox = VERR_HOSTIF_BLOCKING;
    5894                         rc = setError(E_FAIL, tr ("could not set up the host networking device for non blocking access: %s"),
    5895                                               strerror(errno));
    5896                     }
    5897                 }
    5898             }
    5899         }
    5900         else
    5901         {
    5902             LogRel(("Configuration error: Failed to open /dev/net/tun rc=%Rrc\n", rcVBox));
    5903             switch (rcVBox)
    5904             {
    5905                 case VERR_ACCESS_DENIED:
    5906                     /* will be handled by our caller */
    5907                     rc = rcVBox;
    5908                     break;
    5909                 default:
    5910                     rc = setError(E_FAIL, tr ("Could not set up the host networking device: %Rrc"), rcVBox);
    5911                     break;
    5912             }
    5913         }
    5914         /* in case of failure, cleanup. */
    5915         if (VBOX_FAILURE(rcVBox) && SUCCEEDED(rc))
    5916         {
    5917             LogRel(("General failure attaching to host interface\n"));
    5918             rc = setError(E_FAIL, tr ("General failure attaching to host interface"));
    5919         }
     5758    {
     5759        LogRel(("Configuration error: Failed to open /dev/net/tun rc=%Rrc\n", rcVBox));
     5760        switch (rcVBox)
     5761        {
     5762            case VERR_ACCESS_DENIED:
     5763                /* will be handled by our caller */
     5764                rc = rcVBox;
     5765                break;
     5766            default:
     5767                rc = setError(E_FAIL, tr ("Could not set up the host networking device: %Rrc"), rcVBox);
     5768                break;
     5769        }
     5770    }
     5771    /* in case of failure, cleanup. */
     5772    if (VBOX_FAILURE(rcVBox) && SUCCEEDED(rc))
     5773    {
     5774        LogRel(("General failure attaching to host interface\n"));
     5775        rc = setError(E_FAIL, tr ("General failure attaching to host interface"));
    59205776    }
    59215777    LogFlowThisFunc(("rc=%d\n", rc));
     
    59785834            maTapFD[slot] = NIL_RTFILE;
    59795835        }
    5980         /*
    5981          * Execute the termination command.
    5982          */
    5983         networkAdapter->COMGETTER(TAPTerminateApplication)(tapTerminateApplication.asOutParam());
    5984         if (tapTerminateApplication)
    5985         {
    5986             /* Get the program name. */
    5987             Utf8Str tapTermAppUtf8(tapTerminateApplication);
    5988 
    5989             /* Build the command line. */
    5990             char szCommand[4096];
    5991             RTStrPrintf(szCommand, sizeof(szCommand), "%s %d %s", tapTermAppUtf8.raw(),
    5992                         isStatic ? maTapFD[slot] : 0, maTAPDeviceName[slot].raw());
    5993             /** @todo check for overflow or use RTStrAPrintf! */
    5994 
    5995             /*
    5996              * Create the process and wait for it to complete.
    5997              */
    5998             Log(("Calling the termination command: %s\n", szCommand));
    5999             int rcCommand = system(szCommand);
    6000             if (rcCommand == -1)
    6001             {
    6002                 LogRel(("Failed to execute the clean up script for the TAP interface"));
    6003                 rc = setError(E_FAIL, tr ("Failed to execute the clean up script for the TAP interface"));
    6004             }
    6005             if (!WIFEXITED(rc))
    6006             {
    6007                 LogRel(("The TAP interface clean up script terminated abnormally.\n"));
    6008                 rc = setError(E_FAIL, tr ("The TAP interface clean up script terminated abnormally"));
    6009             }
    6010             if (WEXITSTATUS(rc) != 0)
    6011             {
    6012                 LogRel(("The TAP interface clean up script returned a non-zero exit code.\n"));
    6013                 rc = setError(E_FAIL, tr ("The TAP interface clean up script returned a non-zero exit code"));
    6014             }
    6015         }
    6016 
    60175836        if (isStatic)
    60185837        {
  • trunk/src/VBox/Main/ConsoleImpl2.cpp

    r17077 r17217  
    12941294                if (SUCCEEDED(hrc))
    12951295                {
    1296 #if defined(VBOX_WITH_NETFLT)
     1296#if !defined(VBOX_WITH_NETFLT) && defined(RT_OS_LINUX)
     1297                    Assert ((int)pConsole->maTapFD[ulInstance] >= 0);
     1298                    if ((int)pConsole->maTapFD[ulInstance] >= 0)
     1299                    {
     1300                        if (fSniffer)
     1301                        {
     1302                            rc = CFGMR3InsertNode(pLunL0, "AttachedDriver", &pLunL0); RC_CHECK();
     1303                        }
     1304                        else
     1305                        {
     1306                            rc = CFGMR3InsertNode(pInst, "LUN#0", &pLunL0);         RC_CHECK();
     1307                        }
     1308                        rc = CFGMR3InsertString(pLunL0, "Driver", "HostInterface"); RC_CHECK();
     1309                        rc = CFGMR3InsertNode(pLunL0, "Config", &pCfg);             RC_CHECK();
     1310                        rc = CFGMR3InsertInteger(pCfg, "FileHandle", pConsole->maTapFD[ulInstance]); RC_CHECK();
     1311                    }
     1312#elif defined(VBOX_WITH_NETFLT)
    12971313                    /*
    12981314                     * This is the new VBoxNetFlt+IntNet stuff.
  • trunk/src/VBox/Main/include/ConsoleImpl.h

    r16966 r17217  
    545545    PPDMLED     mapSharedFolderLed;
    546546    PPDMLED     mapUSBLed[2];
     547#if !defined(VBOX_WITH_NETFLT) && defined(RT_OS_LINUX)
     548    Utf8Str     maTAPDeviceName[8];
     549    RTFILE      maTapFD[8];
     550#endif
    547551
    548552    bool mVMStateChangeCallbackDisabled;
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