VirtualBox

Changeset 55432 in vbox for trunk


Ignore:
Timestamp:
Apr 27, 2015 3:20:42 AM (10 years ago)
Author:
vboxsync
Message:

G/c VBOX_WITH_NEW_LWIP. This option only affects DevINIP/DrvVD (as
NAT Network always uses the new one) and it has been on since 4.3 was
released. Old lwip sources will be removed in a separate commit.

Same object code is produced modulo a few LINE changes.

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Config.kmk

    r55261 r55432  
    403403# Enable INIP support in the ISCSI feature.
    404404VBOX_WITH_INIP = 1
    405 # Enable new (pre-1.5.0 release) version of LWIP.
    406 VBOX_WITH_NEW_LWIP = 1
    407405# Enables lwip as a core of NAT service
    408406VBOX_WITH_LWIP_NAT = 1
  • trunk/src/VBox/Devices/Makefile.kmk

    r55349 r55432  
    401401  VBoxDD_SOURCES        += \
    402402        Network/DevINIP.cpp
    403   ifndef VBOX_WITH_NEW_LWIP
    404     include $(PATH_SUB_CURRENT)/Network/lwip/Makefile.kmk
    405     VBoxDD_INCS         += $(LWIP_INCS)
    406     VBoxDD_SOURCES      += $(LWIP_SOURCES)
    407   else
    408     # XXX: do not depend on order
    409     ifndef LWIP_SOURCES
    410       include $(PATH_SUB_CURRENT)/Network/lwip-new/Makefile.kmk
    411     endif
    412     Network/DevINIP.cpp_DEFS += VBOX_WITH_NEW_LWIP
    413     VBoxDD_LWIP_INCS += Network # for lwipopts.h
    414     $(eval $(call def_vbox_lwip_private, \
    415                       VBoxDD, Network/lwip-new))
    416     $(eval $(call def_vbox_lwip_flags, \
    417                       VBoxDD, Network/DevINIP.cpp, Network/lwip-new))
    418   endif
     403  # XXX: do not depend on order
     404  ifndef LWIP_SOURCES
     405    include $(PATH_SUB_CURRENT)/Network/lwip-new/Makefile.kmk
     406  endif
     407  VBoxDD_LWIP_INCS += Network # for lwipopts.h
     408  $(eval $(call def_vbox_lwip_private, \
     409                    VBoxDD, Network/lwip-new))
     410  $(eval $(call def_vbox_lwip_flags, \
     411                    VBoxDD, Network/DevINIP.cpp, Network/lwip-new))
    419412 endif # VBOX_WITH_INIP
    420413
     
    487480
    488481 ifdef VBOX_WITH_ISCSI
    489   ifdef VBOX_WITH_NEW_LWIP
    490     Storage/DrvVD.cpp_DEFS += VBOX_WITH_NEW_LWIP
    491     $(eval $(call def_vbox_lwip_flags, \
    492                       VBoxDD, Storage/DrvVD.cpp, Network/lwip-new))
    493   else
    494     Storage/DrvVD.cpp_INCS = $(LWIP_INCS)
    495   endif
     482  $(eval $(call def_vbox_lwip_flags, \
     483                    VBoxDD, Storage/DrvVD.cpp, Network/lwip-new))
    496484 endif
    497485
  • trunk/src/VBox/Devices/Network/DevINIP.cpp

    r48947 r55432  
    3434#include "lwip/pbuf.h"
    3535#include "lwip/netif.h"
    36 #ifndef VBOX_WITH_NEW_LWIP
    37 # include "ipv4/lwip/ip.h"
    38 #else
    39 # include "lwip/api.h"
    40 # include "lwip/tcp_impl.h"
    41 # include "ipv6/lwip/ethip6.h"
    42 #endif
     36#include "lwip/api.h"
     37#include "lwip/tcp_impl.h"
     38# if LWIP_IPV6
     39#  include "ipv6/lwip/ethip6.h"
     40# endif
    4341#include "lwip/udp.h"
    4442#include "lwip/tcp.h"
     
    5553
    5654#include "VBoxDD.h"
    57 
    58 #ifdef VBOX_WITH_NEW_LWIP
    59 # include "VBoxLwipCore.h"
    60 #endif
     55#include "VBoxLwipCore.h"
    6156
    6257/*******************************************************************************
     
    115110    /** Flag whether the link is up. */
    116111    bool                    fLnkUp;
    117 #ifndef VBOX_WITH_NEW_LWIP
    118     /**
    119      * This hack-flag for spliting initialization logic in devINIPTcpipInitDone,
    120      * this is the only place when during initialization we can be called from TCPIP
    121      * thread.
    122      * This callback used for Initialization and Finalization with old lwip.
    123      */
    124     bool fTermination;
    125 #endif
    126112    /**
    127113     * In callback we're getting status of interface adding operation (TCPIP thread),
     
    159145*   Internal Functions                                                         *
    160146*******************************************************************************/
    161 #ifndef VBOX_WITH_NEW_LWIP
    162 static DECLCALLBACK(void) devINIPARPTimer(PPDMDEVINS pDevIns, PTMTIMER pTimer);
    163 static DECLCALLBACK(void) devINIPTCPFastTimer(PPDMDEVINS pDevIns, PTMTIMER pTimer);
    164 static DECLCALLBACK(void) devINIPTCPSlowTimer(PPDMDEVINS pDevIns, PTMTIMER pTimer);
    165 #endif
    166147static DECLCALLBACK(err_t) devINIPOutput(struct netif *netif, struct pbuf *p, struct ip_addr *ipaddr);
    167148static DECLCALLBACK(err_t) devINIPOutputRaw(struct netif *netif, struct pbuf *p);
    168149static DECLCALLBACK(err_t) devINIPInterface(struct netif *netif);
    169150
    170 
    171 #ifndef VBOX_WITH_NEW_LWIP
    172 /**
    173  * ARP cache timeout handling for lwIP.
    174  *
    175  * @param   pDevIns     Device instance.
    176  * @param   pTimer      Pointer to timer.
    177  */
    178 static DECLCALLBACK(void) devINIPARPTimer(PPDMDEVINS pDevIns, PTMTIMER pTimer, void *pvUser)
    179 {
    180     PDEVINTNETIP pThis = (PDEVINTNETIP)pvUser;
    181     LogFlow(("%s: pDevIns=%p pTimer=%p\n", __FUNCTION__, pDevIns, pTimer));
    182     lwip_etharp_tmr();
    183     TMTimerSetMillies(pThis->ARPTimer, ARP_TMR_INTERVAL);
    184     LogFlow(("%s: return\n", __FUNCTION__));
    185 }
    186 
    187 /**
    188  * TCP fast timer handling for lwIP.
    189  *
    190  * @param   pDevIns     Device instance.
    191  * @param   pTimer      Pointer to timer.
    192  */
    193 static DECLCALLBACK(void) devINIPTCPFastTimer(PPDMDEVINS pDevIns, PTMTIMER pTimer, void *pvUser)
    194 {
    195     PDEVINTNETIP pThis = (PDEVINTNETIP)pvUser;
    196     LogFlow(("%s: pDevIns=%p pTimer=%p\n", __FUNCTION__, pDevIns, pTimer));
    197     lwip_tcp_fasttmr();
    198     TMTimerSetMillies(pThis->TCPFastTimer, TCP_FAST_INTERVAL);
    199     LogFlow(("%s: return\n", __FUNCTION__));
    200 }
    201 
    202 /**
    203  * TCP slow timer handling for lwIP.
    204  *
    205  * @param   pDevIns     Device instance.
    206  * @param   pTimer      Pointer to timer.
    207  */
    208 static DECLCALLBACK(void) devINIPTCPSlowTimer(PPDMDEVINS pDevIns, PTMTIMER pTimer, void *pvUser)
    209 {
    210     PDEVINTNETIP pThis = (PDEVINTNETIP)pvUser;
    211     LogFlow(("%s: pDevIns=%p pTimer=%p\n", __FUNCTION__, pDevIns, pTimer));
    212     lwip_tcp_slowtmr();
    213     TMTimerSetMillies(pThis->TCPSlowTimer, TCP_SLOW_INTERVAL);
    214     LogFlow(("%s: return\n", __FUNCTION__));
    215 }
    216 #endif /* VBOX_WITH_NEW_LWIP */
    217151
    218152/**
     
    230164    LogFlow(("%s: netif=%p p=%p ipaddr=%#04x\n", __FUNCTION__, netif, p,
    231165             ipaddr->addr));
    232 #ifndef VBOX_WITH_NEW_LWIP
    233     lrc = lwip_etharp_output(netif, ipaddr, p);
    234 #else
     166
    235167    lrc = lwip_etharp_output(netif, p, ipaddr);
    236 #endif
     168
    237169    LogFlow(("%s: return %d\n", __FUNCTION__, lrc));
    238170    return lrc;
     
    327259    netif->mtu = DEVINIP_MAX_FRAME;
    328260    netif->flags = NETIF_FLAG_BROADCAST;
    329 #ifdef VBOX_WITH_NEW_LWIP
    330     /** @todo why explicit ARP routing required for 1.2.0 case? */
    331261    netif->flags |= NETIF_FLAG_ETHARP;
    332262    netif->flags |= NETIF_FLAG_ETHERNET;
    333     /* Note! We always assign link-local IPv6 address */
     263
     264#if LWIP_IPV6
    334265    netif_create_ip6_linklocal_address(netif, 0);
    335266    netif_ip6_addr_set_state(netif, 0, IP6_ADDR_VALID);
     
    337268    netif->ip6_autoconfig_enabled=1;
    338269    LogFunc(("netif: ipv6:%RTnaipv6\n", &netif->ip6_addr[0].addr[0]));
     270#endif
     271
    339272    netif->output = lwip_etharp_output;
    340 
    341     lwip_etharp_init();
    342 #else
    343     netif->output = devINIPOutput;
    344 
    345     lwip_etharp_init();
    346     TMTimerSetMillies(g_pDevINIPData->ARPTimer, ARP_TMR_INTERVAL);
    347  #endif
    348273    netif->linkoutput = devINIPOutputRaw;
    349274
     
    452377        ethhdr = (const struct eth_hdr *)p->payload;
    453378        struct netif *iface = &g_pDevINIPData->IntNetIF;
    454 #ifndef VBOX_WITH_NEW_LWIP
    455         err_t lrc;
    456         switch (htons(ethhdr->type))
    457         {
    458             case ETHTYPE_IP:    /* IP packet */
    459                 lwip_pbuf_header(p, -(ssize_t)sizeof(struct eth_hdr));
    460                 lrc = iface->input(p, iface);
    461                 if (lrc)
    462                     rc = VERR_NET_IO_ERROR;
    463                 break;
    464             case ETHTYPE_ARP:   /* ARP packet */
    465                 lwip_etharp_arp_input(iface, (struct eth_addr *)iface->hwaddr, p);
    466                 break;
    467             default:
    468                 lwip_pbuf_free(p);
    469         }
    470 #else
     379
    471380        /* We've setup flags NETIF_FLAG_ETHARP and NETIF_FLAG_ETHERNET
    472381          so this should be thread-safe. */
    473382        tcpip_input(p,iface);
    474 #endif
    475383    }
    476384
     
    500408
    501409    pThis->rcInitialization = VINF_SUCCESS;
    502 #ifndef VBOX_WITH_NEW_LWIP
    503     /* see PDEVINTNETIP::fTermination */
    504     if (!pThis->fTermination)
    505     {
    506 #endif
     410    {
    507411        struct netif *ret;
    508412        struct ip_addr ipaddr, netmask, gw;
     
    565469        lwip_netif_set_default(&pThis->IntNetIF);
    566470        lwip_netif_set_up(&pThis->IntNetIF);
    567 
    568 #ifndef VBOX_WITH_NEW_LWIP
    569     }
    570     done:
    571     lwip_sys_sem_signal(pThis->LWIPTcpInitSem);
    572 #else
     471    }
    573472    done:
    574473    return;
    575 #endif
    576 }
    577 
    578 #ifdef VBOX_WITH_NEW_LWIP
     474}
     475
     476
    579477/**
    580478 * This callback is for finitializing our activity on TCPIP thread.
     
    590488    netif_remove(&pThis->IntNetIF);
    591489}
    592 #endif
    593490
    594491
     
    688585
    689586    if (g_pDevINIPData != NULL)
    690     {
    691 #ifndef VBOX_WITH_NEW_LWIP
    692         netif_set_down(&pThis->IntNetIF);
    693         netif_remove(&pThis->IntNetIF);
    694         pThis->fTermination = true;
    695         tcpip_terminate();
    696         lwip_sys_sem_wait(pThis->LWIPTcpInitSem);
    697         lwip_sys_sem_free(pThis->LWIPTcpInitSem);
    698 #else
    699587        vboxLwipCoreFinalize(devINIPTcpipFiniDone, pThis);
    700 #endif
    701     }
    702588
    703589    MMR3HeapFree(pThis->pszIP);
     
    720606    PDEVINTNETIP pThis = PDMINS_2_DATA(pDevIns, PDEVINTNETIP);
    721607    int rc = VINF_SUCCESS;
    722 #ifdef VBOX_WITH_NEW_LWIP
    723608    err_t errRc = ERR_OK;
    724 #endif
     609
    725610    LogFlow(("%s: pDevIns=%p iInstance=%d pCfg=%p\n", __FUNCTION__,
    726611             pDevIns, iInstance, pCfg));
     
    733618     */
    734619    if (!CFGMR3AreValuesValid(pCfg, "MAC\0IP\0"
    735 #ifdef VBOX_WITH_NEW_LWIP
    736620                                    "IPv6\0"
    737 #endif
    738621                                    "Netmask\0Gateway\0"))
    739622        return PDMDEV_SET_ERROR(pDevIns, VERR_PDM_DEVINS_UNKNOWN_CFG_VALUES,
     
    822705     * Initialize lwIP.
    823706     */
    824 #ifndef VBOX_WITH_NEW_LWIP
    825     lwip_stats_init();
    826     lwip_sys_init();
    827 # if MEM_LIBC_MALLOC == 0
    828     lwip_mem_init();
    829 # endif
    830     lwip_memp_init();
    831     lwip_pbuf_init();
    832     lwip_netif_init();
    833     rc = PDMDevHlpTMTimerCreate(pDevIns, TMCLOCK_VIRTUAL, devINIPARPTimer, pThis,
    834                                 TMTIMER_FLAGS_NO_CRIT_SECT, "lwIP ARP", &pThis->ARPTimer);
    835     AssertRCReturn(rc, rc);
    836     rc = PDMDevHlpTMTimerCreate(pDevIns, TMCLOCK_VIRTUAL, devINIPTCPFastTimer, pThis,
    837                                 TMTIMER_FLAGS_NO_CRIT_SECT, "lwIP fast TCP", &pThis->TCPFastTimer);
    838     AssertRCReturn(rc, rc);
    839     TMTimerSetMillies(pThis->TCPFastTimer, TCP_FAST_INTERVAL);
    840     rc = PDMDevHlpTMTimerCreate(pDevIns, TMCLOCK_VIRTUAL, devINIPTCPSlowTimer, pThis,
    841                                 TMTIMER_FLAGS_NO_CRIT_SECT, "lwIP slow TCP", &pThis->TCPSlowTimer);
    842     AssertRCReturn(rc, rc);
    843     TMTimerSetMillies(pThis->TCPFastTimer, TCP_SLOW_INTERVAL);
    844 
    845     pThis->LWIPTcpInitSem = lwip_sys_sem_new(0);
    846 
    847     lwip_tcpip_init(devINIPTcpipInitDone, pThis);
    848     lwip_sys_sem_wait(pThis->LWIPTcpInitSem);
    849 
    850 #else /* VBOX_WITH_NEW_LWIP */
    851707    vboxLwipCoreInitialize(devINIPTcpipInitDone, pThis);
    852 #endif
    853708
    854709    /* this rc could be updated in devINIPTcpInitDone thread */
  • trunk/src/VBox/Devices/Storage/DrvVD.cpp

    r55431 r55432  
    4646#include <lwip/tcp.h>
    4747#include <lwip/sockets.h>
    48 # ifdef VBOX_WITH_NEW_LWIP
     48# if LWIP_IPV6
    4949#  include <lwip/inet6.h>
    5050# endif
     
    711711    struct sockaddr     Addr;
    712712    struct sockaddr_in  Ipv4;
    713 #ifdef VBOX_WITH_NEW_LWIP
     713#if LWIP_IPV6
    714714    struct sockaddr_in6 Ipv6;
    715715#endif
     
    763763    int iInetFamily = PF_INET;
    764764    struct in_addr ip;
    765 #ifdef VBOX_WITH_NEW_LWIP
     765#ifdef LWIP_IPV6
    766766    ip6_addr_t ip6;
    767767#endif
     
    777777    /* Resolve hostname. As there is no standard resolver for lwIP yet,
    778778     * just accept numeric IP addresses for now. */
    779 #ifdef VBOX_WITH_NEW_LWIP
     779#if LWIP_IPV6
    780780    if (inet6_aton(pszAddress, &ip6))
    781781        iInetFamily = PF_INET6;
     
    801801            pSockAddr = (struct sockaddr *)&InAddr;
    802802        }
    803 #ifdef VBOX_WITH_NEW_LWIP
     803#ifdef LWIP_IPV6
    804804        else
    805805        {
     
    10071007            pAddr->uAddr.IPv4.u = u.Ipv4.sin_addr.s_addr;
    10081008        }
    1009 #ifdef VBOX_WITH_NEW_LWIP
     1009#if LWIP_IPV6
    10101010        else if (   cbAddr == sizeof(struct sockaddr_in6)
    10111011            && u.Addr.sa_family == AF_INET6)
     
    10441044            pAddr->uAddr.IPv4.u = u.Ipv4.sin_addr.s_addr;
    10451045        }
    1046 #ifdef VBOX_WITH_NEW_LWIP
     1046#if LWIP_IPV6
    10471047        else if (   cbAddr == sizeof(struct sockaddr_in6)
    10481048                 && u.Addr.sa_family == AF_INET6)
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette