Changeset 54730 in vbox for trunk/src/VBox/NetworkServices/NetLib/VBoxNetBaseService.cpp
- Timestamp:
- Mar 12, 2015 2:55:13 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/NetworkServices/NetLib/VBoxNetBaseService.cpp
r54723 r54730 1 1 /* $Id$ */ 2 2 /** @file 3 * VBoxNet DHCP - DHCP Service for connecting to IntNet.3 * VBoxNetBaseService - common services for VBoxNetDHCP and VBoxNetNAT. 4 4 */ 5 /** @todo r=bird: Cut&Past rules... Please fix DHCP refs! */6 5 7 6 /* 8 * Copyright (C) 2009-201 1Oracle Corporation7 * Copyright (C) 2009-2015 Oracle Corporation 9 8 * 10 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 172 171 * Close the interface connection. 173 172 */ 174 if (m != NULL)173 if (m) 175 174 { 176 175 shutdown(); … … 228 227 { 229 228 /** 230 * If child class need Main we start receving thread which calls doReceiveLoop and enter to event polling loop 231 * and for the rest clients we do receiving on the current (main) thread. 229 * If the child class needs Main we start the receving thread which calls 230 * doReceiveLoop and enter to event polling loop. For other clients we do 231 * receiving on the current (main) thread. 232 232 */ 233 233 if (isMainNeeded()) 234 234 return startReceiveThreadAndEnterEventLoop(); 235 else 236 { 237 doReceiveLoop(); 238 return VINF_SUCCESS; 239 } 235 236 doReceiveLoop(); 237 return VINF_SUCCESS; 240 238 } 241 239 … … 341 339 342 340 default: 341 { 343 342 int rc1 = parseOpt(rc, Val); 344 343 if (RT_FAILURE(rc1)) … … 348 347 return rc; 349 348 } 349 break; 350 } 350 351 } 351 352 } … … 464 465 { 465 466 int rc = abortWait(); 466 AssertRC(rc );467 AssertRC(rc == VINF_SUCCESS || rc == VERR_SEM_DESTROYED); 467 468 rc = m->m_EventQ->interruptEventQueueProcessing(); 468 469 if (RT_SUCCESS(rc)) … … 564 565 AssertRCReturnVoid(rc); 565 566 LogFlowFuncLeave(); 566 567 567 } 568 568 … … 691 691 * Wait for a packet to become available. 692 692 */ 693 /* 2. waiting for request for */694 693 rc = waitForIntNetEvent(2000); 694 if (rc == VERR_SEM_DESTROYED) 695 break; 696 695 697 if (RT_FAILURE(rc)) 696 698 { … … 700 702 continue; 701 703 } 702 LogRel(("VBoxNet NAT: waitForIntNetEvent returned %Rrc\n", rc));704 LogRel(("VBoxNetBaseService: waitForIntNetEvent returned %Rrc\n", rc)); 703 705 AssertRCReturnVoid(rc); 704 706 } … … 708 710 */ 709 711 PCINTNETHDR pHdr; 710 711 712 while ((pHdr = IntNetRingGetNextFrameToRead(pRingBuf)) != NULL) 712 713 { 713 714 uint8_t const u8Type = pHdr->u8Type; 714 size_t 715 size_t cbFrame = pHdr->cbFrame; 715 716 switch (u8Type) 716 717 { 717 718 718 case INTNETHDR_TYPE_FRAME: 719 { 720 void *pvFrame = IntNetHdrGetFramePtr(pHdr, m->m_pIfBuf); 721 rc = processFrame(pvFrame, cbFrame); 722 if (RT_FAILURE(rc) && rc == VERR_IGNORED) 719 723 { 720 void *pvFrame = IntNetHdrGetFramePtr(pHdr, m->m_pIfBuf); 721 rc = processFrame(pvFrame, cbFrame); 722 if (RT_FAILURE(rc) && rc == VERR_IGNORED) 723 { 724 /* XXX: UDP + ARP for DHCP */ 725 VBOXNETUDPHDRS Hdrs; 726 size_t cb; 727 void *pv = VBoxNetUDPMatch(m->m_pIfBuf, RTNETIPV4_PORT_BOOTPS, &m->m_MacAddress, 728 VBOXNETUDP_MATCH_UNICAST | VBOXNETUDP_MATCH_BROADCAST 729 | VBOXNETUDP_MATCH_CHECKSUM 730 | (m->m_cVerbosity > 2 ? VBOXNETUDP_MATCH_PRINT_STDERR : 0), 731 &Hdrs, &cb); 732 if (pv && cb) 733 processUDP(pv, cb); 734 else 735 VBoxNetArpHandleIt(m->m_pSession, m->m_hIf, m->m_pIfBuf, &m->m_MacAddress, m->m_Ipv4Address); 736 } 724 /* XXX: UDP + ARP for DHCP */ 725 VBOXNETUDPHDRS Hdrs; 726 size_t cb; 727 void *pv = VBoxNetUDPMatch(m->m_pIfBuf, RTNETIPV4_PORT_BOOTPS, &m->m_MacAddress, 728 VBOXNETUDP_MATCH_UNICAST 729 | VBOXNETUDP_MATCH_BROADCAST 730 | VBOXNETUDP_MATCH_CHECKSUM 731 | (m->m_cVerbosity > 2 ? VBOXNETUDP_MATCH_PRINT_STDERR : 0), 732 &Hdrs, &cb); 733 if (pv && cb) 734 processUDP(pv, cb); 735 else 736 VBoxNetArpHandleIt(m->m_pSession, m->m_hIf, m->m_pIfBuf, &m->m_MacAddress, m->m_Ipv4Address); 737 737 } 738 738 break; 739 } 739 740 case INTNETHDR_TYPE_GSO: 740 { 741 PCPDMNETWORKGSO pGso = IntNetHdrGetGsoContext(pHdr, m->m_pIfBuf); 742 rc = processGSO(pGso, cbFrame); 743 if (RT_FAILURE(rc) && rc == VERR_IGNORED) 744 break; 745 } 746 break; 741 { 742 PCPDMNETWORKGSO pGso = IntNetHdrGetGsoContext(pHdr, m->m_pIfBuf); 743 rc = processGSO(pGso, cbFrame); 744 if (RT_FAILURE(rc) && rc == VERR_IGNORED) 745 break; 746 break; 747 } 748 747 749 case INTNETHDR_TYPE_PADDING: 748 750 break; 751 749 752 default: 750 753 break; 751 754 } 752 755 IntNetRingSkipFrame(&m->m_pIfBuf->Recv); 753 754 756 } /* loop */ 755 757 } 756 757 758 } 758 759 … … 768 769 128 * _1K, /* stack size */ 769 770 RTTHREADTYPE_IO, /* type */ 770 0, /* flags, @todo: waitable ?*/771 RTTHREADFLAGS_WAITABLE, /* flags */ 771 772 "RECV"); 772 773 AssertRCReturn(rc, rc); … … 822 823 va_end(vaCopy); 823 824 } 824 825 825 } 826 826
Note:
See TracChangeset
for help on using the changeset viewer.