Index: /trunk/src/VBox/Devices/Makefile.kmk
===================================================================
--- /trunk/src/VBox/Devices/Makefile.kmk	(revision 30015)
+++ /trunk/src/VBox/Devices/Makefile.kmk	(revision 30016)
@@ -823,6 +823,4 @@
 endif
 
-VBOX_WITH_SLIRP_BSD_MBUF=1
-
 Drivers_INCS      := \
 	$(PATH_SUB_CURRENT) \
@@ -857,5 +855,4 @@
 	Network/slirp/bootp.c \
 	Network/slirp/debug.c \
-	Network/slirp/if.c \
 	Network/slirp/ip_icmp.c \
 	Network/slirp/ip_input.c \
@@ -874,17 +871,10 @@
 	Network/slirp/dnsproxy/dnsproxy.c
 
-ifdef VBOX_WITH_SLIRP_BSD_MBUF
- VBOX_SLIRP_BSD_ARCH = $(subst x86,i386,$(KBUILD_TARGET_ARCH))
- VBOX_SLIRP_BSD_SOURCES += \
- 	Network/slirp/bsd/kern/kern_mbuf.c \
- 	Network/slirp/bsd/kern/uipc_mbuf.c \
- 	Network/slirp/bsd/kern/uipc_mbuf2.c \
- 	Network/slirp/bsd/$(VBOX_SLIRP_BSD_ARCH)/in_cksum.c
-else
-# some notes dnsproxy will probably deprecate
- VBOX_SLIRP_SOURCES += \
- 	Network/slirp/mbuf.c \
-	Network/slirp/cksum.c
-endif
+VBOX_SLIRP_BSD_ARCH = $(subst x86,i386,$(KBUILD_TARGET_ARCH))
+VBOX_SLIRP_BSD_SOURCES += \
+	Network/slirp/bsd/kern/kern_mbuf.c \
+	Network/slirp/bsd/kern/uipc_mbuf.c \
+	Network/slirp/bsd/kern/uipc_mbuf2.c \
+	Network/slirp/bsd/$(VBOX_SLIRP_BSD_ARCH)/in_cksum.c
 
 VBOX_SLIRP_ALIAS_SOURCES = \
@@ -905,12 +895,9 @@
       $(if $(VBOX_WITH_SLIRP_MEMORY_CHECK),RTMEM_WRAP_TO_EF_APIS,) \
       $(if $(VBOX_WITH_DEBUG_NAT_SOCKETS),VBOX_WITH_DEBUG_NAT_SOCKETS,)	\
-      $(if $(VBOX_WITH_SLIRP_MT),VBOX_WITH_SLIRP_MT,) \
-      $(if $(VBOX_WITH_SLIRP_BSD_MBUF),VBOX_WITH_SLIRP_BSD_MBUF,)
- ifdef VBOX_WITH_SLIRP_BSD_MBUF
-  $(file)_INCS += $(1)/slirp/bsd/sys
-  $(file)_INCS += $(1)/slirp/bsd/sys/sys
-  $(file)_INCS += $(1)/slirp/bsd/$(VBOX_SLIRP_BSD_ARCH)/include
-  $(file)_INCS += $(1)/slirp/bsd/netinet
- endif
+      $(if $(VBOX_WITH_SLIRP_MT),VBOX_WITH_SLIRP_MT,)
+ $(file)_INCS += $(1)/slirp/bsd/sys
+ $(file)_INCS += $(1)/slirp/bsd/sys/sys
+ $(file)_INCS += $(1)/slirp/bsd/$(VBOX_SLIRP_BSD_ARCH)/include
+ $(file)_INCS += $(1)/slirp/bsd/netinet
  $(file)_INCS += $(1)/slirp
  $(file)_INCS += $(1)/slirp/libalias
@@ -919,8 +906,6 @@
  else
   $(file)_CFLAGS += -Wno-sign-compare
-  ifdef VBOX_WITH_SLIRP_BSD_MBUF
-   $(file)_CFLAGS += -Wno-format
-   $(file)_CFLAGS += -Wno-bad-function-cast
-  endif
+  $(file)_CFLAGS += -Wno-format
+  $(file)_CFLAGS += -Wno-bad-function-cast
  endif
 endef
@@ -942,5 +927,4 @@
 $(foreach file,$(VBOX_SLIRP_ALIAS_SOURCES),$(eval $(call def_vbox_slirp_alias_cflags, Network)))
 
-ifdef VBOX_WITH_SLIRP_BSD_MBUF
 VBOX_SLIRP_BSD_SOURCES += $(VBOX_SLIRP_BSD_SOURCES.${KBUILD_TARGET_ARCH})
 Drivers_SOURCES += $(VBOX_SLIRP_BSD_SOURCES)
@@ -951,5 +935,4 @@
 $(foreach file,$(VBOX_SLIRP_BSD_SOURCES),$(eval $(call def_vbox_slirp_cflags, Network)))
 $(foreach file,$(VBOX_SLIRP_BSD_SOURCES),$(eval $(call def_vbox_slirp_bsd_cflags, Network)))
-endif
 
 ifdef VBOX_WITH_DRV_DISK_INTEGRITY
Index: /trunk/src/VBox/Devices/Network/DrvNAT.cpp
===================================================================
--- /trunk/src/VBox/Devices/Network/DrvNAT.cpp	(revision 30015)
+++ /trunk/src/VBox/Devices/Network/DrvNAT.cpp	(revision 30016)
@@ -284,7 +284,5 @@
 
     slirp_ext_m_free(pThis->pNATState, m);
-#ifdef VBOX_WITH_SLIRP_BSD_MBUF
     RTMemFree(pu8Buf);
-#endif
     if (ASMAtomicDecU32(&pThis->cUrgPkts) == 0)
     {
@@ -331,7 +329,5 @@
 done_unlocked:
     slirp_ext_m_free(pThis->pNATState, m);
-#ifdef VBOX_WITH_SLIRP_BSD_MBUF
     RTMemFree(pu8Buf);
-#endif
     ASMAtomicDecU32(&pThis->cPkts);
 
@@ -1123,8 +1119,6 @@
     int fUseHostResolver = 0;
     GET_S32(rc, pThis, pCfg, "UseHostResolver", fUseHostResolver);
-#ifdef VBOX_WITH_SLIRP_BSD_MBUF
     int MTU = 1500;
     GET_S32(rc, pThis, pCfg, "SlirpMTU", MTU);
-#endif
     int i32AliasMode = 0;
     int i32MainAliasMode = 0;
@@ -1175,7 +1169,5 @@
         slirp_set_dhcp_next_server(pThis->pNATState, pThis->pszNextServer);
         slirp_set_dhcp_dns_proxy(pThis->pNATState, !!fDNSProxy);
-#ifdef VBOX_WITH_SLIRP_BSD_MBUF
         slirp_set_mtu(pThis->pNATState, MTU);
-#endif
         char *pszBindIP = NULL;
         GET_STRING_ALLOC(rc, pThis, pCfg, "BindIP", pszBindIP);
Index: /trunk/src/VBox/Devices/Network/slirp/bootp.c
===================================================================
--- /trunk/src/VBox/Devices/Network/slirp/bootp.c	(revision 30015)
+++ /trunk/src/VBox/Devices/Network/slirp/bootp.c	(revision 30016)
@@ -674,9 +674,5 @@
     }
 
-#ifndef VBOX_WITH_SLIRP_BSD_MBUF
-    if ((m = m_get(pData)) == NULL)
-#else
     if ((m = m_getcl(pData, M_DONTWAIT, MT_HEADER, M_PKTHDR)) == NULL)
-#endif
     {
         LogRel(("NAT: can't alocate memory for response!\n"));
@@ -759,7 +755,5 @@
     *q++ = RFC1533_END; /* end of message */
 
-#ifdef VBOX_WITH_SLIRP_BSD_MBUF
     m->m_pkthdr.header = mtod(m, void *);
-#endif
     m->m_len = sizeof(struct bootp_t)
              - sizeof(struct ip)
Index: /trunk/src/VBox/Devices/Network/slirp/debug.c
===================================================================
--- /trunk/src/VBox/Devices/Network/slirp/debug.c	(revision 30015)
+++ /trunk/src/VBox/Devices/Network/slirp/debug.c	(revision 30016)
@@ -179,31 +179,8 @@
 mbufstats(PNATState pData)
 {
-#ifndef VBOX_WITH_SLIRP_BSD_MBUF
     /*
      * (vvl) this static code can't work with mbuf zone anymore
      * @todo: make statistic correct
      */
-#if 0
-    struct mbuf *m;
-    int i;
-
-    lprint(" \n");
-
-    lprint("Mbuf stats:\n");
-
-    lprint("  %6d mbufs allocated (%d max)\n", mbuf_alloced, mbuf_max);
-
-    i = 0;
-    for (m = m_freelist.m_next; m != &m_freelist; m = m->m_next)
-        i++;
-    lprint("  %6d mbufs on free list\n",  i);
-
-    i = 0;
-    for (m = m_usedlist.m_next; m != &m_usedlist; m = m->m_next)
-        i++;
-    lprint("  %6d mbufs on used list\n",  i);
-    lprint("  %6d mbufs queued as packets\n\n", if_queued);
-#endif
-#endif
 }
 
Index: /trunk/src/VBox/Devices/Network/slirp/dnsproxy/dnsproxy.c
===================================================================
--- /trunk/src/VBox/Devices/Network/slirp/dnsproxy/dnsproxy.c	(revision 30015)
+++ /trunk/src/VBox/Devices/Network/slirp/dnsproxy/dnsproxy.c	(revision 30016)
@@ -133,9 +133,5 @@
             return;
         }
-#ifndef VBOX_WITH_SLIRP_BSD_MBUF
-        m = m_get(pData);
-#else
         m = m_getcl(pData, M_NOWAIT, MT_HEADER, M_PKTHDR);
