[vbox-dev] [PATCH] VirtualBox. vde_close was missing...

Klaus Espenlaub Klaus.Espenlaub at Sun.COM
Mon May 10 09:28:38 GMT 2010


Renzo Davoli wrote:
> I am investigating on the way to change the vde network at run time.
> 
> This patch adds the run-time close of a VDE connection, so it is a step
> towards the solution although it is not complete.
> 
> Here with this patch it is possible to change a VDE network at run
> time in this way:
> step 1- change the Network from vde to not attched and confirm (ok).
> step 2- change again the Network from not attached to the new switch.
> 
> I can't find where I can add a vde_close/vde_open when the user
> changes the switch (i.e. he/she writes a new value in the
> "Name" field). Any hint?

For each live network reconfiguration the driver level gets detached 
(which implies destruction of the driver), a new configuration is set 
up, and a new driver gets constructed and attached again to the 
appropriate networking device.

This means that all you need to do is handle drvVDEConstruct and 
drvVDEDestruct correctly. If this isn't triggered correctly then the 
VDE-specific API implementation bits are lacking code to handle dynamic 
reconfiguration which is present in all previously existing networking 
modes.

Klaus

> 
> 	renzo
> 
> The patch here enclosed has been released under the MIT license as follows:
> ------
> Copyright (c) 2010 Renzo Davoli, VirtualSquare Labs, University of Bologna
> <renzo at cs.unibo.it>
> 
> Permission is hereby granted, free of charge, to any person
> obtaining a copy of this software and associated documentation
> files (the "Software"), to deal in the Software without
> restriction, including without limitation the rights to use,
> copy, modify, merge, publish, distribute, sublicense, and/or sell
> copies of the Software, and to permit persons to whom the
> Software is furnished to do so, subject to the following
> conditions:
> 
> The above copyright notice and this permission notice shall be
> included in all copies or substantial portions of the Software.
> 
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
> EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
> OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
> NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
> HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
> WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
> FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
> OTHER DEALINGS IN THE SOFTWARE.
> ------
> Index: include/VBox/VDEPlugSymDefs.h
> ===================================================================
> --- include/VBox/VDEPlugSymDefs.h	(revision 29173)
> +++ include/VBox/VDEPlugSymDefs.h	(working copy)
> @@ -50,7 +50,8 @@
>   RT_PROXY_STUB(vde_send, size_t, \
>                 (VDECONN *conn,const void *buf,size_t len,int flags), \
>                 (conn, buf, len, flags)) \
> - RT_PROXY_STUB(vde_datafd, int, (VDECONN *conn), (conn))
> + RT_PROXY_STUB(vde_datafd, int, (VDECONN *conn), (conn)) \
> + RT_PROXY_STUB(vde_close, void, (VDECONN *conn), (conn))
>  
>  #ifdef VDEPLUG_GENERATE_HEADER
>  # define RT_RUNTIME_LOADER_GENERATE_HEADER
> Index: src/VBox/Devices/Network/DrvVDE.cpp
> ===================================================================
> --- src/VBox/Devices/Network/DrvVDE.cpp	(revision 29173)
> +++ src/VBox/Devices/Network/DrvVDE.cpp	(working copy)
> @@ -230,6 +230,7 @@
>          uint8_t const  *pbFrame = (uint8_t const *)pSgBuf->aSegs[0].pvSeg;
>          PCPDMNETWORKGSO pGso    = (PCPDMNETWORKGSO)pSgBuf->pvUser;
>          uint32_t const  cSegs   = PDMNetGsoCalcSegmentCount(pGso, pSgBuf->cbUsed);  Assert(cSegs > 1);
> +        rc = 0;
>          for (size_t iSeg = 0; iSeg < cSegs; iSeg++)
>          {
>              uint32_t cbSegFrame;
> @@ -497,6 +498,7 @@
>      if (RTCritSectIsInitialized(&pThis->XmitLock))
>          RTCritSectDelete(&pThis->XmitLock);
>  
> +    vde_close(pThis->vdeconn);
>  #ifdef VBOX_WITH_STATISTICS
>      /*
>       * Deregister statistics.
> 
> _______________________________________________
> vbox-dev mailing list
> vbox-dev at virtualbox.org
> http://vbox.innotek.de/mailman/listinfo/vbox-dev




More information about the vbox-dev mailing list