Index: trunk/src/VBox/Devices/Network/slirp/libalias/alias_db.c
===================================================================
--- trunk/src/VBox/Devices/Network/slirp/libalias/alias_db.c	(revision 40582)
+++ trunk/src/VBox/Devices/Network/slirp/libalias/alias_db.c	(revision 40583)
@@ -798,9 +798,21 @@
         NSOCK_INC_EX(la);
         if (link_type == LINK_TCP)
+        {
+            so->so_type = IPPROTO_TCP;
             insque(la->pData, so, &la->tcb);
+        }
         else if (link_type == LINK_UDP)
+        {
+            so->so_type = IPPROTO_UDP;
             insque(la->pData, so, &la->udb);
+        }
         else
+        {
+            /* socket wasn't added to queue */
+            closesocket(so->s);
+            RTMemFree(so);
             Assert(!"Shouldn't be here");
+            return 0;
+        }
         LogFunc(("bind called for socket: %R[natsock]\n", so));
 #else
Index: trunk/src/VBox/Devices/Network/slirp/slirp.c
===================================================================
--- trunk/src/VBox/Devices/Network/slirp/slirp.c	(revision 40582)
+++ trunk/src/VBox/Devices/Network/slirp/slirp.c	(revision 40583)
@@ -926,4 +926,5 @@
     QSOCKET_FOREACH(so, so_next, tcp)
     /* { */
+        Assert(so->so_type == IPPROTO_TCP);
 #if !defined(RT_OS_WINDOWS)
         so->so_poll_index = -1;
@@ -1012,4 +1013,5 @@
     /* { */
 
+        Assert(so->so_type == IPPROTO_UDP);
         STAM_COUNTER_INC(&pData->StatUDP);
 #if !defined(RT_OS_WINDOWS)
Index: trunk/src/VBox/Devices/Network/slirp/tcp_subr.c
===================================================================
--- trunk/src/VBox/Devices/Network/slirp/tcp_subr.c	(revision 40582)
+++ trunk/src/VBox/Devices/Network/slirp/tcp_subr.c	(revision 40583)
@@ -227,4 +227,5 @@
 
     so->so_tcpcb = tp;
+    so->so_type = IPPROTO_TCP;
 
     return (tp);
@@ -598,4 +599,6 @@
 tcp_attach(PNATState pData, struct socket *so)
 {
+    /* We're attaching already attached socket??? */
+    Assert(so->so_type == 0);
     if ((so->so_tcpcb = tcp_newtcpcb(pData, so)) == NULL)
         return -1;
Index: trunk/src/VBox/Devices/Network/slirp/udp.c
===================================================================
--- trunk/src/VBox/Devices/Network/slirp/udp.c	(revision 40582)
+++ trunk/src/VBox/Devices/Network/slirp/udp.c	(revision 40583)
@@ -271,4 +271,5 @@
     so->so_faddr = ip->ip_dst;   /* XXX */
     so->so_fport = uh->uh_dport; /* XXX */
+    Assert(so->so_type == IPPROTO_UDP);
 
     /*
@@ -346,4 +347,7 @@
     LogFlowFunc(("ENTER: so = %R[natsock], m = %p, saddr = %RTnaipv4, daddr = %RTnaipv4\n",
                  so, m, saddr->sin_addr.s_addr, daddr->sin_addr.s_addr));
+
+    /* in case of built-in service so might be NULL */
+    if (so) Assert(so->so_type == IPPROTO_UDP);
 
     /*
@@ -399,4 +403,5 @@
     struct socket *pSocketClone = NULL;
 #endif
+    Assert(so->so_type == IPPROTO_UDP);
     LogFlowFunc(("ENTER: so = %R[natsock], m = %p, saddr = %RTnaipv4\n",
                  so, (long)m, addr->sin_addr.s_addr));
@@ -456,4 +461,6 @@
     int opt = 1;
 
+    /* We attaching some olready attched socket ??? */
+    Assert(so->so_type == 0);
     if ((so->s = socket(AF_INET, SOCK_DGRAM, 0)) == -1)
         goto error;
@@ -497,4 +504,5 @@
     NSOCK_INC();
     QSOCKET_UNLOCK(udb);
+    so->so_type = IPPROTO_UDP;
     return so->s;
 error:
@@ -508,4 +516,5 @@
     if (so != &pData->icmp_socket)
     {
+        Assert(so->so_type == IPPROTO_UDP);
         QSOCKET_LOCK(udb);
         SOCKET_LOCK(so);
@@ -552,4 +561,5 @@
     }
     so->so_expire = curtime + SO_EXPIRE;
+    so->so_type = IPPROTO_UDP;
     fd_nonblock(so->s);
     SOCKET_LOCK_CREATE(so);
@@ -582,4 +592,7 @@
      * if statement was always true (INADDR_ANY=0). */
     /* if (addr.sin_addr.s_addr == 0 || addr.sin_addr.s_addr == loopback_addr.s_addr) */
+    /* @todo: vvl - alias_addr should be set (if required)
+     * later by liabalias module.
+     */
     if (1 == 0)                 /* always use the else part */
         so->so_faddr = alias_addr;