-#endif
         if (m == NULL)
         {
Index: /trunk/src/VBox/Devices/Network/slirp/ext.h
===================================================================
--- /trunk/src/VBox/Devices/Network/slirp/ext.h	(revision 30015)
+++ /trunk/src/VBox/Devices/Network/slirp/ext.h	(revision 30016)
@@ -16,13 +16,12 @@
  */
 
-#ifdef VBOX_WITH_SLIRP_BSD_MBUF
 # ifndef IN_BSD
-#  define zone_mbuf slirp_zone_mbuf(pData)
-#  define zone_clust slirp_zone_clust(pData)
-#  define zone_pack slirp_zone_pack(pData)
-#  define zone_jumbop slirp_zone_jumbop(pData)
-#  define zone_jumbo9 slirp_zone_jumbo9(pData)
-#  define zone_jumbo16 slirp_zone_jumbo16(pData)
-#  define zone_ext_refcnt slirp_zone_ext_refcnt(pData)
+# define zone_mbuf slirp_zone_mbuf(pData)
+# define zone_clust slirp_zone_clust(pData)
+# define zone_pack slirp_zone_pack(pData)
+# define zone_jumbop slirp_zone_jumbop(pData)
+# define zone_jumbo9 slirp_zone_jumbo9(pData)
+# define zone_jumbo16 slirp_zone_jumbo16(pData)
+# define zone_ext_refcnt slirp_zone_ext_refcnt(pData)
 static inline uma_zone_t slirp_zone_mbuf(PNATState);
 static inline uma_zone_t slirp_zone_clust(PNATState);
@@ -32,21 +31,20 @@
 static inline uma_zone_t slirp_zone_jumbo16(PNATState);
 static inline uma_zone_t slirp_zone_ext_refcnt(PNATState);
-# else
-#  undef zone_mbuf
-#  undef zone_clust
-#  undef zone_pack
-#  undef zone_jumbop
-#  undef zone_jumbo9
-#  undef zone_jumbo16
-#  undef zone_ext_refcnt
+#else
+# undef zone_mbuf
+# undef zone_clust
+# undef zone_pack
+# undef zone_jumbop
+# undef zone_jumbo9
+# undef zone_jumbo16
+# undef zone_ext_refcnt
 
-#  define zone_mbuf pData->zone_mbuf
-#  define zone_clust pData->zone_clust
-#  define zone_pack pData->zone_pack
-#  define zone_jumbop pData->zone_jumbop
-#  define zone_jumbo9 pData->zone_jumbo9
-#  define zone_jumbo16 pData->zone_jumbo16
-#  define zone_ext_refcnt pData->zone_ext_refcnt
-# endif
+# define zone_mbuf pData->zone_mbuf
+# define zone_clust pData->zone_clust
+# define zone_pack pData->zone_pack
+# define zone_jumbop pData->zone_jumbop
+# define zone_jumbo9 pData->zone_jumbo9
+# define zone_jumbo16 pData->zone_jumbo16
+# define zone_ext_refcnt pData->zone_ext_refcnt
 #endif
 
Index: unk/src/VBox/Devices/Network/slirp/if.c
===================================================================
--- /trunk/src/VBox/Devices/Network/slirp/if.c	(revision 30015)
+++ 	(revision )
@@ -1,308 +1,0 @@
-/* $Id$ */
-/** @file
- * NAT - if_*.
- */
-
-/*
- * Copyright (C) 2006-2010 Oracle Corporation
- *
- * This file is part of VirtualBox Open Source Edition (OSE), as
- * available from http://www.virtualbox.org. This file is free software;
- * you can redistribute it and/or modify it under the terms of the GNU
- * General Public License (GPL) as published by the Free Software
- * Foundation, in version 2 as it comes in the "COPYING" file of the
- * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
- */
-
-/*
- * This code is based on:
- *
- * Copyright (c) 1995 Danny Gasparovski.
- *
- * Please read the file COPYRIGHT for the
- * terms and conditions of the copyright.
- */
-
-#include <slirp.h>
-
-
-#ifndef VBOX_WITH_SLIRP_BSD_MBUF
-# define ifs_init(ifm) ((ifm)->ifs_next = (ifm)->ifs_prev = (ifm))
-
-static void ifs_insque(struct mbuf *ifm, struct mbuf *ifmhead)
-{
-    ifm->ifs_next = ifmhead->ifs_next;
-    ifmhead->ifs_next = ifm;
-    ifm->ifs_prev = ifmhead;
-    ifm->ifs_next->ifs_prev = ifm;
-}
-
-static void ifs_remque(struct mbuf *ifm)
-{
-    ifm->ifs_prev->ifs_next = ifm->ifs_next;
-    ifm->ifs_next->ifs_prev = ifm->ifs_prev;
-}
-#else
-#endif
-
-void
-if_init(PNATState pData)
-{
-    /* 14 for ethernet */
-    if_maxlinkhdr = 14;
-    if_queued = 0;
-    if_thresh = 10;
-    if_comp = IF_AUTOCOMP;
-    if_mtu = 1500;
-    if_mru = 1500;
-#ifndef VBOX_WITH_SLIRP_BSD_MBUF
-    if_fastq.ifq_next = if_fastq.ifq_prev = &if_fastq;
-    if_batchq.ifq_next = if_batchq.ifq_prev = &if_batchq;
-/*  sl_compress_init(&comp_s); */
-    next_m = &if_batchq;
-#else
-    TAILQ_INIT(&if_fastq);
-    TAILQ_INIT(&if_batchq);
-    next_m = TAILQ_FIRST(&if_fastq);
-#endif
-}
-
-/*
- * if_output: Queue packet into an output queue.
- * There are 2 output queue's, if_fastq and if_batchq.
- * Each output queue is a doubly linked list of double linked lists
- * of mbufs, each list belonging to one "session" (socket).  This
- * way, we can output packets fairly by sending one packet from each
- * session, instead of all the packets from one session, then all packets
- * from the next session, etc.  Packets on the if_fastq get absolute
- * priority, but if one session hogs the link, it gets "downgraded"
- * to the batchq until it runs out of packets, then it'll return
- * to the fastq (eg. if the user does an ls -alR in a telnet session,
- * it'll temporarily get downgraded to the batchq)
- */
-void
-if_output(PNATState pData, struct socket *so, struct mbuf *ifm)
-{
-    struct mbuf *ifq;
-    int on_fastq = 1;
-
-    DEBUG_CALL("if_output");
-    DEBUG_ARG("so = %lx", (long)so);
-    DEBUG_ARG("ifm = %lx", (long)ifm);
-
-#ifndef VBOX_WITH_SLIRP_BSD_MBUF
-    /*
-     * First remove the mbuf from m_usedlist,
-     * since we're gonna use m_next and m_prev ourselves
-     * XXX Shouldn't need this, gotta change dtom() etc.
-     */
-    if (ifm->m_flags & M_USEDLIST)
-    {
-        remque(pData, ifm);
-        ifm->m_flags &= ~M_USEDLIST;
-    }
-#endif
-
-    /*
-     * See if there's already a batchq list for this session.
-     * This can include an interactive session, which should go on fastq,
-     * but gets too greedy... hence it'll be downgraded from fastq to batchq.
-     * We mustn't put this packet back on the fastq (or we'll send it out of order)
-     * XXX add cache here?
-     */
-#ifndef VBOX_WITH_SLIRP_BSD_MBUF
-    for (ifq = if_batchq.ifq_prev; ifq != &if_batchq; ifq = ifq->ifq_prev)
-#else
-    TAILQ_FOREACH_REVERSE(ifq, &if_batchq, if_queue, m_ifq)
-#endif
-    {
-        if (so == ifq->ifq_so)
-        {
-            /* A match! */
-            ifm->ifq_so = so;
-#ifndef VBOX_WITH_SLIRP_BSD_MBUF
-            ifs_insque(ifm, ifq->ifs_prev);
-#endif
-            goto diddit;
-        }
-    }
-
-    /* No match, check which queue to put it on */
-    if (so && (so->so_iptos & IPTOS_LOWDELAY))
-    {
-#ifndef VBOX_WITH_SLIRP_BSD_MBUF
-        ifq = if_fastq.ifq_prev;
-#else
-        ifq = TAILQ_LAST(&if_fastq, if_queue);
-#endif
-        on_fastq = 1;
-        /*
-         * Check if this packet is a part of the last
-         * packet's session
-         */
-        if (ifq->ifq_so == so)
-        {
-            ifm->ifq_so = so;
-#ifndef VBOX_WITH_SLIRP_BSD_MBUF
-            ifs_insque(ifm, ifq->ifs_prev);
-#endif
-            goto diddit;
-        }
-    }
-#ifndef VBOX_WITH_SLIRP_BSD_MBUF
-    else
-        ifq = if_batchq.ifq_prev;
-
-    /* Create a new doubly linked list for this session */
-    ifm->ifq_so = so;
-    ifs_init(ifm);
-    insque(pData, ifm, ifq);
-#else
-    else
-    {
-        TAILQ_INSERT_TAIL(&if_batchq, ifm, m_ifq);
-        ifq = TAILQ_LAST(&if_batchq, if_queue);
-    }
-
-    /* queue already created */
-#endif
-
-diddit:
-    ++if_queued;
-
-    if (so)
-    {
-        /* Update *_queued */
-        so->so_queued++;
-        so->so_nqueued++;
-        /*
-         * Check if the interactive session should be downgraded to
-         * the batchq.  A session is downgraded if it has queued 6
-         * packets without pausing, and at least 3 of those packets
-         * have been sent over the link
-         * (XXX These are arbitrary numbers, probably not optimal..)
-         */
-        if (on_fastq
-            && so->so_nqueued >= 6
-            && (so->so_nqueued - so->so_queued) >= 3)
-        {
-#ifndef VBOX_WITH_SLIRP_BSD_MBUF
-            /* Remove from current queue... */
-            remque(pData, ifm->ifs_next);
-
-            /* ...And insert in the new.  That'll teach ya! */
-            insque(pData, ifm->ifs_next, &if_batchq);
-#endif
-        }
-    }
-
-#ifndef FULL_BOLT
-    /*
-     * This prevents us from malloc()ing too many mbufs
-     */
-    if (link_up)
-    {
-        /* if_start will check towrite */
-        if_start(pData);
-    }
-#endif
-}
-
-/*
- * Send a packet
- * We choose a packet based on it's position in the output queues;
- * If there are packets on the fastq, they are sent FIFO, before
- * everything else.  Otherwise we choose the first packet from the
- * batchq and send it.  the next packet chosen will be from the session
- * after this one, then the session after that one, and so on..  So,
- * for example, if there are 3 ftp session's fighting for bandwidth,
- * one packet will be sent from the first session, then one packet
- * from the second session, then one packet from the third, then back
- * to the first, etc. etc.
- */
-void
-if_start(PNATState pData)
-{
-    struct mbuf *ifm, *ifqt;
-#ifdef VBOX_WITH_SLIRP_BSD_MBUF
-    struct if_queue *pqueue = NULL;
-    ifm = NULL;
-    ifqt = NULL;
-#endif
-
-    DEBUG_CALL("if_start");
-
-    if (!if_queued)
-        return; /* Nothing to do */
-
-    for (;;)
-    {
-        /* check if we can really output */
-        if (!slirp_can_output(pData->pvUser))
-        {
-            Log(("if_start: can't send\n"));
-            return;
-        }
-
-#ifndef VBOX_WITH_SLIRP_BSD_MBUF
-        /*
-         * See which queue to get next packet from
-         * If there's something in the fastq, select it immediately
-         */
-        if (if_fastq.ifq_next != &if_fastq)
-            ifm = if_fastq.ifq_next;
-        else
-        {
-            /* Nothing on fastq, see if next_m is valid */
-            if (next_m != &if_batchq)
-                ifm = next_m;
-            else
-                ifm = if_batchq.ifq_next;
-
-            /* Set which packet to send on next iteration */
-            next_m = ifm->ifq_next;
-        }
-        /* Remove it from the queue */
-        ifqt = ifm->ifq_prev;
-        remque(pData, ifm);
-        --if_queued;
-
-        /* If there are more packets for this session, re-queue them */
-        if (ifm->ifs_next != /* ifm->ifs_prev != */ ifm)
-        {
-            insque(pData, ifm->ifs_next, ifqt);
-            ifs_remque(ifm);
-        }
-#else
-        if (!TAILQ_EMPTY(&if_fastq))
-        {
-            pqueue = &if_fastq;
-        }
-        else if (!TAILQ_EMPTY(&if_batchq))
-        {
-            pqueue = &if_batchq;
-        }
-        if (pqueue != NULL) {
-            ifm = TAILQ_FIRST(pqueue);
-            TAILQ_REMOVE(pqueue, ifm, m_ifq);
-            --if_queued;
-        }
-#endif
-
-        /* Update so_queued */
-        if (ifm->ifq_so)
-        {
-            if (--ifm->ifq_so->so_queued == 0)
-                /* If there's no more queued, reset nqueued */
-                ifm->ifq_so->so_nqueued = 0;
-        }
-
-        if_encap(pData, ETH_P_IP, ifm, 0);
-
-        if (!if_queued)
-        {
-            return;
-        }
-    }
-}
Index: /trunk/src/VBox/Devices/Network/slirp/if.h
===================================================================
--- /trunk/src/VBox/Devices/Network/slirp/if.h	(revision 30015)
+++ /trunk/src/VBox/Devices/Network/slirp/if.h	(revision 30016)
@@ -33,19 +33,4 @@
 #define IF_NOCIDCOMP    0x08    /* CID compression */
 
-/* Needed for FreeBSD */
-#undef if_mtu
-extern int      if_mtu;
-extern int      if_mru;         /* MTU and MRU */
-extern int      if_comp;        /* Flags for compression */
-extern int      if_maxlinkhdr;
-extern int      if_queued;      /* Number of packets queued so far */
-extern int      if_thresh;      /* Number of packets queued before we start sending
-                                 * (to prevent allocing too many mbufs) */
-
-extern  struct mbuf if_fastq;   /* fast queue (for interactive data) */
-extern  struct mbuf if_batchq;  /* queue for non-interactive data */
-extern  struct mbuf *next_m;
-
-#define ifs_init(ifm) ((ifm)->ifs_next = (ifm)->ifs_prev = (ifm))
 
 #ifdef ETH_P_ARP
Index: /trunk/src/VBox/Devices/Network/slirp/ip_icmp.c
===================================================================
--- /trunk/src/VBox/Devices/Network/slirp/ip_icmp.c	(revision 30015)
+++ /trunk/src/VBox/Devices/Network/slirp/ip_icmp.c	(revision 30016)
@@ -361,7 +361,4 @@
     m->m_len -= hlen;
     m->m_data += hlen;
-#ifndef VBOX_WITH_SLIRP_BSD_MBUF
-    icp = mtod(m, struct icmp *);
-#else
     if (m->m_next != NULL)
     {
@@ -374,5 +371,4 @@
         icp = mtod(m, struct icmp *);
     }
-#endif
     if (cksum(m, icmplen))
     {
@@ -505,8 +501,6 @@
             m_freem(pData, m);
     } /* switch */
-#ifdef VBOX_WITH_SLIRP_BSD_MBUF
     if (m->m_next != NULL && icp != NULL)
         RTMemFree(icp);
-#endif
 
 end_error:
@@ -547,8 +541,6 @@
     DEBUG_ARG("msrc = %lx", (long )msrc);
     DEBUG_ARG("msrc_len = %d", msrc ? msrc->m_len : 0);
-#ifdef VBOX_WITH_SLIRP_BSD_MBUF
     if (msrc != NULL)
         M_ASSERTPKTHDR(msrc);
-#endif
 
     if (type!=ICMP_UNREACH && type!=ICMP_TIMXCEED && type != ICMP_SOURCEQUENCH)
@@ -584,8 +576,4 @@
     }
 
