Changeset 48947 in vbox for trunk/src/VBox/Devices/Network
- Timestamp:
- Oct 7, 2013 9:41:00 PM (12 years ago)
- svn:sync-xref-src-repo-rev:
- 89644
- Location:
- trunk/src/VBox/Devices/Network
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Network/DevINIP.cpp
r47933 r48947 116 116 bool fLnkUp; 117 117 #ifndef VBOX_WITH_NEW_LWIP 118 /** 119 * This hack-flag for spliting initialization logic in devINIPTcpipInitDone, 118 /** 119 * This hack-flag for spliting initialization logic in devINIPTcpipInitDone, 120 120 * this is the only place when during initialization we can be called from TCPIP 121 * thread. 121 * thread. 122 122 * This callback used for Initialization and Finalization with old lwip. 123 123 */ … … 127 127 * In callback we're getting status of interface adding operation (TCPIP thread), 128 128 * but we need inform constructing routine whether it was success or not(EMT thread). 129 */ 129 */ 130 130 int rcInitialization; 131 131 } DEVINTNETIP, *PDEVINTNETIP; … … 342 342 #else 343 343 netif->output = devINIPOutput; 344 344 345 345 lwip_etharp_init(); 346 346 TMTimerSetMillies(g_pDevINIPData->ARPTimer, ARP_TMR_INTERVAL); … … 363 363 PDMDEV_SET_ERROR(pDevIns, rc, 364 364 N_("Configuration error: Failed to get the \"IP\" value")); 365 /* @todo: perhaps we should panic if IPv4 address isn't specify, with assumtion that 366 * ISCSI target specified in IPv6 form. 365 /* @todo: perhaps we should panic if IPv4 address isn't specify, with assumtion that 366 * ISCSI target specified in IPv6 form. 367 367 */ 368 368 return rc; … … 490 490 /** 491 491 * Signals the end of lwIP TCPIP initialization. 492 * 492 * 493 493 * @note: TCPIP thread, corresponding EMT waiting on semaphore. 494 494 * @param arg opaque argument, here the pointer to the PDEVINTNETIP. … … 512 512 { 513 513 pThis->rcInitialization = VERR_PDM_DEVINS_UNKNOWN_CFG_VALUES; 514 PDMDEV_SET_ERROR(pThis->pDevIns, 514 PDMDEV_SET_ERROR(pThis->pDevIns, 515 515 pThis->rcInitialization, 516 516 N_("Configuration error: Invalid \"IP\" value")); … … 518 518 } 519 519 memcpy(&ipaddr, &ip, sizeof(ipaddr)); 520 520 521 521 if (!inet_aton(pThis->pszNetmask, &ip)) 522 522 { 523 523 pThis->rcInitialization = VERR_PDM_DEVINS_UNKNOWN_CFG_VALUES; 524 PDMDEV_SET_ERROR(pThis->pDevIns, 524 PDMDEV_SET_ERROR(pThis->pDevIns, 525 525 pThis->rcInitialization, 526 526 N_("Configuration error: Invalid \"Netmask\" value")); … … 534 534 { 535 535 pThis->rcInitialization = VERR_PDM_DEVINS_UNKNOWN_CFG_VALUES; 536 PDMDEV_SET_ERROR(pThis->pDevIns, 536 PDMDEV_SET_ERROR(pThis->pDevIns, 537 537 pThis->rcInitialization, 538 538 N_("Configuration error: Invalid \"Gateway\" value")); … … 549 549 pThis->IntNetIF.name[0] = 'I'; 550 550 pThis->IntNetIF.name[1] = 'N'; 551 551 552 552 ret = netif_add(&pThis->IntNetIF, &ipaddr, &netmask, &gw, NULL, 553 553 devINIPInterface, lwip_tcpip_input); … … 555 555 if (!ret) 556 556 { 557 557 558 558 pThis->rcInitialization = VERR_NET_NO_NETWORK; 559 PDMDEV_SET_ERROR(pThis->pDevIns, 559 PDMDEV_SET_ERROR(pThis->pDevIns, 560 560 pThis->rcInitialization, 561 561 N_("netif_add failed")); … … 565 565 lwip_netif_set_default(&pThis->IntNetIF); 566 566 lwip_netif_set_up(&pThis->IntNetIF); 567 567 568 568 #ifndef VBOX_WITH_NEW_LWIP 569 569 } … … 581 581 * XXX: We do it only for new LWIP, old LWIP will stay broken for now. 582 582 */ 583 static DECLCALLBACK(void) devINIPTcpipFiniDone(void *arg) 583 static DECLCALLBACK(void) devINIPTcpipFiniDone(void *arg) 584 584 { 585 585 PDEVINTNETIP pThis = (PDEVINTNETIP)arg; -
trunk/src/VBox/Devices/Network/DrvIntNet.cpp
r47499 r48947 1089 1089 Frame.Hdr.DstMac.au16[2] = 0xffff; 1090 1090 Frame.Hdr.EtherType = RT_H2BE_U16_C(0x801e); 1091 int rc = pThis->pIAboveConfigR3->pfnGetMac(pThis->pIAboveConfigR3, 1091 int rc = pThis->pIAboveConfigR3->pfnGetMac(pThis->pIAboveConfigR3, 1092 1092 &Frame.Hdr.SrcMac); 1093 1093 if (RT_SUCCESS(rc)) 1094 1094 rc = drvR3IntNetResumeSend(pThis, &Frame, sizeof(Frame)); 1095 1095 if (RT_FAILURE(rc)) 1096 LogRel(("IntNet#%u: Sending dummy frame failed: %Rrc\n", 1096 LogRel(("IntNet#%u: Sending dummy frame failed: %Rrc\n", 1097 1097 pDrvIns->iInstance, rc)); 1098 1098 } -
trunk/src/VBox/Devices/Network/DrvNAT.cpp
r48526 r48947 1050 1050 */ 1051 1051 #ifndef RT_OS_DARWIN 1052 pThis->pIAboveConfig->pfnSetLinkState(pThis->pIAboveConfig, 1052 pThis->pIAboveConfig->pfnSetLinkState(pThis->pIAboveConfig, 1053 1053 PDMNETWORKLINKSTATE_DOWN_RESUME); 1054 1054 #endif -
trunk/src/VBox/Devices/Network/SrvIntNetR0.cpp
r46921 r48947 1272 1272 break; 1273 1273 case kIntNetAddrType_IPv6: 1274 Log(("intnetR0IfAddrCacheAddIt: hIf=%#x MAC=%.6Rhxs IPv6 added #%d %RTnaipv6 %s\n", 1274 Log(("intnetR0IfAddrCacheAddIt: hIf=%#x MAC=%.6Rhxs IPv6 added #%d %RTnaipv6 %s\n", 1275 1275 pIf->hIf, &pIf->MacAddr, pCache->cEntries, pAddr->IPv6, pszMsg)); 1276 1276 break; … … 2858 2858 } 2859 2859 else if (pEthHdr->EtherType == RT_H2BE_U16(RTNET_ETHERTYPE_IPV6)) 2860 { 2860 { 2861 2861 /* 2862 * IPV6 ICMP Neighbor Discovery : replace 2862 * IPV6 ICMP Neighbor Discovery : replace 2863 2863 * 1) the advertised source mac address in outgoing neighbor sollicitations 2864 2864 * with the HW MAC address of the trunk interface, … … 2868 2868 * Note that this only applies to traffic going out on the trunk. Incoming 2869 2869 * NS/NA will never advertise any VM mac address, so we do not need to touch 2870 * them. Other VMs on this bridge as well as the host will see and use the VM's 2870 * them. Other VMs on this bridge as well as the host will see and use the VM's 2871 2871 * actual mac addresses. 2872 2872 * … … 2874 2874 2875 2875 PRTNETIPV6 pIPv6 = (PRTNETIPV6)(pEthHdr + 1); 2876 PRTNETNDP pNd = (PRTNETNDP)(pIPv6 + 1); 2877 PRTNETNDP_SLLA_OPT pLLAOpt = (PRTNETNDP_SLLA_OPT)(pNd + 1); 2876 PRTNETNDP pNd = (PRTNETNDP)(pIPv6 + 1); 2877 PRTNETNDP_SLLA_OPT pLLAOpt = (PRTNETNDP_SLLA_OPT)(pNd + 1); 2878 2878 2879 2879 /* make sure we have enough bytes to work with */ … … 2882 2882 pIPv6->ip6_hlim == 0xff && 2883 2883 /* protocol has to be icmpv6 */ 2884 pIPv6->ip6_nxt == RTNETIPV6_PROT_ICMPV6 && 2884 pIPv6->ip6_nxt == RTNETIPV6_PROT_ICMPV6 && 2885 2885 /* we either have a sollicitation with source link layer addr. opt, or */ 2886 2886 ((pNd->icmp6_type == RTNETIPV6_ICMP_NS_TYPE && … … 2900 2900 pNd->icmp6_cksum = computeIPv6FullChecksum(pIPv6); 2901 2901 } 2902 2902 2903 2903 } 2904 2904 } … … 2933 2933 * @param pNetwork The network the frame is being sent to. 2934 2934 * @param pSG Pointer to the gather list for the frame. 2935 * @param pEthHdr Pointer to the ethernet header. 2935 * @param pEthHdr Pointer to the ethernet header. 2936 2936 */ 2937 2937 static bool intnetR0NetworkDetectAndFixNdBroadcast(PINTNETNETWORK pNetwork, PINTNETSG pSG, PRTNETETHERHDR pEthHdr) … … 2943 2943 * using the temporary buffer if necessary. 2944 2944 */ 2945 if (RT_UNLIKELY(pSG->cbTotal < sizeof(RTNETETHERHDR) + sizeof(RTNETIPV6) + 2945 if (RT_UNLIKELY(pSG->cbTotal < sizeof(RTNETETHERHDR) + sizeof(RTNETIPV6) + 2946 2946 sizeof(RTNETNDP))) 2947 2947 return false; … … 2998 2998 * @param pNetwork The network the frame is being sent to. 2999 2999 * @param pSG Pointer to the gather list for the frame. 3000 * @param pEthHdr Pointer to the ethernet header. 3000 * @param pEthHdr Pointer to the ethernet header. 3001 3001 */ 3002 3002 static void intnetR0NetworkSnoopNAFromWire(PINTNETNETWORK pNetwork, PINTNETSG pSG, PRTNETETHERHDR pEthHdr) … … 3006 3006 * using the temporary buffer if necessary. 3007 3007 */ 3008 if (RT_UNLIKELY(pSG->cbTotal < sizeof(RTNETETHERHDR) + sizeof(RTNETIPV6) + 3008 if (RT_UNLIKELY(pSG->cbTotal < sizeof(RTNETETHERHDR) + sizeof(RTNETIPV6) + 3009 3009 sizeof(RTNETNDP))) 3010 3010 return; … … 3037 3037 && pIPv6->ip6_src.QWords.qw1 == 0) 3038 3038 { 3039 3040 intnetR0NetworkAddrCacheDelete(pNetwork, (PCRTNETADDRU) &pNd->target_address, 3039 3040 intnetR0NetworkAddrCacheDelete(pNetwork, (PCRTNETADDRU) &pNd->target_address, 3041 3041 kIntNetAddrType_IPv6, sizeof(RTNETADDRIPV6), "tif/ip6"); 3042 3042 } … … 5263 5263 case kIntNetTrunkType_WhateverNone: 5264 5264 #ifdef VBOX_WITH_NAT_SERVICE 5265 /* 5265 /* 5266 5266 * Well, here we don't want load anything special, 5267 * just communicate between processes via internal network. 5267 * just communicate between processes via internal network. 5268 5268 */ 5269 5269 case kIntNetTrunkType_SrvNat: … … 5288 5288 #endif /* VBOXNETADP_DO_NOT_USE_NETFLT */ 5289 5289 break; 5290 #ifndef VBOX_WITH_NAT_SERVICE 5290 #ifndef VBOX_WITH_NAT_SERVICE 5291 5291 case kIntNetTrunkType_SrvNat: 5292 5292 pszName = "VBoxSrvNat"; -
trunk/src/VBox/Devices/Network/slirp/dnsproxy/dnsproxy.c
r48526 r48947 120 120 /* be paranoid */ 121 121 AssertPtrReturnVoid(arg); 122 122 123 123 de = TAILQ_PREV(req->dns_server, dns_list_head, de_list); 124 124 125 125 if (de == NULL) 126 126 { … … 137 137 struct mbuf *m = NULL; 138 138 char *data; 139 139 140 140 m = slirpDnsMbufAlloc(pData); 141 141 if (m == NULL) … … 168 168 169 169 /* expiration will be bumped in dnsproxy_query */ 170 170 171 171 dnsproxy_query(pData, so, m, iphlen); 172 172 /* should we free so->so_m ? */ 173 173 return; 174 174 } 175 176 socket_clean_up: 175 176 socket_clean_up: 177 177 /* This socket (so) will be detached, so we need to remove timeout(&_arg) references 178 * before leave 178 * before leave 179 179 */ 180 180 so->so_timeout = NULL; … … 309 309 #else /* VBOX */ 310 310 AssertPtr(pData); 311 311 312 312 /* m->m_data points to IP header */ 313 313 #if 0 … … 340 340 341 341 342 req = so->so_timeout_arg; 342 req = so->so_timeout_arg; 343 343 344 344 if (!req) … … 347 347 Assert(!so->so_timeout_arg); 348 348 349 if ((req = RTMemAllocZ(sizeof(struct request) + byte)) == NULL) 349 if ((req = RTMemAllocZ(sizeof(struct request) + byte)) == NULL) 350 350 { 351 351 LogRel(("calloc failed\n")); … … 382 382 383 383 req->recursion = 0; 384 384 385 385 DPRINTF(("External query RD=%d\n", RD(buf))); 386 386 387 387 if (retransmit == 0) 388 388 hash_add_request(pData, req); … … 394 394 /* let's slirp to care about expiration */ 395 395 so->so_expire = curtime + recursive_timeout * 1000; 396 396 397 397 memset(&addr, 0, sizeof(struct sockaddr_in)); 398 398 addr.sin_family = AF_INET; … … 408 408 /* send it to our authoritative server */ 409 409 Log2(("NAT: request will be sent to %RTnaipv4 on %R[natsock]\n", addr.sin_addr, so)); 410 410 411 411 byte = sendto(so->s, buf, (unsigned int)byte, 0, 412 412 (struct sockaddr *)&addr, 413 413 sizeof(struct sockaddr_in)); 414 if (byte == -1) 414 if (byte == -1) 415 415 { 416 416 /* XXX: is it really enough? */ … … 425 425 ++authoritative_queries; 426 426 427 # if 0 428 /* XXX: this stuff for _debugging_ only, 429 * first enforce guest to send next request 430 * and second for faster getting timeout callback 431 * other option is adding couple entries in resolv.conf with 427 # if 0 428 /* XXX: this stuff for _debugging_ only, 429 * first enforce guest to send next request 430 * and second for faster getting timeout callback 431 * other option is adding couple entries in resolv.conf with 432 432 * invalid nameservers. 433 433 * 434 * For testing purposes could be used 435 * namebench -S -q 10000 -m random or -m chunk 434 * For testing purposes could be used 435 * namebench -S -q 10000 -m random or -m chunk 436 436 */ 437 437 /* RTThreadSleep(3000); */ … … 497 497 LogRel(("sendto failed: %s\n", strerror(errno))); 498 498 ++dropped_answers; 499 } 499 } 500 500 else 501 501 ++answered_queries; … … 509 509 510 510 AssertPtr(pData); 511 511 512 512 /* XXX: mbuf->data points to ??? */ 513 513 byte = m->m_len; … … 524 524 525 525 /* find corresponding query */ 526 if (query == NULL) 526 if (query == NULL) 527 527 { 528 /* XXX: if we haven't found anything for this request ... 528 /* XXX: if we haven't found anything for this request ... 529 529 * What we are expecting later? 530 530 */ -
trunk/src/VBox/Devices/Network/slirp/slirp.c
r48526 r48947 354 354 /* set default addresses */ 355 355 inet_aton("127.0.0.1", &loopback_addr); 356 356 357 357 if (!fUseHostResolver) 358 358 { … … 744 744 if (so->so_timeout != NULL) 745 745 { 746 /* so_timeout - might change the so_expire value or 747 * drop so_timeout* from so. 746 /* so_timeout - might change the so_expire value or 747 * drop so_timeout* from so. 748 748 */ 749 749 so->so_timeout(pData, so, so->so_timeout_arg); 750 /* on 4.2 so-> 750 /* on 4.2 so-> 751 751 */ 752 752 if ( so_next->so_prev != so /* so_timeout freed the socket */
Note:
See TracChangeset
for help on using the changeset viewer.