Index: trunk/src/VBox/Devices/Network/DrvNATlibslirp.cpp
===================================================================
--- trunk/src/VBox/Devices/Network/DrvNATlibslirp.cpp	(revision 105014)
+++ trunk/src/VBox/Devices/Network/DrvNATlibslirp.cpp	(revision 105023)
@@ -43,8 +43,9 @@
 /**
  * @callback_method_impl{FNPDMTHREADDRV}
+ * 
+ * Queues guest process received packet. Triggered by drvNATRecvWakeup.
  */
 static DECLCALLBACK(int) drvNATRecv(PPDMDRVINS pDrvIns, PPDMTHREAD pThread)
 {
-    LogFlow(("Recv... \n"));
     PDRVNAT pThis = PDMINS_2_DATA(pDrvIns, PDRVNAT);
 
@@ -110,4 +111,13 @@
 }
 
+/**
+ * @brief Processes incoming packet (to guest).
+ * 
+ * @param   pThis   Pointer to DRVNAT state for current context.
+ * @param   pBuf    Pointer to packet buffer.
+ * @param   cb      Size of packet in buffer.
+ * 
+ * @thread  NAT
+ */
 static DECLCALLBACK(void) drvNATRecvWorker(PDRVNAT pThis, void *pBuf, int cb)
 {
@@ -135,6 +145,6 @@
         rc = pThis->pIAboveNet->pfnReceive(pThis->pIAboveNet, pBuf, cb);
         AssertRC(rc);
-        // RTMemFree(pBuf);
-        // pBuf = NULL;
+        RTMemFree(pBuf);
+        pBuf = NULL;
     }
     else if (   rc != VERR_TIMEOUT
@@ -148,5 +158,4 @@
 
 done_unlocked:
-    // m_free(m);
     ASMAtomicDecU32(&pThis->cPkts);
 
@@ -164,4 +173,6 @@
  * @param   pThis               Pointer to the NAT instance.
  * @param   pSgBuf              The S/G buffer to free.
+ * 
+ * @thread  NAT
  */
 static void drvNATFreeSgBuf(PDRVNAT pThis, PPDMSCATTERGATHER pSgBuf)
@@ -175,5 +186,5 @@
 
         RTMemFree(pSgBuf->aSegs[0].pvSeg);
-        // RTMemFree(pSgBuf->pvAllocator);
+        RTMemFree(pSgBuf->pvAllocator);
 
         pSgBuf->pvAllocator = NULL;
@@ -548,7 +559,5 @@
     if (pThis->pNATState->nsock + 1 >= pThis->pNATState->uPollCap)
     {
-        // LogFlow(("OLD SIZE: %d\n", sizeof(pThis->pNATState->polls)));
         int cbNew = pThis->pNATState->uPollCap * 2 * sizeof(struct pollfd);
-        // LogFlow(("NEW SIZE: %d\n", cbNew));
         struct pollfd *pvNew = (struct pollfd *)RTMemRealloc(pThis->pNATState->polls, cbNew);
         if(pvNew)
@@ -564,5 +573,4 @@
 
     int idx = pThis->pNATState->nsock;
-    // LogFlow(("**** nsock = %d\n", pThis->pNATState->nsock));
 #ifdef RT_OS_WINDOWS
     pThis->pNATState->polls[idx].fd = libslirp_wrap_RTHandleTableLookup(fd);
@@ -573,5 +581,4 @@
     pThis->pNATState->polls[idx].revents = 0;
     pThis->pNATState->nsock += 1;
-    // LogFlow(("add_poll_cb: fd=%d, return=%d\n", fd, idx));
     return idx;
 }
@@ -579,11 +586,7 @@
 static int get_revents_cb(int idx, void *opaque)
 {
-// #ifndef RT_OS_WINDOWS
     PDRVNAT pThis = (PDRVNAT)opaque;
     struct pollfd* polls = pThis->pNATState->polls;
     return poll_to_slirp(polls[idx].revents);
-// #else
-//     return 0;
-// #endif
 }
 
@@ -680,30 +683,9 @@
         pThis->pNATState->nsock = 0;
         slirp_pollfds_fill(pThis->pNATState->pSlirp, &uTimeout, add_poll_cb /* SlirpAddPollCb */, pThis /* opaque */);
-                LogFlow(("******** nsock = %d\n", pThis->pNATState->nsock));
-
         slirpUpdateTimeout(&uTimeout, pThis);
-        // DWORD dwEvent = WSAWaitForMultipleEvents(VBOX_EVENT_COUNT, phEvents, FALSE,
-        //                                          uTimeout, /* :fAlertable */ TRUE);
-        // AssertCompile(WSA_WAIT_EVENT_0 == 0);
-        // if (   (/*dwEvent < WSA_WAIT_EVENT_0 ||*/ dwEvent > WSA_WAIT_EVENT_0 + pThis->pNATState->nsock - 1)
-        //     && dwEvent != WSA_WAIT_TIMEOUT && dwEvent != WSA_WAIT_IO_COMPLETION)
-        // {
-        //     int error = WSAGetLastError();
-        //     LogFlow(("NAT: WSAWaitForMultipleEvents returned %d (error %d)\n", dwEvent, error));
-        //     // RTAssertPanic();
-        // }
-
-        // LogFlow(("WSAWaitForMultipleEvents = %d\n", dwEvent));
-
-        // if(pThis->pNATState->nsock <= 0)
-        // {
-        //     RTThreadSleep(100);
-        //     continue;
-        // }
 
         int cChangedFDs = WSAPoll(pThis->pNATState->polls, pThis->pNATState->nsock, uTimeout /* timeout */);
-            int error = WSAGetLastError();
-
-        LogFlow(("changed fds: %d\n", cChangedFDs));
+        int error = WSAGetLastError();
+
         if (cChangedFDs < 0)
         {
@@ -717,5 +699,4 @@
         if (cChangedFDs == 0)
         {
-            LogFlow(("WSA_WAIT_TIMEOUT\n"));
             /* only check for slow/fast timers */
             slirp_pollfds_poll(pThis->pNATState->pSlirp, false /*select error*/, get_revents_cb /* SlirpGetREventsCb */, pThis /* opaque */);
@@ -1341,6 +1322,4 @@
     vhost.S_un.S_addr = RT_BSWAP_U32(0x0a000202);
 
-    // struct in6_addr vprefix_addr6 = { 0 };
-
     struct in_addr vdhcp_start;
     vdhcp_start.S_un.S_addr = RT_BSWAP_U32(0x0a00020f);
@@ -1349,5 +1328,4 @@
     vnameserver.S_un.S_addr = RT_BSWAP_U32(0x0a000203);
 #endif
-    // AssertRC(inet_pton(AF_INET6, "fec0::", &vprefix_addr6));
 
     SlirpConfig *pSlirpCfg = new SlirpConfig { 0 };
@@ -1359,25 +1337,11 @@
     pSlirpCfg->vnetmask = vnetmask;
     pSlirpCfg->vhost = vhost;
-// #ifndef RT_OS_WINDOWS
     pSlirpCfg->in6_enabled = true;
-// #else
-//     pSlirpCfg->in6_enabled = false;
-// #endif
-
-#ifndef RT_OS_WINDOWS
+
     inet_pton(AF_INET6, "fd00::", &pSlirpCfg->vprefix_addr6);
-#else
-    inet_pton(23, "fd00::", &pSlirpCfg->vprefix_addr6);
-#endif
-
     pSlirpCfg->vprefix_len = 64;
-
-#ifndef RT_OS_WINDOWS
     inet_pton(AF_INET6, "fd00::2", &pSlirpCfg->vhost6);
-#else
-    inet_pton(23, "fd00::2", &pSlirpCfg->vhost6);
-#endif
-
-    pSlirpCfg->vhostname = "tmp-vbox-dev";
+
+    pSlirpCfg->vhostname = "vbox";
     pSlirpCfg->tftp_server_name = pThis->pszNextServer;
     pSlirpCfg->tftp_path = pThis->pszTFTPPrefix;
Index: trunk/src/VBox/Devices/Network/DrvNATlibslirp.h
===================================================================
--- trunk/src/VBox/Devices/Network/DrvNATlibslirp.h	(revision 105014)
+++ trunk/src/VBox/Devices/Network/DrvNATlibslirp.h	(revision 105023)
@@ -64,4 +64,5 @@
 # endif
 # define inet_aton(x, y) inet_pton(2, x, y)
+# define AF_INET6 23
 #endif
 