-#ifndef VBOX_WITH_SLIRP_BSD_MBUF
-    /* make a copy */
-    m = m_get(pData);
-#else
     new_m_size = sizeof(struct ip) + ICMP_MINLEN + msrc->m_len + ICMP_MAXDATALEN;
     if (new_m_size < MSIZE)
@@ -610,20 +598,10 @@
     }
     m = m_getjcl(pData, M_NOWAIT, MT_HEADER, M_PKTHDR, size);
-#endif
+
     if (m == NULL)
         goto end_error;                    /* get mbuf */
 
     m->m_data += if_maxlinkhdr;
-#ifdef VBOX_WITH_SLIRP_BSD_MBUF
     m->m_pkthdr.header = mtod(m, void *);
-#else
-    new_m_size = if_maxlinkhdr + sizeof(struct ip) + ICMP_MINLEN + msrc->m_len + ICMP_MAXDATALEN;
-    if (new_m_size > m->m_size)
-    {
-        m_inc(m, new_m_size);
-        if (new_m_size > m->m_size)
-            goto end_error_free_m;
-    }
-#endif
 
     memcpy(m->m_data, msrc->m_data, msrc->m_len);
@@ -670,10 +648,5 @@
             message_len = ICMP_MAXDATALEN;
         cpnt = (char *)m->m_data+m->m_len;
-#ifndef VBOX_WITH_SLIRP_BSD_MBUF
-        memcpy(cpnt, message, message_len);
-        m->m_len += message_len;
-#else
         m_append(pData, m, message_len, message);
-#endif
     }
 #endif
@@ -681,9 +654,4 @@
     icp->icmp_cksum = 0;
     icp->icmp_cksum = cksum(m, m->m_len);
-
-#ifndef VBOX_WITH_SLIRP_BSD_MBUF
-    m->m_data -= hlen;
-    m->m_len += hlen;
-#endif
 
     /* fill in ip */
Index: /trunk/src/VBox/Devices/Network/slirp/ip_input.c
===================================================================
--- /trunk/src/VBox/Devices/Network/slirp/ip_input.c	(revision 30015)
+++ /trunk/src/VBox/Devices/Network/slirp/ip_input.c	(revision 30016)
@@ -91,12 +91,7 @@
     struct ip *pip = NULL;
 
-#ifndef VBOX_WITH_SLIRP_BSD_MBUF
-    if (m->m_la)
-        return m->m_la;
-#else
     struct m_tag *t;
     if ((t = m_tag_find(m, PACKET_TAG_ALIAS, NULL)) != 0)
         return (struct libalias *)&t[1];
-#endif
 
     return la;
@@ -391,10 +386,5 @@
     }
 
-#ifndef VBOX_WITH_SLIRP_BSD_MBUF
-#define GETIP(m)    ((struct ip*)(MBUF_IP_HEADER(m)))
-#else
 #define GETIP(m)    ((struct ip*)((m)->m_pkthdr.header))
-#endif
-
 
     /*
Index: /trunk/src/VBox/Devices/Network/slirp/ip_output.c
===================================================================
--- /trunk/src/VBox/Devices/Network/slirp/ip_output.c	(revision 30015)
+++ /trunk/src/VBox/Devices/Network/slirp/ip_output.c	(revision 30016)
@@ -123,14 +123,6 @@
     DEBUG_ARG("m0 = %lx", (long)m0);
 
-#ifndef VBOX_WITH_SLIRP_BSD_MBUF
-    if(m->m_data != (MBUF_HEAD(m) + if_maxlinkhdr))
-    {
-        LogRel(("NAT: ethernet detects corruption of the packet"));
-        AssertMsgFailed(("!!Ethernet frame corrupted!!"));
-    }
-#else
     M_ASSERTPKTHDR(m);
     Assert(m->m_pkthdr.header);
-#endif
 
 #if 0 /* We do no options */
@@ -151,35 +143,6 @@
     ipstat.ips_localout++;
 
-    /*
-     * Verify that we have any chance at all of being able to queue
-     *      the packet or packet fragments
-     */
-#if 0 /* XXX Hmmm... */
-    if (if_queued > if_thresh && towrite <= 0)
-    {
-        error = ENOBUFS;
-        goto exit_drop_package;
-    }
-#endif
     /* Current TCP/IP stack hasn't routing information at
      * all so we need to calculate destination ethernet address
-     */
-#ifndef VBOX_WITH_SLIRP_BSD_MBUF
-    eh = (struct ethhdr *)MBUF_HEAD(m);
-    if (memcmp(eh->h_source, zerro_ethaddr, ETH_ALEN) == 0)
-    {
-       rc = rt_lookup_in_cache(pData, ip->ip_dst.s_addr, eth_dst);
-       if (RT_FAILURE(rc))
-           goto exit_drop_package;
-    }
-    else
-    {
-       memcpy(eth_dst, eh->h_source, ETH_ALEN);
-       rc = 0; /*some times we've already know where to send packet*/
-    }
-#else
-    /*
-     * (vvl) Assumption is that m_data points at the IP header and only
-     * in case of dhcp we know and have header before IP.
      */
     rc = rt_lookup_in_cache(pData, ip->ip_dst.s_addr, eth_dst);
@@ -188,5 +151,4 @@
 
     eh = (struct ethhdr *)(m->m_data - ETH_HLEN);
-#endif
     /*
      * If small enough for interface, can just send directly.
@@ -200,10 +162,4 @@
 
         {
-#ifndef VBOX_WITH_SLIRP_BSD_MBUF
-            STAM_PROFILE_START(&pData->StatALIAS_output, b);
-            rc = LibAliasOut((m->m_la ? m->m_la : pData->proxy_alias),
-                mtod(m, char *), m->m_len);
-            Log2(("NAT: LibAlias return %d\n", rc));
-#else
             struct m_tag *t;
             STAM_PROFILE_START(&pData->StatALIAS_output, b);
@@ -220,5 +176,4 @@
                 goto exit_drop_package;
             }
-#endif
             STAM_PROFILE_STOP(&pData->StatALIAS_output, b);
         }
@@ -251,13 +206,9 @@
         int mhlen, firstlen = len;
         struct mbuf **mnext = &m->m_nextpkt;
-#ifdef VBOX_WITH_SLIRP_BSD_MBUF
         char *buf; /* intermediate buffer we'll use for copy from orriginal packet */
