Changeset 104159 in vbox
- Timestamp:
- Apr 4, 2024 3:35:39 PM (10 months ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/intnet.h
r104045 r104159 356 356 uint16_t cSegsUsed; 357 357 /** Variable sized list of segments. */ 358 INTNETSEG aSegs[1]; 358 RT_FLEXIBLE_ARRAY_EXTENSION 359 INTNETSEG aSegs[RT_FLEXIBLE_ARRAY]; 359 360 } INTNETSG; 360 361 AssertCompileSizeAlignment(INTNETSG, 8); -
trunk/src/VBox/Devices/Network/SrvIntNetR0.cpp
r103025 r104159 4105 4105 */ 4106 4106 INTNETSWDECISION enmSwDecision = INTNETSWDECISION_BROADCAST; 4107 INTNETSG Sg; /** @todo this will have to be changed if we're going to use async sending 4108 * with buffer sharing for some OS or service. Darwin copies everything so 4109 * I won't bother allocating and managing SGs right now. Sorry. */ 4107 4108 /** @todo this will have to be changed if we're going to use async sending 4109 * with buffer sharing for some OS or service. Darwin copies everything so 4110 * I won't bother allocating and managing SGs right now. Sorry. */ 4111 union 4112 { 4113 uint8_t abBuf[sizeof(INTNETSG) + sizeof(INTNETSEG)]; 4114 INTNETSG SG; 4115 } u; 4116 4110 4117 PINTNETHDR pHdr; 4111 4118 while ((pHdr = IntNetRingGetNextFrameToRead(&pIf->pIntBuf->Send)) != NULL) … … 4116 4123 /* Send regular frame. */ 4117 4124 void *pvCurFrame = IntNetHdrGetFramePtr(pHdr, pIf->pIntBuf); 4118 IntNetSgInitTemp(& Sg, pvCurFrame, pHdr->cbFrame);4125 IntNetSgInitTemp(&u.SG, pvCurFrame, pHdr->cbFrame); 4119 4126 if (pNetwork->fFlags & INTNET_OPEN_FLAGS_SHARED_MAC_ON_WIRE) 4120 intnetR0IfSnoopAddr(pIf, (uint8_t *)pvCurFrame, pHdr->cbFrame, false /*fGso*/, (uint16_t *)& Sg.fFlags);4121 enmSwDecision = intnetR0NetworkSend(pNetwork, pIf, 0 /*fSrc*/, & Sg, pDstTab);4127 intnetR0IfSnoopAddr(pIf, (uint8_t *)pvCurFrame, pHdr->cbFrame, false /*fGso*/, (uint16_t *)&u.SG.fFlags); 4128 enmSwDecision = intnetR0NetworkSend(pNetwork, pIf, 0 /*fSrc*/, &u.SG, pDstTab); 4122 4129 } 4123 4130 else if (u8Type == INTNETHDR_TYPE_GSO) … … 4129 4136 { 4130 4137 void *pvCurFrame = pGso + 1; 4131 IntNetSgInitTempGso(& Sg, pvCurFrame, cbFrame, pGso);4138 IntNetSgInitTempGso(&u.SG, pvCurFrame, cbFrame, pGso); 4132 4139 if (pNetwork->fFlags & INTNET_OPEN_FLAGS_SHARED_MAC_ON_WIRE) 4133 intnetR0IfSnoopAddr(pIf, (uint8_t *)pvCurFrame, cbFrame, true /*fGso*/, (uint16_t *)& Sg.fFlags);4134 enmSwDecision = intnetR0NetworkSend(pNetwork, pIf, 0 /*fSrc*/, & Sg, pDstTab);4140 intnetR0IfSnoopAddr(pIf, (uint8_t *)pvCurFrame, cbFrame, true /*fGso*/, (uint16_t *)&u.SG.fFlags); 4141 enmSwDecision = intnetR0NetworkSend(pNetwork, pIf, 0 /*fSrc*/, &u.SG, pDstTab); 4135 4142 } 4136 4143 else -
trunk/src/VBox/Devices/Network/testcase/tstIntNetR0.cpp
r98103 r104159 204 204 PSUPDRVSESSION pSession, void const *pvBuf, size_t cbBuf) 205 205 { 206 INTNETSG Sg; 207 IntNetSgInitTemp(&Sg, (void *)pvBuf, (uint32_t)cbBuf); 208 int rc = intnetR0RingWriteFrame(pRingBuf, &Sg, NULL); 206 union 207 { 208 uint8_t abBuf[sizeof(INTNETSG) + sizeof(INTNETSEG)]; 209 INTNETSG SG; 210 } u; 211 IntNetSgInitTemp(&u.SG, (void *)pvBuf, (uint32_t)cbBuf); 212 int rc = intnetR0RingWriteFrame(pRingBuf, &u.SG, NULL); 209 213 if (RT_SUCCESS(rc)) 210 214 rc = IntNetR0IfSend(hIf, pSession); … … 270 274 pHdr->iFrame = iFrame; 271 275 272 INTNETSG Sg; 273 IntNetSgInitTemp(&Sg, abBuf, cb); 274 RTTEST_CHECK_RC_OK(g_hTest, rc = intnetR0RingWriteFrame(&pArgs->pBuf->Send, &Sg, NULL)); 276 union 277 { 278 uint8_t abBuf[sizeof(INTNETSG) + sizeof(INTNETSEG)]; 279 INTNETSG SG; 280 } u; 281 IntNetSgInitTemp(&u.SG, abBuf, cb); 282 RTTEST_CHECK_RC_OK(g_hTest, rc = intnetR0RingWriteFrame(&pArgs->pBuf->Send, &u.SG, NULL)); 275 283 if (RT_SUCCESS(rc)) 276 284 RTTEST_CHECK_RC_OK(g_hTest, rc = IntNetR0IfSend(pArgs->hIf, g_pSession)); -
trunk/src/VBox/HostDrivers/VBoxNetFlt/win/drv/VBoxNetFltRt-win.cpp
r98103 r104159 1142 1142 * 2. buffer of cbPacket containing the entire packet */ 1143 1143 AssertCompileSizeAlignment(INTNETSG, sizeof(PVOID)); 1144 Status = vboxNetFltWinMemAlloc((PVOID*)&pSG, cbPacket + sizeof(INTNETSG));1144 Status = vboxNetFltWinMemAlloc((PVOID*)&pSG, cbPacket + RT_UOFFSETOF_DYN(INTNETSG, aSegs[1])); 1145 1145 if (Status == NDIS_STATUS_SUCCESS) 1146 1146 {
Note:
See TracChangeset
for help on using the changeset viewer.