Changeset 49686 in vbox for trunk/src/VBox/HostDrivers/VBoxNetAdp/darwin
- Timestamp:
- Nov 27, 2013 5:41:15 PM (11 years ago)
- svn:sync-xref-src-repo-rev:
- 90956
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/HostDrivers/VBoxNetAdp/darwin/VBoxNetAdp-darwin.cpp
r44529 r49686 231 231 mbuf_freem_list(pMBuf); 232 232 return 0; 233 } 234 235 236 /** 237 * Constructs and submits a dummy packet to ifnet_input(). This is a workaround 238 * for "stuck dock icon" issue. When the first packet goes through the interface 239 * DLIL grabs a reference to the thread that submits the packet and holds it 240 * until the interface is destroyed. By submitting this dummy we make DLIL grab 241 * the thread of a non-GUI process. 242 * 243 * Most of this function was copied from vboxNetFltDarwinMBufFromSG(). 244 * 245 * @returns VBox status code. 246 * @param pIfNet The interface that will hold the reference to the calling 247 * thread. We submit dummy as if it was coming from this interface. 248 */ 249 static int vboxNetSendDummy(ifnet_t pIfNet) 250 { 251 int rc = 0; 252 size_t cbTotal = 50; /* No Ethernet header */ 253 mbuf_how_t How = MBUF_WAITOK; 254 255 mbuf_t pPkt = NULL; 256 errno_t err = mbuf_allocpacket(How, cbTotal, NULL, &pPkt); 257 if (!err) 258 { 259 /* Skip zero sized memory buffers (paranoia). */ 260 mbuf_t pCur = pPkt; 261 while (pCur && !mbuf_maxlen(pCur)) 262 pCur = mbuf_next(pCur); 263 Assert(pCur); 264 265 /* Set the required packet header attributes. */ 266 mbuf_pkthdr_setlen(pPkt, cbTotal); 267 mbuf_pkthdr_setheader(pPkt, mbuf_data(pCur)); 268 269 mbuf_setlen(pCur, cbTotal); 270 memset(mbuf_data(pCur), 0, cbTotal); 271 272 mbuf_pkthdr_setrcvif(pPkt, pIfNet); /* will crash without this. */ 273 274 errno_t err = ifnet_input(pIfNet, pPkt, NULL); 275 if (err) 276 { 277 rc = RTErrConvertFromErrno(err); 278 mbuf_freem(pPkt); 279 } 280 } 281 else 282 rc = RTErrConvertFromErrno(err); 283 284 return rc; 233 285 } 234 286 … … 295 347 { 296 348 ifnet_set_mtu(pThis->u.s.pIface, VBOXNETADP_MTU); 349 vboxNetSendDummy(pThis->u.s.pIface); 297 350 return VINF_SUCCESS; 298 351 }
Note:
See TracChangeset
for help on using the changeset viewer.