-#endif
         {
-#ifdef VBOX_WITH_SLIRP_BSD_MBUF
             struct m_tag *t;
             char *tmpbuf = NULL;
             int tmplen = 0;
-#endif
             int rcLa;
             HTONS(ip->ip_len);
@@ -265,8 +216,4 @@
             ip->ip_sum = 0;
             ip->ip_sum = cksum(m, hlen);
-#ifndef VBOX_WITH_SLIRP_BSD_MBUF
-            rcLa = LibAliasOut((m->m_la ? m->m_la : pData->proxy_alias),
-                                mtod(m, char *), m->m_len);
-#else
             if (m->m_next != NULL)
             {
@@ -304,5 +251,4 @@
                 goto exit_drop_package;
             }
-#endif
             NTOHS(ip->ip_len);
             NTOHS(ip->ip_off);
@@ -319,9 +265,5 @@
         {
             register struct ip *mhip;
-#ifndef VBOX_WITH_SLIRP_BSD_MBUF
-            m = m_get(pData);
-#else
             m = m_getcl(pData, M_NOWAIT, MT_HEADER, M_PKTHDR);
-#endif
             if (m == 0)
             {
@@ -334,7 +276,5 @@
             *mhip = *ip;
             m->m_len += ip->ip_hl << 2;
-#ifdef VBOX_WITH_SLIRP_BSD_MBUF
             m->m_pkthdr.header = mtod(m, void *);
-#endif
             /* we've calculated eth_dst for first packet */
 #if 0 /* No options */
@@ -354,11 +294,4 @@
             mhip->ip_len = RT_H2N_U16((u_int16_t)(len + mhlen));
 
-#ifndef VBOX_WITH_SLIRP_BSD_MBUF
-            if (m_copy(m, m0, off, len) < 0)
-            {
-                error = -1;
-                goto sendorfree;
-            }
-#else
             buf = RTMemAlloc(len);
             m_copydata(m0, off, len, buf); /* copy to buffer */
@@ -369,5 +302,4 @@
             RTMemFree(buf);
             m->m_len += RT_N2H_U16(mhip->ip_len);
-#endif
 
             mhip->ip_off = RT_H2N_U16((u_int16_t)mhip->ip_off);
@@ -396,11 +328,7 @@
             if (error == 0)
             {
-#ifndef VBOX_WITH_SLIRP_BSD_MBUF
-                eh = (struct ethhdr *)MBUF_HEAD(m);
-#else
                 m->m_data -= ETH_HLEN;
                 eh = mtod(m, struct ethhdr *);
                 m->m_data += ETH_HLEN;
-#endif
                 memcpy(eh->h_source, eth_dst, ETH_ALEN);
 
Index: /trunk/src/VBox/Devices/Network/slirp/libalias/alias.c
===================================================================
--- /trunk/src/VBox/Devices/Network/slirp/libalias/alias.c	(revision 30015)
+++ /trunk/src/VBox/Devices/Network/slirp/libalias/alias.c	(revision 30016)
@@ -1666,5 +1666,5 @@
 #endif
 
-#if defined(_KERNEL) || (defined(VBOX) && defined(VBOX_WITH_SLIRP_BSD_MBUF))
+#if defined(_KERNEL) || defined(VBOX)
 /*
  * m_megapullup() - this function is a big hack.
Index: /trunk/src/VBox/Devices/Network/slirp/libslirp.h
===================================================================
--- /trunk/src/VBox/Devices/Network/slirp/libslirp.h	(revision 30015)
+++ /trunk/src/VBox/Devices/Network/slirp/libslirp.h	(revision 30016)
@@ -88,7 +88,5 @@
 
 int slirp_set_binding_address(PNATState, char *addr);
-#ifdef VBOX_WITH_SLIRP_BSD_MBUF
 void slirp_set_mtu(PNATState, int);
-#endif
 
 #if defined(RT_OS_WINDOWS)
@@ -130,7 +128,4 @@
 struct mbuf *slirp_ext_m_get(PNATState pData, size_t cbMin, void **ppvBuf, size_t *pcbBuf);
 void slirp_ext_m_free(PNATState pData, struct mbuf *);
-#ifndef VBOX_WITH_SLIRP_BSD_MBUF
-void slirp_push_recv_thread(void *pvUser);
-#endif
 
 /*
Index: unk/src/VBox/Devices/Network/slirp/mbuf.c
===================================================================
--- /trunk/src/VBox/Devices/Network/slirp/mbuf.c	(revision 30015)
+++ 	(revision )
@@ -1,424 +1,0 @@
-/* $Id$ */
-/** @file
- * NAT - mbuf handling.
- */
-
-/*
- * Copyright (C) 2006-2010 Oracle Corporation
- *
- * This file is part of VirtualBox Open Source Edition (OSE), as
- * available from http://www.virtualbox.org. This file is free software;
- * you can redistribute it and/or modify it under the terms of the GNU
- * General Public License (GPL) as published by the Free Software
- * Foundation, in version 2 as it comes in the "COPYING" file of the
- * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
- */
-
-/*
- * This code is based on:
- *
- * Copyright (c) 1995 Danny Gasparovski
- *
- * Please read the file COPYRIGHT for the
- * terms and conditions of the copyright.
- */
-
-/*
- * mbuf's in SLiRP are much simpler than the real mbufs in
- * FreeBSD.  They are fixed size, determined by the MTU,
- * so that one whole packet can fit.  Mbuf's cannot be
- * chained together.  If there's more data than the mbuf
- * could hold, an external malloced buffer is pointed to
- * by m_ext (and the data pointers) and M_EXT is set in
- * the flags
- */
-#include <slirp.h>
-
-#define MBUF_ZONE_SIZE 100
-static int mbuf_zone_init(PNATState pData)
-{
-    struct mbuf_zone *mzone;
-    int i;
-    struct mbuf *m;
-    uint8_t *zone = RTMemAlloc(msize * MBUF_ZONE_SIZE);
-    if (zone == NULL)
-    {
-        LogRel(("NAT: can't allocate new zone\n"));
-        return -1;
-    }
-    mzone = RTMemAllocZ(sizeof (struct mbuf_zone));
-    if (mzone == NULL)
-    {
-        RTMemFree(zone);
-        LogRel(("NAT: can't allocate zone descriptor\n"));
-        return -1;
-    }
-
-    for (i = 0; i < MBUF_ZONE_SIZE; ++i)
-    {
-        m = (struct mbuf *)((char *)zone + i*msize);
-        memset(m, 0, sizeof(struct mbuf));
-#ifdef M_BUF_DEBUG
-        m->m_hdr.mh_id = pData->mbuf_zone_count * MBUF_ZONE_SIZE + i;
-#endif
-        insque(pData, m, &m_freelist);
-    }
-    mzone->mbuf_zone_base_addr = zone;
-    LIST_INSERT_HEAD(&pData->mbuf_zone_head, mzone, list);
-    pData->mbuf_zone_count++;
-    pData->mbuf_water_line_limit = pData->mbuf_zone_count * MBUF_ZONE_SIZE;
-    return 0;
-}
-
-void m_fini(PNATState pData)
-{
-    struct mbuf_zone *mz;
-    struct mbuf *m;
-    int i;
-    void *zone;
-    while(!LIST_EMPTY(&pData->mbuf_zone_head))
-    {
-        mz = LIST_FIRST(&pData->mbuf_zone_head);
-        zone = mz->mbuf_zone_base_addr;
-        for (i = 0; i < MBUF_ZONE_SIZE; ++i)
-        {
-            m = (struct mbuf *)((char *)zone + i*msize);
-            if (   (m->m_flags & M_EXT)
-                && m->m_ext != NULL)
-                RTMemFree(m->m_ext);
-        }
-        RTMemFree(zone);
-        LIST_REMOVE(mz, list);
-        RTMemFree(mz);
-    }
-}
-
-void
-m_init(PNATState pData)
-{
-    int rc = 0;
-    m_freelist.m_next = m_freelist.m_prev = &m_freelist;
-    m_usedlist.m_next = m_usedlist.m_prev = &m_usedlist;
-    mbuf_alloced = 0;
-    msize_init(pData);
-#if 1
-    rc = RTCritSectInit(&pData->cs_mbuf_zone);
-    AssertRC(rc);
-    rc = mbuf_zone_init(pData);
-    Assert((rc == 0));
-#endif
-}
-
-void
-msize_init(PNATState pData)
-{
-    /*
-     * Find a nice value for msize
-     */
-    msize = (if_mtu>if_mru ? if_mtu : if_mru)
-          + sizeof(struct m_hdr) + sizeof(void *)   /*pointer to the backstore*/
-          + if_maxlinkhdr ;
-}
-#ifdef m_get
-# undef m_get
-#endif
-
-#ifdef m_free
-# undef m_free
-#endif
-/*
- * Get an mbuf from the free list, if there are none
- * malloc one
- *
- * Because fragmentation can occur if we alloc new mbufs and
- * free old mbufs, we mark all mbufs above mbuf_thresh as M_DOFREE,
- * which tells m_free to actually free() it
- */
-struct mbuf *
-m_get(PNATState pData)
-{
-    register struct mbuf *m;
-    int flags = 0;
-    int rc = 0;
-
-    DEBUG_CALL("m_get");
-
-    rc = RTCritSectEnter(&pData->cs_mbuf_zone);
-    AssertRC(rc);
-
-recheck_zone:
-    if (m_freelist.m_next == &m_freelist)
-    {
-#if 1
-        rc = mbuf_zone_init(pData);
-        if (rc == 0)
-            goto recheck_zone;
-        AssertMsgFailed(("No mbufs on free list\n"));
-        m = NULL;
-        goto end_error;
-#else
-        m = (struct mbuf *)RTMemAlloc(msize);
-        if (m == NULL)
-            goto end_error;
-        mbuf_alloced++;
-        if (mbuf_alloced > mbuf_thresh)
-            flags = M_DOFREE;
-        if (mbuf_alloced > mbuf_max)
-            mbuf_max = mbuf_alloced;
-#endif
-    }
-    else
-    {
-        m = m_freelist.m_next;
-        remque(pData, m);
-    }
-
-    STAM_COUNTER_INC(&pData->StatMBufAllocation);
-    /* Insert it in the used list */
-    mbuf_alloced++;
-#if 0
-    if (mbuf_alloced >= MBUF_ZONE_SIZE/2)
-    {
-        pData->fmbuf_water_line = 1;
-    }
-#endif
-    insque(pData, m, &m_usedlist);
-    m->m_flags = (flags | M_USEDLIST);
-
-    /* Initialise it */
-    m->m_size = msize - sizeof(struct m_hdr);
-    m->m_data = m->m_dat;
-    m->m_len = 0;
-    m->m_nextpkt = 0;
-    m->m_prevpkt = 0;
-    m->m_la = NULL;
-    memset(m->m_data, 0, if_maxlinkhdr); /*initialization of ether area */
-
-end_error:
-    DEBUG_ARG("m = %lx", (long )m);
-    rc = RTCritSectLeave(&pData->cs_mbuf_zone);
-    AssertRC(rc);
-    return m;
-}
-
-void
-m_free(PNATState pData, struct mbuf *m)
-{
-    int rc;
-    DEBUG_CALL("m_free");
-    DEBUG_ARG("m = %lx", (long )m);
-
-    rc = RTCritSectEnter(&pData->cs_mbuf_zone);
-    AssertRC(rc);
-    mbuf_alloced--;
-    if(m)
-    {
-        /* Remove from m_usedlist */
-        if (m->m_flags & M_USEDLIST)
-            remque(pData, m);
-
-        /* If it's M_EXT, free() it */
-        if (m->m_flags & M_EXT)
-            RTMemFree(m->m_ext);
-
-        /*
-         * Either free() it or put it on the free list
-         */
-        if (m->m_flags & M_DOFREE)
-        {
-#if 1
-            if ((m->m_flags & M_EXT) == 0)
-                memset(m->m_dat, 0, if_mtu);
-            insque(pData, m, &m_freelist);
-            m->m_flags = M_FREELIST; /* Clobber other flags */
-#else
-            RTMemFree(m);
-#endif
-            mbuf_alloced--;
-        }
-        else if ((m->m_flags & M_FREELIST) == 0)
-        {
-            insque(pData, m,&m_freelist);
-            m->m_flags = M_FREELIST; /* Clobber other flags */
-        }
-        STAM_COUNTER_INC(&pData->StatMBufAllocation);
-    } /* if(m) */
-    rc = RTCritSectLeave(&pData->cs_mbuf_zone);
-    AssertRC(rc);
-}
-
-/* update macros for m_get/m_free*/
-#undef m_get
-#undef m_free
-#include "mbuf.h"
-
-/*
- * Copy data from one mbuf to the end of
- * the other.. if result is too big for one mbuf, malloc()
- * an M_EXT data segment
- */
-void
-m_cat(PNATState pData, register struct mbuf *m, register struct mbuf *n)
-{
-    /*
-     * If there's no room, realloc
-     */
-    if (M_FREEROOM(m) < n->m_len)
-        m_inc(m,m->m_size+MINCSIZE);
-
-    memcpy(m->m_data+m->m_len, n->m_data, n->m_len);
-    m->m_len += n->m_len;
-
-    m_free(pData, n);
-}
-
-
-/* make m size bytes large */
-void
-m_inc(struct mbuf *m, int size)
-{
-    int datasize;
-
-    /* some compiles throw up on gotos.  This one we can fake. */
-    if (m->m_size > size)
-        return;
-
-    if (m->m_flags & M_EXT)
-    {
-        void *pvNew;
-        datasize = m->m_data - m->m_ext;
-        pvNew = (char *)RTMemRealloc(m->m_ext, size);
-        if (pvNew)
-            return; /** @todo better error reporting. */
-        m->m_ext = (char *)pvNew;
-        m->m_data = m->m_ext + datasize;
-    }
-    else
-    {
-        char *dat;
-        datasize = m->m_data - m->m_dat;
-        dat = (char *)RTMemAlloc(size);
-        if (!dat)
-            return; /** @todo better error reporting. */
-        memcpy(dat, m->m_dat, m->m_size);
-
-        m->m_ext = dat;
-        m->m_data = m->m_ext + datasize;
-        m->m_flags |= M_EXT;
-    }
-
-    m->m_size = size;
-}
-
-
-void
-m_adj(struct mbuf *m, int len)
-{
-    if (m == NULL)
-        return;
-    if (len >= 0)
-    {
-        /* Trim from head */
-        m->m_data += len;
-        m->m_len -= len;
-    }
-    else
-    {
-        /* Trim from tail */
-        len = -len;
-        m->m_len -= len;
-    }
-    Assert(m->m_len >= 0);
-}
-
-
-/*
- * Copy len bytes from m, starting off bytes into n
- */
-int
-m_copy(struct mbuf *n, struct mbuf *m, int off, int len)
-{
-    if (len > M_FREEROOM(n))
-        return -1;
-
-    memcpy((n->m_data + n->m_len), (m->m_data + off), len);
-    n->m_len += len;
-    return 0;
-}
-
-
-/*
- * Given a pointer into an mbuf, return the mbuf
- * XXX This is a kludge, I should eliminate the need for it
- * Fortunately, it's not used often
- */
-struct mbuf *
-dtom(PNATState pData, void *dat)
-{
-    struct mbuf *m;
-
-    DEBUG_CALL("dtom");
-    DEBUG_ARG("dat = %lx", (long )dat);
-
-    /* bug corrected for M_EXT buffers */
-    for (m = m_usedlist.m_next; m != &m_usedlist; m = m->m_next)
-    {
-        if (m->m_flags & M_EXT)
-        {
-            if (   (char *)dat >=  m->m_ext
-                && (char *)dat <  (m->m_ext + m->m_size))
-                return m;
-        }
-        else
-        {
-            if (   (char *)dat >=  m->m_dat
-                && (char *)dat <  (m->m_dat + m->m_size))
-                return m;
-        }
-    }
-
-    DEBUG_ERROR((dfd, "dtom failed"));
-
-    return (struct mbuf *)0;
-}
-
-#ifndef VBOX_WITH_SLIRP_BSD_MBUF
-
-/**
- * Interface that DrvNAT.cpp uses for allocating a buffer.
- *
- * @returns Opaque m_buf pointer.
- *
- * @param   pData       The NAT state.
- * @param   cbMin       The minimum buffer size.
- * @param   ppvBuf      Where to return the pointer to the start of the data
- *                      buffer.
- * @param   pcbBuf      Where to return the actual buffer size.
- */
-struct mbuf *slirp_ext_m_get(PNATState pData, size_t cbMin, void **ppvBuf, size_t *pcbBuf)
-{
-    struct mbuf *m = m_get(pData);
-    if (!m)
-        return NULL;
-    if (cbMin > M_FREEROOM(m))
-    {
-        m_inc(m, cbMin);
-        if (RT_UNLIKELY(cbMin > M_FREEROOM(m)))
-        {
-            m_free(pData, m);
-            return NULL;
-        }
-    }
-
-    *ppvBuf = mtod(m, void *);
-    *pcbBuf = M_FREEROOM(m);
-    return m;
-}
-
-void slirp_ext_m_free(PNATState pData, struct mbuf *m)
-{
-    m_free(pData, m);
-}
-
-#endif /* VBOX_WITH_SLIRP_BSD_MBUF */
Index: unk/src/VBox/Devices/Network/slirp/mbuf.h
===================================================================
--- /trunk/src/VBox/Devices/Network/slirp/mbuf.h	(revision 30015)
+++ 	(revision )
@@ -1,206 +1,0 @@
-/* $Id$ */
-/** @file
- * NAT - mbuf handling (declarations/defines).
- */
-
-/*
- * Copyright (C) 2006-2010 Oracle Corporation
- *
- * This file is part of VirtualBox Open Source Edition (OSE), as
- * available from http://www.virtualbox.org. This file is free software;
- * you can redistribute it and/or modify it under the terms of the GNU
- * General Public License (GPL) as published by the Free Software
- * Foundation, in version 2 as it comes in the "COPYING" file of the
- * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
- */
-
-/*
- * This code is based on:
- *
- * Copyright (c) 1982, 1986, 1988, 1993
- *      The Regents of the University of California.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *    must display the following acknowledgement:
- *      This product includes software developed by the University of
- *      California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- *      @(#)mbuf.h      8.3 (Berkeley) 1/21/94
- * mbuf.h,v 1.9 1994/11/14 13:54:20 bde Exp
- */
-
-#ifndef _MBUF_H_
-#define _MBUF_H_
-
-#ifndef VBOX_WITH_SLIRP_BSD_MBUF
-/* #define M_BUF_DEBUG */
-
-#define m_freem m_free
-
-
-#define MINCSIZE 4096   /* Amount to increase mbuf if too small */
-
-/*
- * Macros for type conversion
- * mtod(m,t) -  convert mbuf pointer to data pointer of correct type
- * dtom(x) -    convert data pointer within mbuf to mbuf pointer (XXX)
- */
-#define mtod(m,t)       ((t)(m)->m_data)
-/* #define      dtom(x)         ((struct mbuf *)((int)(x) & ~(M_SIZE-1))) */
-
-/* XXX About mbufs for slirp:
- * Only one mbuf is ever used in a chain, for each "cell" of data.
- * m_nextpkt points to the next packet, if fragmented.
- * If the data is too large, the M_EXT is used, and a larger block
- * is alloced.  Therefore, m_free[m] must check for M_EXT and if set
- * free the m_ext.  This is inefficient memory-wise, but who cares.
- */
-
-/* XXX should union some of these! */
-/* header at beginning of each mbuf: */
-struct m_hdr
-{
-    struct  mbuf *mh_next;     /* Linked list of mbufs */
-    struct  mbuf *mh_prev;
-    struct  mbuf *mh_nextpkt;  /* Next packet in queue/record */
-    struct  mbuf *mh_prevpkt;  /* Flags aren't used in the output queue */
-    int     mh_flags;          /* Misc flags */
-
-    int     mh_size;           /* Size of data */
-    struct  socket *mh_so;
-
-    caddr_t mh_data;           /* Location of data */
-    int     mh_len;            /* Amount of data in this mbuf */
-    struct libalias *mh_la;     /*Real freebsd store hocksin similar way*/
-#ifdef M_BUF_DEBUG
-    int mh_id;
-    char *mh_allocation_at_file;
-    int mh_allocation_at_line;
-#endif
-};
-
-/*
- * How much room is in the mbuf, from m_data to the end of the mbuf
- */
-#define M_ROOM(m) ((m->m_flags & M_EXT)? \
-                        (((m)->m_ext + (m)->m_size) - (m)->m_data) \
-                   : \
-                        (((m)->m_dat + (m)->m_size) - (m)->m_data))
-
-/*
- * How much free room there is
- */
-#define M_FREEROOM(m) (M_ROOM(m) - (m)->m_len)
-#define M_TRAILINGSPACE M_FREEROOM
-
-struct mbuf
-{
-    struct  m_hdr m_hdr;
-    union M_dat
-    {
-        char    m_dat_[1]; /* ANSI don't like 0 sized arrays */
-        char    *m_ext_;
-    } M_dat;
-};
-
-#define m_next          m_hdr.mh_next
-#define m_prev          m_hdr.mh_prev
-#define m_nextpkt       m_hdr.mh_nextpkt
-#define m_prevpkt       m_hdr.mh_prevpkt
-#define m_flags         m_hdr.mh_flags
-#define m_len           m_hdr.mh_len
-#define m_data          m_hdr.mh_data
-#define m_size          m_hdr.mh_size
-#define m_dat           M_dat.m_dat_
-#define m_ext           M_dat.m_ext_
-#define m_so            m_hdr.mh_so
-#define m_la            m_hdr.mh_la
-
-#define ifq_prev m_prev
-#define ifq_next m_next
-#define ifs_prev m_prevpkt
-#define ifs_next m_nextpkt
-#define ifq_so m_so
-
-#define M_EXT                   0x01    /* m_ext points to more (malloced) data */
-#define M_FREELIST              0x02    /* mbuf is on free list */
-#define M_USEDLIST              0x04    /* XXX mbuf is on used list (for dtom()) */
-#define M_DOFREE                0x08    /* when m_free is called on the mbuf, free()
-                                         * it rather than putting it on the free list */
-#define M_FRAG                0x0800    /* packet is a fragment of a larger packet */
-#define M_FIRSTFRAG           0x1000    /* paket is first fragment */
-#define M_LASTFRAG            0x2000    /* paket is last fragment */
-
-extern int mbuf_alloced;
-extern struct mbuf m_freelist, m_usedlist;
-extern int mbuf_max;
-
-void m_init (PNATState);
-void m_fini(PNATState pData);
-void msize_init (PNATState);
-struct mbuf * m_get (PNATState);
-void m_free (PNATState, struct mbuf *);
-void m_cat (PNATState, register struct mbuf *, register struct mbuf *);
-void m_inc (struct mbuf *, int);
-void m_adj (struct mbuf *, int);
-int m_copy (struct mbuf *, struct mbuf *, int, int);
-struct mbuf * dtom (PNATState, void *);
-
-/*
- * this macro should be used for validation and copying of Ethernet header where it really requred
- */
-#define MBUF_HEAD(m) ((caddr_t)(((m)->m_flags & M_EXT) ? (m)->m_ext : (m)->m_dat))
-
-#define MBUF_IP_HEADER(m) (caddr_t)(MBUF_HEAD(m) + if_maxlinkhdr)
-
-#else /* VBOX_WITH_SLIRP_BSD_MBUF */
-# include "bsd/sys/mbuf.h"
-#endif /* VBOX_WITH_SLIRP_BSD_MBUF */
-
-#endif /* _MBUF_H_ */
-
-#if defined(M_BUF_DEBUG) && !defined(RT_OS_WINDOWS)
-# define m_get(x)                                                                                               \
-({                                                                                                              \
-    struct mbuf *mdb = m_get((x));                                                                              \
-    if(mdb)                                                                                                     \
-    {                                                                                                           \
-        mdb->m_hdr.mh_allocation_at_file = __FILE__;                                                            \
-        mdb->m_hdr.mh_allocation_at_line = __LINE__;                                                            \
-    }                                                                                                           \
-    LogRel(("NAT:m(id:%d, ptr: %p) allocated at: %s:%d\n", (mdb?mdb->m_hdr.mh_id:-1), mdb, __FILE__, __LINE__));\
-    mdb;                                                                                                        \
-})
-
-# define m_free(x, m)                                                                               \
-({                                                                                                  \
-    (m)->m_hdr.mh_allocation_at_file = NULL;                                                        \
-    (m)->m_hdr.mh_allocation_at_line = 0;                                                           \
-    LogRel(("NAT:m(id:%d, ptr: %p) freed at: %s:%d\n", (m)->m_hdr.mh_id, (m), __FILE__, __LINE__)); \
-    m_free((x),(m));                                                                                \
-})
-#endif
Index: /trunk/src/VBox/Devices/Network/slirp/misc.c
===================================================================
--- /trunk/src/VBox/Devices/Network/slirp/misc.c	(revision 30015)
+++ /trunk/src/VBox/Devices/Network/slirp/misc.c	(revision 30016)
@@ -97,5 +97,4 @@
 
 
-#ifdef VBOX_WITH_SLIRP_BSD_MBUF
 #define ITEM_MAGIC 0xdead0001
 struct item
@@ -445,3 +444,12 @@
     /*@todo do finalize here.*/
 }
-#endif /* VBOX_WITH_SLIRP_BSD_MBUF */
+
+void
+if_init(PNATState pData)
+{
+    /* 14 for ethernet */
+    if_maxlinkhdr = 14;
+    if_comp = IF_AUTOCOMP;
+    if_mtu = 1500;
+    if_mru = 1500;
+}
Index: /trunk/src/VBox/Devices/Network/slirp/misc.h
===================================================================
--- /trunk/src/VBox/Devices/Network/slirp/misc.h	(revision 30015)
+++ /trunk/src/VBox/Devices/Network/slirp/misc.h	(revision 30016)
@@ -34,5 +34,4 @@
 void fd_nonblock (int);
 
-#ifdef VBOX_WITH_SLIRP_BSD_MBUF
 /* UVM interface */
 #define UMA_ALIGN_PTR       (1 << 0)
@@ -68,5 +67,4 @@
 void slirp_null_arg_free(void *, void *);
 void m_fini(PNATState pData);
-#endif /* VBOX_WITH_SLIRP_BSD_MBUF */
 
 #endif
Index: /trunk/src/VBox/Devices/Network/slirp/sbuf.c
===================================================================
--- /trunk/src/VBox/Devices/Network/slirp/sbuf.c	(revision 30015)
+++ /trunk/src/VBox/Devices/Network/slirp/sbuf.c	(revision 30016)
@@ -109,8 +109,6 @@
 {
     int ret = 0;
-#ifdef VBOX_WITH_SLIRP_BSD_MBUF
     int mlen = 0;
     caddr_t buf = NULL;
-#endif
 
     STAM_PROFILE_START(&pData->StatIOSBAppend_pf, a);
@@ -122,10 +120,6 @@
     STAM_COUNTER_INC(&pData->StatIOSBAppend);
     /* Shouldn't happen, but...  e.g. foreign host closes connection */
-#ifndef VBOX_WITH_SLIRP_BSD_MBUF
-    if (m->m_len <= 0)
-#else
     mlen = m_length(m, NULL);
     if (mlen <= 0)
-#endif
     {
         STAM_COUNTER_INC(&pData->StatIOSBAppend_zm);
@@ -150,8 +144,4 @@
      * ottherwise it'll arrive out of order, and hence corrupt
      */
-#ifndef VBOX_WITH_SLIRP_BSD_MBUF
-    if(!so->so_rcv.sb_cc)
-        ret = send(so->s, m->m_data, m->m_len, 0);
-#else
     buf = RTMemAlloc(mlen);
     if (buf == NULL)
@@ -165,5 +155,4 @@
     RTMemFree(buf);
 no_sent:
-#endif
 
     if (ret <= 0)
@@ -180,9 +169,5 @@
         goto done;
     }
-#ifndef VBOX_WITH_SLIRP_BSD_MBUF
-    else if (ret != m->m_len)
-#else
     else if (ret != mlen)
-#endif
     {
         STAM_COUNTER_INC(&pData->StatIOSBAppend_wp);
@@ -191,10 +176,5 @@
          * sbappendsb the rest
          */
-#ifndef VBOX_WITH_SLIRP_BSD_MBUF
-        m->m_len -= ret;
-        m->m_data += ret;
-#else
         m_adj(m, ret);
-#endif
         sbappendsb(pData, &so->so_rcv, m);
         STAM_PROFILE_STOP(&pData->StatIOSBAppend_pf_wp, a);
@@ -217,9 +197,5 @@
     int len, n,  nn;
 
-#ifndef VBOX_WITH_SLIRP_BSD_MBUF
-    len = m->m_len;
-#else
     len = m_length(m, NULL);
-#endif
 
     STAM_COUNTER_INC(&pData->StatIOSBAppendSB);
@@ -230,9 +206,5 @@
         if (n > len)
             n = len;
-#ifndef VBOX_WITH_SLIRP_BSD_MBUF
-        memcpy(sb->sb_wptr, m->m_data, n);
-#else
         m_copydata(m, 0, n, sb->sb_wptr);
-#endif
     }
     else
@@ -243,9 +215,5 @@
         if (n > len)
             n = len;
-#ifndef VBOX_WITH_SLIRP_BSD_MBUF
-        memcpy(sb->sb_wptr, m->m_data, n);
-#else
         m_copydata(m, 0, n, sb->sb_wptr);
-#endif
         len -= n;
         if (len)
@@ -255,9 +223,5 @@
             if (nn > len)
                 nn = len;
-#ifndef VBOX_WITH_SLIRP_BSD_MBUF
-            memcpy(sb->sb_data, m->m_data+n, nn);
-#else
             m_copydata(m, n, nn, sb->sb_data);
-#endif
             n += nn;
         }
Index: /trunk/src/VBox/Devices/Network/slirp/slirp.c
===================================================================
--- /trunk/src/VBox/Devices/Network/slirp/slirp.c	(revision 30015)
+++ /trunk/src/VBox/Devices/Network/slirp/slirp.c	(revision 30016)
@@ -626,9 +626,5 @@
 
     /* Initialise mbufs *after* setting the MTU */
-#ifndef VBOX_WITH_SLIRP_BSD_MBUF
-    m_init(pData);
-#else
     mbuf_init(pData);
-#endif
 
     pData->special_addr.s_addr = u32NetAddr;
@@ -899,18 +895,4 @@
         so->so_poll_index = -1;
 #endif
-#ifndef VBOX_WITH_SLIRP_BSD_MBUF
-        if (pData->fmbuf_water_line == 1)
-        {
-            if (mbuf_alloced < pData->mbuf_water_line_limit/2)
-            {
-                pData->fmbuf_water_warn_sent = 0;
-                pData->fmbuf_water_line = 0;
-            }
-# ifndef RT_OS_WINDOWS
-            poll_index = 0;
-# endif
-            goto done;
-        }
-#endif /* !VBOX_WITH_SLIRP_BSD_MBUF */
         STAM_COUNTER_INC(&pData->StatTCP);
 
@@ -983,18 +965,4 @@
     /* { */
 
-#ifndef VBOX_WITH_SLIRP_BSD_MBUF
-        if (pData->fmbuf_water_line == 1)
-        {
-            if (mbuf_alloced < pData->mbuf_water_line_limit/2)
-            {
-                pData->fmbuf_water_line = 0;
-                pData->fmbuf_water_warn_sent = 0;
-            }
-# ifndef RT_OS_WINDOWS
-            poll_index = 0;
-# endif
-            goto done;
-        }
-#endif /* !VBOX_WITH_SLIRP_BSD_MBUF */
         STAM_COUNTER_INC(&pData->StatUDP);
 #if !defined(RT_OS_WINDOWS)
@@ -1124,15 +1092,4 @@
     QSOCKET_FOREACH(so, so_next, tcp)
     /* { */
-#ifndef VBOX_WITH_SLIRP_BSD_MBUF
-        if (pData->fmbuf_water_line == 1)
-        {
-            if (mbuf_alloced < pData->mbuf_water_line_limit/2)
-            {
-                pData->fmbuf_water_line = 0;
-                pData->fmbuf_water_warn_sent = 0;
-            }
-            goto done;
-        }
-#endif
 
 #ifdef VBOX_WITH_SLIRP_MT
@@ -1355,15 +1312,4 @@
      QSOCKET_FOREACH(so, so_next, udp)
      /* { */
-#ifndef VBOX_WITH_SLIRP_BSD_MBUF
-        if (pData->fmbuf_water_line == 1)
-        {
-            if (mbuf_alloced < pData->mbuf_water_line_limit/2)
-            {
-                pData->fmbuf_water_line = 0;
-                pData->fmbuf_water_warn_sent = 0;
-            }
-            goto done;
-        }
-#endif
 #ifdef VBOX_WITH_SLIRP_MT
         if (   so->so_state & SS_NOFDREF
@@ -1408,11 +1354,4 @@
 
 done:
-#if 0
-    /*
-     * See if we can start outputting
-     */
-    if (if_queued && link_up)
-        if_start(pData);
-#endif
 
     STAM_PROFILE_STOP(&pData->StatPoll, a);
@@ -1458,17 +1397,4 @@
     {
         case ARPOP_REQUEST:
-#ifndef VBOX_WITH_SLIRP_BSD_MBUF
-            mr = m_get(pData);
-
-            reh = mtod(mr, struct ethhdr *);
-            memcpy(reh->h_source, eh->h_source, ETH_ALEN); /* XXX: if_encap will swap src and dst*/
-            Log4(("NAT: arp:%R[ether]->%R[ether]\n",
-                reh->h_source, reh->h_dest));
-            Log4(("NAT: arp: %R[IP4]\n", &tip));
-
-            mr->m_data += if_maxlinkhdr;
-            mr->m_len = sizeof(struct arphdr);
-            rah = mtod(mr, struct arphdr *);
-#else
             mr = m_getcl(pData, M_NOWAIT, MT_HEADER, M_PKTHDR);
             if (mr == NULL)
@@ -1480,5 +1406,4 @@
             Assert(mr);
             memcpy(reh->h_source, eh->h_source, ETH_ALEN); /* XXX: if_encap will swap src and dst*/
-#endif
 #ifdef VBOX_WITH_NAT_SERVICE
             if (tip == pData->special_addr.s_addr)
@@ -1587,17 +1512,6 @@
             updtime(pData);
             m_adj(m, ETH_HLEN);
-#ifdef VBOX_WITH_SLIRP_BSD_MBUF
             M_ASSERTPKTHDR(m);
             m->m_pkthdr.header = mtod(m, void *);
-#else /* !VBOX_WITH_SLIRP_BSD_MBUF */
-            if (   pData->fmbuf_water_line
-                && pData->fmbuf_water_warn_sent == 0
-                && (curtime - pData->tsmbuf_water_warn_sent) > 500)
-            {
-                icmp_error(pData, m, ICMP_SOURCEQUENCH, 0, 0, "Out of resources!!!");
-                pData->fmbuf_water_warn_sent = 1;
-                pData->tsmbuf_water_warn_sent = curtime;
-            }
-#endif /* !VBOX_WITH_SLIRP_BSD_MBUF */
             ip_input(pData, m);
             break;
@@ -1630,20 +1544,8 @@
     STAM_PROFILE_START(&pData->StatIF_encap, a);
 
-#ifndef VBOX_WITH_SLIRP_BSD_MBUF
-    m->m_data -= if_maxlinkhdr;
-    m->m_len += ETH_HLEN;
-    eh = mtod(m, struct ethhdr *);
-
-    if (MBUF_HEAD(m) != m->m_data)
-    {
-        LogRel(("NAT: ethernet detects corruption of the packet"));
-        AssertMsgFailed(("!!Ethernet frame corrupted!!"));
-    }
-#else
     M_ASSERTPKTHDR(m);
     m->m_data -= ETH_HLEN;
     m->m_len += ETH_HLEN;
     eh = mtod(m, struct ethhdr *);
-#endif
 
     if (memcmp(eh->h_source, special_ethaddr, ETH_ALEN) != 0)
@@ -1659,7 +1561,4 @@
         }
     }
-#ifndef VBOX_WITH_SLIRP_BSD_MBUF
-    mlen = m->m_len;
-#else
     mlen = m_length(m, NULL);
     buf = RTMemAlloc(mlen);
@@ -1670,7 +1569,5 @@
         goto done;
     }
-#endif
     eh->h_proto = RT_H2N_U16(eth_proto);
-#ifdef VBOX_WITH_SLIRP_BSD_MBUF
     m_copydata(m, 0, mlen, (char *)buf);
     if (flags & ETH_ENCAP_URG)
@@ -1678,10 +1575,4 @@
     else
         slirp_output(pData->pvUser, m, buf, mlen);
-#else
-    if (flags & ETH_ENCAP_URG)
-        slirp_urg_output(pData->pvUser, m, mtod(m, const uint8_t *), mlen);
-    else
-        slirp_output(pData->pvUser, m, mtod(m, const uint8_t *), mlen);
-#endif
 done:
     STAM_PROFILE_STOP(&pData->StatIF_encap, a);
@@ -2048,9 +1939,5 @@
     struct arphdr *ahdr;
 
-#ifndef VBOX_WITH_SLIRP_BSD_MBUF
-    m = m_get(pData);
-#else
     m = m_getcl(pData, M_NOWAIT, MT_HEADER, M_PKTHDR);
-#endif
     if (m == NULL)
     {
@@ -2070,13 +1957,8 @@
     memset(ahdr->ar_tha, 0xff, ETH_ALEN); /*broadcast*/
     *(uint32_t *)ahdr->ar_tip = dst;
-#ifndef VBOX_WITH_SLIRP_BSD_MBUF
-    m->m_data += if_maxlinkhdr;
-    m->m_len = sizeof(struct arphdr);
-#else
     /* warn!!! should falls in mbuf minimal size */
     m->m_len = sizeof(struct arphdr) + ETH_HLEN;
     m->m_data += ETH_HLEN;
     m->m_len -= ETH_HLEN;
-#endif
     if_encap(pData, ETH_P_ARP, m, ETH_ENCAP_URG);
 }
@@ -2122,5 +2004,4 @@
 }
 
