Full patch attached. Apparently iprt needs a small patch as well.

Christophe

On Mon, Jan 16, 2012 at 10:13 PM, Christophe Devriese <
[email protected]> wrote:

> Hi,
>
> Having a UDP source port of 0 is not actually a mistake. By passing this
> value you're asking the kernel to assign a free source port for your
> socket. This is a desirable feature imho.
>
> The attached patch should make sport=0 an option for udptunnel drivers.
>
> Christophe
>
Index: VBox/Devices/Network/DrvUDPTunnel.cpp
===================================================================
--- VBox/Devices/Network/DrvUDPTunnel.cpp	(revision 39753)
+++ VBox/Devices/Network/DrvUDPTunnel.cpp	(working copy)
@@ -508,8 +508,6 @@
     if (RT_FAILURE(rc))
         rc = PDMDRV_SET_ERROR(pDrvIns, rc,
                               N_("DrvUDPTunnel: Configuration error: Converting \"sport\" to integer failed"));
-    if (!pThis->uSrcPort)
-        pThis->uSrcPort = 4444;
 
     rc = CFGMR3QueryStringDef(pCfg, "dport", szVal, sizeof(szVal), "4445");
     if (RT_FAILURE(rc))
Index: VBox/Runtime/r3/udp.cpp
===================================================================
--- VBox/Runtime/r3/udp.cpp	(revision 39753)
+++ VBox/Runtime/r3/udp.cpp	(working copy)
@@ -198,7 +198,7 @@
     /*
      * Validate input.
      */
-    AssertReturn(uPort > 0, VERR_INVALID_PARAMETER);
+    AssertReturn(uPort >= 0, VERR_INVALID_PARAMETER);
     AssertPtrReturn(pfnServe, VERR_INVALID_POINTER);
     AssertPtrReturn(pszThrdName, VERR_INVALID_POINTER);
     AssertPtrReturn(ppServer, VERR_INVALID_POINTER);
@@ -278,7 +278,7 @@
     /*
      * Validate input.
      */
-    AssertReturn(uPort > 0, VERR_INVALID_PARAMETER);
+    AssertReturn(uPort >= 0, VERR_INVALID_PARAMETER);
     AssertPtrReturn(ppServer, VERR_INVALID_PARAMETER);
 
 #ifdef RT_OS_WINDOWS
_______________________________________________
vbox-dev mailing list
[email protected]
https://www.virtualbox.org/mailman/listinfo/vbox-dev

Reply via email to