- Timestamp:
- Oct 7, 2015 1:54:00 PM (9 years ago)
- Location:
- trunk/src/VBox/HostDrivers/VBoxNetAdp
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/HostDrivers/VBoxNetAdp/VBoxNetAdpInternal.h
r57907 r58093 102 102 /** MAC address. */ 103 103 RTMAC Mac; 104 /** Protocol families attached to this adapter. */105 protocol_family_t aAttachedFamilies[VBOXNETADP_MAX_FAMILIES];106 104 /** @} */ 107 105 # elif defined(RT_OS_LINUX) -
trunk/src/VBox/HostDrivers/VBoxNetAdp/darwin/VBoxNetAdp-darwin.cpp
r58070 r58093 156 156 mbuf_freem_list(pMBuf); 157 157 return 0; 158 }159 160 static void vboxNetAdpDarwinAttachFamily(PVBOXNETADP pThis, protocol_family_t Family)161 {162 u_int32_t i;163 for (i = 0; i < VBOXNETADP_MAX_FAMILIES; i++)164 if (pThis->u.s.aAttachedFamilies[i] == 0)165 {166 pThis->u.s.aAttachedFamilies[i] = Family;167 break;168 }169 }170 171 static void vboxNetAdpDarwinDetachFamily(PVBOXNETADP pThis, protocol_family_t Family)172 {173 u_int32_t i;174 for (i = 0; i < VBOXNETADP_MAX_FAMILIES; i++)175 if (pThis->u.s.aAttachedFamilies[i] == Family)176 pThis->u.s.aAttachedFamilies[i] = 0;177 }178 179 static errno_t vboxNetAdpDarwinAddProto(ifnet_t pIface, protocol_family_t Family, const struct ifnet_demux_desc *pDemuxDesc, u_int32_t nDesc)180 {181 PVBOXNETADP pThis = VBOXNETADP_FROM_IFACE(pIface);182 Assert(pThis);183 vboxNetAdpDarwinAttachFamily(pThis, Family);184 LogFlow(("vboxNetAdpAddProto: Family=%d.\n", Family));185 return ether_add_proto(pIface, Family, pDemuxDesc, nDesc);186 }187 188 static errno_t vboxNetAdpDarwinDelProto(ifnet_t pIface, protocol_family_t Family)189 {190 PVBOXNETADP pThis = VBOXNETADP_FROM_IFACE(pIface);191 Assert(pThis);192 LogFlow(("vboxNetAdpDelProto: Family=%d.\n", Family));193 vboxNetAdpDarwinDetachFamily(pThis, Family);194 return ether_del_proto(pIface, Family);195 158 } 196 159 … … 295 258 Params.output = vboxNetAdpDarwinOutput; 296 259 Params.demux = vboxNetAdpDarwinDemux; 297 Params.add_proto = vboxNetAdpDarwinAddProto;298 Params.del_proto = vboxNetAdpDarwinDelProto;260 Params.add_proto = ether_add_proto; 261 Params.del_proto = ether_del_proto; 299 262 Params.check_multi = ether_check_multi; 300 263 Params.framer = ether_frameout; … … 353 316 Log(("vboxNetAdpDarwinUnregisterDevice: Failed to bring down interface " 354 317 "(err=%d).\n", err)); 355 /* Detach all protocols. */356 for (i = 0; i < VBOXNETADP_MAX_FAMILIES; i++)357 if (pThis->u.s.aAttachedFamilies[i])358 ifnet_detach_protocol(pThis->u.s.pIface, pThis->u.s.aAttachedFamilies[i]);359 318 err = ifnet_detach(pThis->u.s.pIface); 360 319 if (err) … … 470 429 pThis->u.s.pIface = NULL; 471 430 pThis->u.s.hEvtDetached = NIL_RTSEMEVENT; 472 memset(pThis->u.s.aAttachedFamilies, 0, sizeof(pThis->u.s.aAttachedFamilies));473 431 474 432 return VINF_SUCCESS;
Note:
See TracChangeset
for help on using the changeset viewer.