-#ifdef VBOX_WITH_SLIRP_BSD_MBUF
 void slirp_set_mtu(PNATState pData, int mtu)
 {
@@ -2133,3 +2014,2 @@
     if_mru = mtu;
 }
-#endif
Index: /trunk/src/VBox/Devices/Network/slirp/slirp.h
===================================================================
--- /trunk/src/VBox/Devices/Network/slirp/slirp.h	(revision 30015)
+++ /trunk/src/VBox/Devices/Network/slirp/slirp.h	(revision 30016)
@@ -248,7 +248,7 @@
 #include "icmp_var.h"
 #include "mbuf.h"
+#include "if.h"
 #include "sbuf.h"
 #include "socket.h"
-#include "if.h"
 #include "main.h"
 #include "misc.h"
@@ -286,11 +286,7 @@
 
 /* cksum.c */
-#ifndef VBOX_WITH_SLIRP_BSD_MBUF
-int cksum(struct mbuf *m, int len);
-#else
 typedef uint16_t u_short;
 typedef unsigned int u_int;
 #include "in_cksum.h"
-#endif
 
 /* if.c */
@@ -419,5 +415,4 @@
 #endif /*VBOX_SLIRP_ALIAS*/
 
-#ifdef VBOX_WITH_SLIRP_BSD_MBUF
 /**
  * @todo might be useful to make it configurable, especially in terms of Intnet behind NAT
@@ -446,5 +441,4 @@
 void mbuf_init(void *);
 # define cksum(m, len) in_cksum_skip((m), (len), 0)
-#endif
 
 int ftp_alias_load(PNATState);
Index: /trunk/src/VBox/Devices/Network/slirp/slirp_state.h
===================================================================
--- /trunk/src/VBox/Devices/Network/slirp/slirp_state.h	(revision 30015)
+++ /trunk/src/VBox/Devices/Network/slirp/slirp_state.h	(revision 30016)
@@ -72,7 +72,5 @@
 };
 TAILQ_HEAD(dns_list_head, dns_entry);
-#ifdef VBOX_WITH_SLIRP_BSD_MBUF
 TAILQ_HEAD(if_queue, mbuf);
-#endif
 
 struct port_forward_rule
@@ -91,12 +89,4 @@
 LIST_HEAD(port_forward_rule_list, port_forward_rule);
 
-#ifndef VBOX_WITH_SLIRP_BSD_MBUF
-struct mbuf_zone
-{
-    LIST_ENTRY(mbuf_zone) list;
-    uint8_t *mbuf_zone_base_addr;
-};
-LIST_HEAD(mbuf_zone_list, mbuf_zone);
-#endif
 
 
@@ -119,12 +109,4 @@
     int if_queued;
     int if_thresh;
-#ifndef VBOX_WITH_SLIRP_BSD_MBUF
-    struct mbuf if_fastq;
-    struct mbuf if_batchq;
-#else
-    struct if_queue if_fastq;
-    struct if_queue if_batchq;
-#endif
-    struct mbuf *next_m;
     /* Stuff from icmp.c */
     struct icmpstat_t icmpstat;
@@ -137,16 +119,4 @@
     uint16_t ip_currid;
     /* Stuff from mbuf.c */
-    int mbuf_alloced, mbuf_max;
-    int msize;
-    struct mbuf m_freelist, m_usedlist;
-#ifndef VBOX_WITH_SLIRP_BSD_MBUF
-    struct mbuf_zone_list mbuf_zone_head;
-    RTCRITSECT cs_mbuf_zone;
-    int fmbuf_water_line;
-    int mbuf_water_line_limit;
-    int mbuf_zone_count;
-    int fmbuf_water_warn_sent;
-    uint32_t tsmbuf_water_warn_sent;
-#endif
     /* Stuff from slirp.c */
     void *pvUser;
@@ -242,31 +212,30 @@
     HANDLE phEvents[VBOX_EVENT_COUNT];
 #endif
-#ifdef VBOX_WITH_SLIRP_BSD_MBUF
-# ifdef zone_mbuf
-#  undef zone_mbuf
-# endif
+#ifdef zone_mbuf
+# undef zone_mbuf
+#endif
     uma_zone_t zone_mbuf;
-# ifdef zone_clust
-#  undef zone_clust
-# endif
+#ifdef zone_clust
+# undef zone_clust
+#endif
     uma_zone_t zone_clust;
