- Timestamp:
- Apr 27, 2015 3:20:42 AM (10 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Config.kmk
r55261 r55432 403 403 # Enable INIP support in the ISCSI feature. 404 404 VBOX_WITH_INIP = 1 405 # Enable new (pre-1.5.0 release) version of LWIP.406 VBOX_WITH_NEW_LWIP = 1407 405 # Enables lwip as a core of NAT service 408 406 VBOX_WITH_LWIP_NAT = 1 -
trunk/src/VBox/Devices/Makefile.kmk
r55349 r55432 401 401 VBoxDD_SOURCES += \ 402 402 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)) 419 412 endif # VBOX_WITH_INIP 420 413 … … 487 480 488 481 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)) 496 484 endif 497 485 -
trunk/src/VBox/Devices/Network/DevINIP.cpp
r48947 r55432 34 34 #include "lwip/pbuf.h" 35 35 #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 43 41 #include "lwip/udp.h" 44 42 #include "lwip/tcp.h" … … 55 53 56 54 #include "VBoxDD.h" 57 58 #ifdef VBOX_WITH_NEW_LWIP 59 # include "VBoxLwipCore.h" 60 #endif 55 #include "VBoxLwipCore.h" 61 56 62 57 /******************************************************************************* … … 115 110 /** Flag whether the link is up. */ 116 111 bool fLnkUp; 117 #ifndef VBOX_WITH_NEW_LWIP118 /**119 * This hack-flag for spliting initialization logic in devINIPTcpipInitDone,120 * this is the only place when during initialization we can be called from TCPIP121 * thread.122 * This callback used for Initialization and Finalization with old lwip.123 */124 bool fTermination;125 #endif126 112 /** 127 113 * In callback we're getting status of interface adding operation (TCPIP thread), … … 159 145 * Internal Functions * 160 146 *******************************************************************************/ 161 #ifndef VBOX_WITH_NEW_LWIP162 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 #endif166 147 static DECLCALLBACK(err_t) devINIPOutput(struct netif *netif, struct pbuf *p, struct ip_addr *ipaddr); 167 148 static DECLCALLBACK(err_t) devINIPOutputRaw(struct netif *netif, struct pbuf *p); 168 149 static DECLCALLBACK(err_t) devINIPInterface(struct netif *netif); 169 150 170 171 #ifndef VBOX_WITH_NEW_LWIP172 /**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 */217 151 218 152 /** … … 230 164 LogFlow(("%s: netif=%p p=%p ipaddr=%#04x\n", __FUNCTION__, netif, p, 231 165 ipaddr->addr)); 232 #ifndef VBOX_WITH_NEW_LWIP 233 lrc = lwip_etharp_output(netif, ipaddr, p); 234 #else 166 235 167 lrc = lwip_etharp_output(netif, p, ipaddr); 236 #endif 168 237 169 LogFlow(("%s: return %d\n", __FUNCTION__, lrc)); 238 170 return lrc; … … 327 259 netif->mtu = DEVINIP_MAX_FRAME; 328 260 netif->flags = NETIF_FLAG_BROADCAST; 329 #ifdef VBOX_WITH_NEW_LWIP330 /** @todo why explicit ARP routing required for 1.2.0 case? */331 261 netif->flags |= NETIF_FLAG_ETHARP; 332 262 netif->flags |= NETIF_FLAG_ETHERNET; 333 /* Note! We always assign link-local IPv6 address */ 263 264 #if LWIP_IPV6 334 265 netif_create_ip6_linklocal_address(netif, 0); 335 266 netif_ip6_addr_set_state(netif, 0, IP6_ADDR_VALID); … … 337 268 netif->ip6_autoconfig_enabled=1; 338 269 LogFunc(("netif: ipv6:%RTnaipv6\n", &netif->ip6_addr[0].addr[0])); 270 #endif 271 339 272 netif->output = lwip_etharp_output; 340 341 lwip_etharp_init();342 #else343 netif->output = devINIPOutput;344 345 lwip_etharp_init();346 TMTimerSetMillies(g_pDevINIPData->ARPTimer, ARP_TMR_INTERVAL);347 #endif348 273 netif->linkoutput = devINIPOutputRaw; 349 274 … … 452 377 ethhdr = (const struct eth_hdr *)p->payload; 453 378 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 471 380 /* We've setup flags NETIF_FLAG_ETHARP and NETIF_FLAG_ETHERNET 472 381 so this should be thread-safe. */ 473 382 tcpip_input(p,iface); 474 #endif475 383 } 476 384 … … 500 408 501 409 pThis->rcInitialization = VINF_SUCCESS; 502 #ifndef VBOX_WITH_NEW_LWIP 503 /* see PDEVINTNETIP::fTermination */ 504 if (!pThis->fTermination) 505 { 506 #endif 410 { 507 411 struct netif *ret; 508 412 struct ip_addr ipaddr, netmask, gw; … … 565 469 lwip_netif_set_default(&pThis->IntNetIF); 566 470 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 } 573 472 done: 574 473 return; 575 #endif 576 } 577 578 #ifdef VBOX_WITH_NEW_LWIP 474 } 475 476 579 477 /** 580 478 * This callback is for finitializing our activity on TCPIP thread. … … 590 488 netif_remove(&pThis->IntNetIF); 591 489 } 592 #endif593 490 594 491 … … 688 585 689 586 if (g_pDevINIPData != NULL) 690 {691 #ifndef VBOX_WITH_NEW_LWIP692 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 #else699 587 vboxLwipCoreFinalize(devINIPTcpipFiniDone, pThis); 700 #endif701 }702 588 703 589 MMR3HeapFree(pThis->pszIP); … … 720 606 PDEVINTNETIP pThis = PDMINS_2_DATA(pDevIns, PDEVINTNETIP); 721 607 int rc = VINF_SUCCESS; 722 #ifdef VBOX_WITH_NEW_LWIP723 608 err_t errRc = ERR_OK; 724 #endif 609 725 610 LogFlow(("%s: pDevIns=%p iInstance=%d pCfg=%p\n", __FUNCTION__, 726 611 pDevIns, iInstance, pCfg)); … … 733 618 */ 734 619 if (!CFGMR3AreValuesValid(pCfg, "MAC\0IP\0" 735 #ifdef VBOX_WITH_NEW_LWIP736 620 "IPv6\0" 737 #endif738 621 "Netmask\0Gateway\0")) 739 622 return PDMDEV_SET_ERROR(pDevIns, VERR_PDM_DEVINS_UNKNOWN_CFG_VALUES, … … 822 705 * Initialize lwIP. 823 706 */ 824 #ifndef VBOX_WITH_NEW_LWIP825 lwip_stats_init();826 lwip_sys_init();827 # if MEM_LIBC_MALLOC == 0828 lwip_mem_init();829 # endif830 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 */851 707 vboxLwipCoreInitialize(devINIPTcpipInitDone, pThis); 852 #endif853 708 854 709 /* this rc could be updated in devINIPTcpInitDone thread */ -
trunk/src/VBox/Devices/Storage/DrvVD.cpp
r55431 r55432 46 46 #include <lwip/tcp.h> 47 47 #include <lwip/sockets.h> 48 # if def VBOX_WITH_NEW_LWIP48 # if LWIP_IPV6 49 49 # include <lwip/inet6.h> 50 50 # endif … … 711 711 struct sockaddr Addr; 712 712 struct sockaddr_in Ipv4; 713 #if def VBOX_WITH_NEW_LWIP713 #if LWIP_IPV6 714 714 struct sockaddr_in6 Ipv6; 715 715 #endif … … 763 763 int iInetFamily = PF_INET; 764 764 struct in_addr ip; 765 #ifdef VBOX_WITH_NEW_LWIP765 #ifdef LWIP_IPV6 766 766 ip6_addr_t ip6; 767 767 #endif … … 777 777 /* Resolve hostname. As there is no standard resolver for lwIP yet, 778 778 * just accept numeric IP addresses for now. */ 779 #if def VBOX_WITH_NEW_LWIP779 #if LWIP_IPV6 780 780 if (inet6_aton(pszAddress, &ip6)) 781 781 iInetFamily = PF_INET6; … … 801 801 pSockAddr = (struct sockaddr *)&InAddr; 802 802 } 803 #ifdef VBOX_WITH_NEW_LWIP803 #ifdef LWIP_IPV6 804 804 else 805 805 { … … 1007 1007 pAddr->uAddr.IPv4.u = u.Ipv4.sin_addr.s_addr; 1008 1008 } 1009 #if def VBOX_WITH_NEW_LWIP1009 #if LWIP_IPV6 1010 1010 else if ( cbAddr == sizeof(struct sockaddr_in6) 1011 1011 && u.Addr.sa_family == AF_INET6) … … 1044 1044 pAddr->uAddr.IPv4.u = u.Ipv4.sin_addr.s_addr; 1045 1045 } 1046 #if def VBOX_WITH_NEW_LWIP1046 #if LWIP_IPV6 1047 1047 else if ( cbAddr == sizeof(struct sockaddr_in6) 1048 1048 && u.Addr.sa_family == AF_INET6)
Note:
See TracChangeset
for help on using the changeset viewer.