-# ifdef zone_pack
-#  undef zone_pack
-# endif
+#ifdef zone_pack
+# undef zone_pack
+#endif
     uma_zone_t zone_pack;
-# ifdef zone_jumbop
-#  undef zone_jumbop
-# endif
+#ifdef zone_jumbop
+# undef zone_jumbop
+#endif
     uma_zone_t zone_jumbop;
-# ifdef zone_jumbo9
-#  undef zone_jumbo9
-# endif
+#ifdef zone_jumbo9
+# undef zone_jumbo9
+#endif
     uma_zone_t zone_jumbo9;
-# ifdef zone_jumbo16
-#  undef zone_jumbo16
-# endif
+#ifdef zone_jumbo16
+# undef zone_jumbo16
+#endif
     uma_zone_t zone_jumbo16;
-# ifdef zone_ext_refcnt
-#  undef zone_ext_refcnt
+#ifdef zone_ext_refcnt
+# undef zone_ext_refcnt
     int nmbclusters;                    /* limits number of mbuf clusters */
     int nmbjumbop;                      /* limits number of page size jumbo clusters */
@@ -274,7 +243,6 @@
     int nmbjumbo16;                     /* limits number of 16k jumbo clusters */
     struct mbstat mbstat;
-# endif
+#endif
     uma_zone_t zone_ext_refcnt;
-#endif
     bool fUseHostResolver;
     /* from dnsproxy/dnsproxy.h*/
@@ -372,7 +340,4 @@
 #define if_queued pData->if_queued
 #define if_thresh pData->if_thresh
-#define if_fastq pData->if_fastq
-#define if_batchq pData->if_batchq
-#define next_m pData->next_m
 
 #define icmpstat pData->icmpstat
@@ -709,18 +674,17 @@
 #define instancehead pData->instancehead
 
-#ifdef VBOX_WITH_SLIRP_BSD_MBUF
-# define nmbclusters    pData->nmbclusters
-# define nmbjumbop  pData->nmbjumbop
-# define nmbjumbo9  pData->nmbjumbo9
-# define nmbjumbo16 pData->nmbjumbo16
-# define mbstat pData->mbstat
-# include "ext.h"
-# undef zone_mbuf
-# undef zone_clust
-# undef zone_pack
-# undef zone_jumbop
-# undef zone_jumbo9
-# undef zone_jumbo16
-# undef zone_ext_refcnt
+#define nmbclusters    pData->nmbclusters
+#define nmbjumbop  pData->nmbjumbop
+#define nmbjumbo9  pData->nmbjumbo9
+#define nmbjumbo16 pData->nmbjumbo16
+#define mbstat pData->mbstat
+#include "ext.h"
+#undef zone_mbuf
+#undef zone_clust
+#undef zone_pack
+#undef zone_jumbop
+#undef zone_jumbo9
+#undef zone_jumbo16
+#undef zone_ext_refcnt
 static inline uma_zone_t slirp_zone_pack(PNATState pData)
 {
@@ -754,5 +718,4 @@
 # define m_adj(m, len) m_adj(pData, (m), (len))
 #endif
-#endif
 
 #endif /* !___slirp_state_h */
Index: /trunk/src/VBox/Devices/Network/slirp/socket.c
===================================================================
--- /trunk/src/VBox/Devices/Network/slirp/socket.c	(revision 30015)
+++ /trunk/src/VBox/Devices/Network/slirp/socket.c	(revision 30016)
@@ -588,7 +588,5 @@
         ssize_t len;
         u_long n = 0;
-#ifdef VBOX_WITH_SLIRP_BSD_MBUF
         int size;
-#endif
         int rc = 0;
         static int signalled = 0;
@@ -598,53 +596,4 @@
         QSOCKET_UNLOCK(udb);
 
-#ifndef VBOX_WITH_SLIRP_BSD_MBUF
-        if (!(m = m_get(pData)))
-        {
-            SOCKET_UNLOCK(so);
-            return;
-        }
-        /* adjust both parameters to maks M_FREEROOM calculate correct */
-        m->m_data += if_maxlinkhdr + sizeof(struct udphdr) + sizeof(struct ip);
-
-        /*
-         * XXX Shouldn't FIONREAD packets destined for port 53,
-         * but I don't know the max packet size for DNS lookups
-         */
-        len = M_FREEROOM(m);
-        /* if (so->so_fport != RT_H2N_U16_C(53)) */
-        rc = ioctlsocket(so->s, FIONREAD, &n);
-        if (   rc == -1
-            && (  errno == EAGAIN
-               || errno == EWOULDBLOCK
-               || errno == EINPROGRESS
-               || errno == ENOTCONN))
-        {
-            m_freem(pData, m);
-            return;
-        }
-
-        Log2(("NAT: %R[natsock] ioctlsocket before read "
-            "(rc:%d errno:%d, n:%d)\n", so, rc, errno, n));
-
-        if (rc == -1 && signalled == 0)
-        {
-            LogRel(("NAT: can't fetch amount of bytes on socket %R[natsock], so message will be truncated.\n", so));
-            signalled = 1;
-            m_freem(pData, m);
-            return;
-        }
-
-        if (rc != -1 && n > len)
-        {
-            n = (m->m_data - m->m_dat) + m->m_len + n + 1;
-            m_inc(m, n);
-            len = M_FREEROOM(m);
-        }
-        ret = recvfrom(so->s, m->m_data, len, 0,
-                            (struct sockaddr *)&addr, &addrlen);
-        Log2(("NAT: %R[natsock] ioctlsocket after read "
-            "(rc:%d errno:%d, n:%d) ret:%d, len:%d\n", so,
-             rc, errno, n, ret, len));
-#else
         /*How many data has been received ?*/
         /*
@@ -688,5 +637,4 @@
                             (struct sockaddr *)&addr, &addrlen);
         /* @todo (vvl) check which flags and type should be passed */
-#endif
         m->m_len = ret;
         if (ret < 0)
@@ -763,8 +711,6 @@
     struct sockaddr_in host_addr;
 #endif
-#ifdef VBOX_WITH_SLIRP_BSD_MBUF
     caddr_t buf;
     int mlen;
-#endif
 
     DEBUG_CALL("sosendto");
@@ -818,7 +764,4 @@
 
     /* Don't care what port we get */
-#ifndef VBOX_WITH_SLIRP_BSD_MBUF
-    ret = sendto(so->s, m->m_data, m->m_len, 0, &addr, sizeof (struct sockaddr_in));
-#else
     mlen = m_length(m, NULL);
     buf = RTMemAlloc(mlen);
@@ -830,5 +773,4 @@
     ret = sendto(so->s, buf, mlen, 0,
                  (struct sockaddr *)&addr, sizeof (struct sockaddr));
-#endif
     if (ret < 0)
     {
@@ -1070,7 +1012,4 @@
     uint8_t proto;
     int type = 0;
-#ifndef VBOX_WITH_SLIRP_BSD_MBUF
-    int m_room;
-#endif
 
     ip = (struct ip *)buff;
@@ -1182,24 +1121,6 @@
     original_hlen = ip->ip_hl << 2;
     /* saves original ip header and options */
-#ifdef VBOX_WITH_SLIRP_BSD_MBUF
     m_copyback(pData, m, original_hlen, len - hlen, buff + hlen);
     ip->ip_len = m_length(m, NULL);
-#else
-    /* m_room space in the saved m buffer */
-    m_room = M_ROOM(m);
-    if (m_room < len - hlen + original_hlen)
-    {
-        /* we need involve ether header length into new buffer buffer calculation */
-        m_inc(m, if_maxlinkhdr + len - hlen + original_hlen);
-        if (m->m_size < if_maxlinkhdr + len - hlen + original_hlen)
-        {
-            Log(("send_icmp_to_guest: extending buffer was failed (packet is dropped)\n"));
-            return;
-        }
-    }
-    memcpy(m->m_data + original_hlen, buff + hlen, len - hlen);
-    m->m_len = len - hlen + original_hlen;
-    ip->ip_len = m->m_len;
-#endif
     ip->ip_p = IPPROTO_ICMP; /* the original package could be whatever, but we're response via ICMP*/
 
@@ -1288,7 +1209,4 @@
                 break;
             case IP_SUCCESS: /* echo replied */
-# ifndef VBOX_WITH_SLIRP_BSD_MBUF
-                m = m_get(pData);
-# else
                 out_len = ETH_HLEN + sizeof(struct ip) +  8;
                 size;
@@ -1308,5 +1226,4 @@
                 if (m == NULL)
                     return;
-# endif
                 m->m_len = 0;
                 m->m_data += if_maxlinkhdr;
@@ -1327,8 +1244,4 @@
                 data_len += ICMP_MINLEN;
 
-# ifndef VBOX_WITH_SLIRP_BSD_MBUF
-                nbytes = (data_len + icr[i].DataSize > m->m_size? m->m_size - data_len: icr[i].DataSize);
-                memcpy(icp->icmp_data, icr[i].Data, nbytes);
-# else
                 hlen = (ip->ip_hl << 2);
                 m->m_pkthdr.header = mtod(m, void *);
@@ -1336,5 +1249,4 @@
 
                 m_copyback(pData, m, hlen + 8, icr[i].DataSize, icr[i].Data);
-# endif
 
                 data_len += icr[i].DataSize;
@@ -1365,12 +1277,7 @@
                 data_len = (ip_broken->ip_hl << 2) + 64;
 
-#ifndef VBOX_WITH_SLIRP_BSD_MBUF
-                nbytes =(hlen + ICMP_MINLEN + data_len > m->m_size? m->m_size - (hlen + ICMP_MINLEN): data_len);
-                memcpy(icp->icmp_data, ip_broken,  nbytes);
-#else
                 m->m_len = data_len;
                 m->m_pkthdr.header = mtod(m, void *);
                 m_copyback(pData, m, ip->ip_hl >> 2, icr[i].DataSize, icr[i].Data);
-#endif
                 icmp_reflect(pData, m);
                 break;
Index: /trunk/src/VBox/Devices/Network/slirp/tcp.h
===================================================================
--- /trunk/src/VBox/Devices/Network/slirp/tcp.h	(revision 30015)
+++ /trunk/src/VBox/Devices/Network/slirp/tcp.h	(revision 30016)
@@ -135,9 +135,5 @@
  * We make this 1460 because we only care about Ethernet in the qemu context.
  */
-#ifndef VBOX_WITH_SLIRP_BSD_MBUF
-#define TCP_MSS 1460
-#else
 #define TCP_MSS (if_mtu - 80)
-#endif
 
 #define TCP_MAXWIN      65535   /* largest value for (unscaled) window */
Index: /trunk/src/VBox/Devices/Network/slirp/tcp_input.c
===================================================================
--- /trunk/src/VBox/Devices/Network/slirp/tcp_input.c	(revision 30015)
+++ /trunk/src/VBox/Devices/Network/slirp/tcp_input.c	(revision 30016)
@@ -359,9 +359,5 @@
      * here we do the test the same as input method of UDP protocol.
      */
-#ifdef VBOX_WITH_SLIRP_BSD_MBUF
     Assert((ip->ip_len + iphlen == m_length(m, NULL)));
-#else
-    Assert((ip->ip_len  + iphlen == m->m_len));
-#endif
     save_ip = *ip;
     save_ip.ip_len+= iphlen;
Index: /trunk/src/VBox/Devices/Network/slirp/tcp_output.c
===================================================================
--- /trunk/src/VBox/Devices/Network/slirp/tcp_output.c	(revision 30015)
+++ /trunk/src/VBox/Devices/Network/slirp/tcp_output.c	(revision 30016)
@@ -100,7 +100,5 @@
     unsigned optlen, hdrlen;
     int idle, sendalot;
-#ifdef VBOX_WITH_SLIRP_BSD_MBUF
     int size;
-#endif
 
     DEBUG_CALL("tcp_output");
@@ -393,7 +391,4 @@
         }
 
-#ifndef VBOX_WITH_SLIRP_BSD_MBUF
-        m = m_get(pData);
-#else
         size = MCLBYTES;
         if ((len + hdrlen + ETH_HLEN) < MSIZE)
@@ -408,5 +403,4 @@
             AssertMsgFailed(("Unsupported size"));
         m = m_getjcl(pData, M_NOWAIT, MT_HEADER, M_PKTHDR, size);
-#endif
         if (m == NULL)
         {
@@ -416,7 +410,5 @@
         }
         m->m_data += if_maxlinkhdr;
-#ifdef VBOX_WITH_SLIRP_BSD_MBUF
         m->m_pkthdr.header = mtod(m, void *);
-#endif
         m->m_len = hdrlen;
 
@@ -460,6 +452,25 @@
             tcpstat.tcps_sndwinup++;
 
-#ifndef VBOX_WITH_SLIRP_BSD_MBUF
-        m = m_get(pData);
+        if ((hdrlen + ETH_HLEN) < MSIZE)
+        {
+            size = MCLBYTES;
+        }
+        else if ((hdrlen + ETH_HLEN) < MCLBYTES)
+        {
+            size = MCLBYTES;
+        }
+        else if((hdrlen + ETH_HLEN) < MJUM9BYTES)
+        {
+            size = MJUM9BYTES;
+        }
+        else if ((hdrlen + ETH_HLEN) < MJUM16BYTES)
+        {
+            size = MJUM16BYTES;
+        }
+        else
+        {
+            AssertMsgFailed(("Unsupported size"));
+        }
+        m = m_getjcl(pData, M_NOWAIT, MT_HEADER, M_PKTHDR, size);
         if (m == NULL)
         {
@@ -468,37 +479,6 @@
             goto out;
         }
-#else
-        if ((hdrlen + ETH_HLEN) < MSIZE)
-        {
-            size = MCLBYTES;
-        }
-        else if ((hdrlen + ETH_HLEN) < MCLBYTES)
-        {
-            size = MCLBYTES;
-        }
-        else if((hdrlen + ETH_HLEN) < MJUM9BYTES)
-        {
-            size = MJUM9BYTES;
-        }
-        else if ((hdrlen + ETH_HLEN) < MJUM16BYTES)
-        {
-            size = MJUM16BYTES;
-        }
-        else
-        {
-            AssertMsgFailed(("Unsupported size"));
-        }
-        m = m_getjcl(pData, M_NOWAIT, MT_HEADER, M_PKTHDR, size);
-#endif
-        if (m == NULL)
-        {
-/*          error = ENOBUFS; */
-            error = 1;
-            goto out;
-        }
         m->m_data += if_maxlinkhdr;
-#ifdef VBOX_WITH_SLIRP_BSD_MBUF
         m->m_pkthdr.header = mtod(m, void *);
-#endif
         m->m_len = hdrlen;
     }
@@ -648,10 +628,6 @@
      * the template, but need a way to checksum without them.
      */
-#ifndef VBOX_WITH_SLIRP_BSD_MBUF
-    Assert(m->m_len == (hdrlen + len));
-#else
     M_ASSERTPKTHDR(m);
     m->m_pkthdr.header = mtod(m, void *);
-#endif
     m->m_len = hdrlen + len; /* XXX Needed? m_len should be correct */
 
@@ -666,8 +642,4 @@
         error = ip_output(m, tp->t_inpcb->inp_options, &tp->t_inpcb->inp_route,
                          so->so_options & SO_DONTROUTE, 0);
-#endif
-#ifndef VBOX_WITH_SLIRP_BSD_MBUF
-        if(so->so_la != NULL)
-            m->m_la = so->so_la;
 #endif
         error = ip_output(pData, so, m);
Index: /trunk/src/VBox/Devices/Network/slirp/tcp_subr.c
===================================================================
--- /trunk/src/VBox/Devices/Network/slirp/tcp_subr.c	(revision 30015)
+++ /trunk/src/VBox/Devices/Network/slirp/tcp_subr.c	(revision 30016)
@@ -141,9 +141,5 @@
     if (m == 0)
     {
-#ifndef VBOX_WITH_SLIRP_BSD_MBUF
-        if ((m = m_get(pData)) == NULL)
-#else
         if ((m = m_gethdr(pData, M_DONTWAIT, MT_HEADER)) == NULL)
-#endif
             return;
 #ifdef TCP_COMPAT_42
@@ -153,7 +149,5 @@
 #endif
         m->m_data += if_maxlinkhdr;
-#ifdef VBOX_WITH_SLIRP_BSD_MBUF
         m->m_pkthdr.header = mtod(m, void *);
-#endif
         *mtod(m, struct tcpiphdr *) = *ti;
         ti = mtod(m, struct tcpiphdr *);
Index: /trunk/src/VBox/Devices/Network/slirp/tftp.c
===================================================================
--- /trunk/src/VBox/Devices/Network/slirp/tftp.c	(revision 30015)
+++ /trunk/src/VBox/Devices/Network/slirp/tftp.c	(revision 30016)
@@ -145,30 +145,16 @@
     int n = 0;
 
-#ifndef VBOX_WITH_SLIRP_BSD_MBUF
-    m = m_get(pData);
-#else
     m = m_getcl(pData, M_DONTWAIT, MT_HEADER, M_PKTHDR);
-#endif
     if (!m)
         return -1;
 
-#ifndef VBOX_WITH_SLIRP_BSD_MBUF
-    memset(m->m_data, 0, m->m_size);
-    m->m_data += if_maxlinkhdr;
-#else
     m->m_data += if_maxlinkhdr;
     m->m_pkthdr.header = mtod(m, void *);
-#endif
     tp = (void *)m->m_data;
     m->m_data += sizeof(struct udpiphdr);
 
     tp->tp_op = RT_H2N_U16_C(TFTP_OACK);
-#ifndef VBOX_WITH_SLIRP_BSD_MBUF
-    n += RTStrPrintf((char *)tp->x.tp_buf + n, M_FREEROOM(m), "%s", key) + 1;
-    n += RTStrPrintf((char *)tp->x.tp_buf + n, M_FREEROOM(m), "%u", value) + 1;
-#else
     n += RTStrPrintf((char *)tp->x.tp_buf + n, M_TRAILINGSPACE(m), "%s", key) + 1;
     n += RTStrPrintf((char *)tp->x.tp_buf + n, M_TRAILINGSPACE(m), "%u", value) + 1;
-#endif
 
     saddr.sin_addr = recv_tp->ip.ip_dst;
@@ -195,19 +181,10 @@
     int nobytes;
 
-#ifndef VBOX_WITH_SLIRP_BSD_MBUF
-    m = m_get(pData);
-#else
     if ((m = m_getcl(pData, M_DONTWAIT, MT_HEADER, M_PKTHDR)) == NULL)
-#endif
     if (!m)
         return -1;
 
-#ifndef VBOX_WITH_SLIRP_BSD_MBUF
-    memset(m->m_data, 0, m->m_size);
-    m->m_data += if_maxlinkhdr;
-#else
     m->m_data += if_maxlinkhdr;
     m->m_pkthdr.header = mtod(m, void *);
-#endif
     tp = (void *)m->m_data;
     m->m_data += sizeof(struct udpiphdr);
@@ -252,19 +229,10 @@
         return -1;
 
-#ifndef VBOX_WITH_SLIRP_BSD_MBUF
-    m = m_get(pData);
-#else
     if ((m = m_getcl(pData, M_DONTWAIT, MT_HEADER, M_PKTHDR)) == NULL)
-#endif
     if (!m)
         return -1;
 
-#ifndef VBOX_WITH_SLIRP_BSD_MBUF
-    memset(m->m_data, 0, m->m_size);
-    m->m_data += if_maxlinkhdr;
-#else
     m->m_data += if_maxlinkhdr;
     m->m_pkthdr.header = mtod(m, void *);
-#endif
     tp = mtod(m, void *);
     m->m_data += sizeof(struct udpiphdr);
Index: /trunk/src/VBox/Devices/Network/slirp/udp.c
===================================================================
--- /trunk/src/VBox/Devices/Network/slirp/udp.c	(revision 30015)
+++ /trunk/src/VBox/Devices/Network/slirp/udp.c	(revision 30016)
@@ -127,9 +127,5 @@
     len = RT_N2H_U16((u_int16_t)uh->uh_ulen);
     Assert((ip->ip_len == len));
-#ifndef VBOX_WITH_SLIRP_BSD_MBUF
-    Assert((ip->ip_len + iphlen == m->m_len));
-#else
     Assert((ip->ip_len + iphlen == m_length(m, NULL)));
-#endif
 
     if (ip->ip_len != len)
