Changeset 38640 in vbox for trunk/src/VBox/HostDrivers/VBoxNetFlt
- Timestamp:
- Sep 5, 2011 2:34:18 PM (14 years ago)
- svn:sync-xref-src-repo-rev:
- 73847
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/HostDrivers/VBoxNetFlt/solaris/VBoxNetFltBow-solaris.c
r38160 r38640 226 226 /** The unicast address handle. */ 227 227 mac_unicast_handle_t hUnicast; 228 /** The promiscuous handle. */ 229 mac_promisc_handle_t hPromisc; 228 230 /* The VNIC name. */ 229 231 char szName[MAXLINKNAMESPECIFIER]; … … 232 234 } VBOXNETFLTVNIC; 233 235 typedef struct VBOXNETFLTVNIC *PVBOXNETFLTVNIC; 236 234 237 235 238 /******************************************************************************* … … 982 985 pVNIC->hClient = NULL; 983 986 pVNIC->hUnicast = NULL; 987 pVNIC->hPromisc = NULL; 984 988 RT_ZERO(pVNIC->szName); 985 989 list_link_init(&pVNIC->hNode); … … 1017 1021 mac_unicast_remove(pVNIC->hClient, pVNIC->hUnicast); 1018 1022 pVNIC->hUnicast = NULL; 1023 } 1024 1025 if (pVNIC->hPromisc) 1026 { 1027 mac_promisc_remove(pVNIC->hPromisc); 1028 pVNIC->hPromisc = NULL; 1019 1029 } 1020 1030 … … 1206 1216 1207 1217 1218 /** 1219 * Set the promiscuous mode RX hook. 1220 * 1221 * @param pThis The VM connection instance. 1222 * @param pVNIC Pointer to the VNIC. 1223 * 1224 * @returns VBox status code. 1225 */ 1226 LOCAL inline int vboxNetFltSolarisSetPromisc(PVBOXNETFLTINS pThis, PVBOXNETFLTVNIC pVNIC) 1227 { 1228 int rc = VINF_SUCCESS; 1229 if (!pVNIC->hPromisc) 1230 { 1231 rc = mac_promisc_add(pVNIC->hClient, MAC_CLIENT_PROMISC_FILTERED, vboxNetFltSolarisRecv, pThis, &pVNIC->hPromisc, 1232 MAC_PROMISC_FLAGS_NO_TX_LOOP | MAC_PROMISC_FLAGS_VLAN_TAG_STRIP | MAC_PROMISC_FLAGS_NO_PHYS); 1233 if (RT_UNLIKELY(rc)) 1234 LogRel((DEVICE_NAME ":vboxNetFltSolarisSetPromisc failed. rc=%d\n", rc)); 1235 rc = RTErrConvertFromErrno(rc); 1236 } 1237 return rc; 1238 } 1239 1240 1241 /** 1242 * Clear the promiscuous mode RX hook. 1243 * 1244 * @param pThis The VM connection instance. 1245 * @param pVNIC Pointer to the VNIC. 1246 */ 1247 LOCAL inline void vboxNetFltSolarisRemovePromisc(PVBOXNETFLTINS pThis, PVBOXNETFLTVNIC pVNIC) 1248 { 1249 if (pVNIC->hPromisc) 1250 { 1251 mac_promisc_remove(pVNIC->hPromisc); 1252 pVNIC->hPromisc = NULL; 1253 } 1254 } 1255 1256 1208 1257 /* -=-=-=-=-=- Common Hooks -=-=-=-=-=- */ 1209 1258 … … 1221 1270 for (; pVNIC != NULL; pVNIC = list_next(&pThis->u.s.hVNICs, pVNIC)) 1222 1271 if (pVNIC->hClient) 1272 { 1273 #if 0 1223 1274 mac_rx_set(pVNIC->hClient, vboxNetFltSolarisRecv, pThis); 1275 #endif 1276 vboxNetFltSolarisSetPromisc(pThis, pVNIC); 1277 } 1224 1278 } 1225 1279 else … … 1227 1281 for (; pVNIC != NULL; pVNIC = list_next(&pThis->u.s.hVNICs, pVNIC)) 1228 1282 if (pVNIC->hClient) 1283 { 1284 #if 0 1229 1285 mac_rx_clear(pVNIC->hClient); 1286 #endif 1287 vboxNetFltSolarisRemovePromisc(pThis, pVNIC); 1288 } 1230 1289 } 1231 1290 } … … 1411 1470 { 1412 1471 /* 1413 * Remove existing unicast address and the RX hook.1472 * Remove existing unicast address, promisc. and the RX hook. 1414 1473 */ 1415 1474 if (pVNIC->hUnicast) … … 1420 1479 } 1421 1480 1422 /* 1423 * Add the primary unicast address and set the RX hook. 1424 */ 1481 if (pVNIC->hPromisc) 1482 { 1483 mac_promisc_remove(pVNIC->hPromisc); 1484 pVNIC->hPromisc = NULL; 1485 } 1486 1425 1487 mac_diag_t MacDiag = MAC_DIAG_NONE; 1426 1488 /* uint16_t uVLANId = pVNIC->pVNICTemplate ? pVNIC->pVNICTemplate->uVLANId : 0; */ 1489 #if 0 1427 1490 rc = mac_unicast_add(pVNIC->hClient, NULL, MAC_UNICAST_PRIMARY, &pVNIC->hUnicast, 0 /* VLAN Id */, &MacDiag); 1491 #endif 1428 1492 if (RT_LIKELY(!rc)) 1429 1493 { 1430 /* 1431 * Set the RX receive function. 1432 * This shouldn't be necessary as vboxNetFltPortOsSetActive() will be invoked after this, but in the future, 1433 * if the guest NIC changes MAC address this may not be followed by a vboxNetFltPortOsSetActive() call, so set it here anyway. 1434 */ 1435 mac_rx_set(pVNIC->hClient, vboxNetFltSolarisRecv, pThis); 1436 LogFlow((DEVICE_NAME ":vboxNetFltPortOsNotifyMacAddress successfully added unicast address %.6Rhxs\n", pMac)); 1494 rc = vboxNetFltSolarisSetPromisc(pThis, pVNIC); 1495 #if 0 1496 if (RT_SUCCESS(rc)) 1497 { 1498 /* 1499 * Set the RX receive function. 1500 * This shouldn't be necessary as vboxNetFltPortOsSetActive() will be invoked after this, but in the future, 1501 * if the guest NIC changes MAC address this may not be followed by a vboxNetFltPortOsSetActive() call, so set it here anyway. 1502 */ 1503 mac_rx_set(pVNIC->hClient, vboxNetFltSolarisRecv, pThis); 1504 LogFlow((DEVICE_NAME ":vboxNetFltPortOsNotifyMacAddress successfully added unicast address %.6Rhxs\n", pMac)); 1505 } 1506 else 1507 LogRel((DEVICE_NAME ":vboxNetFltPortOsNotifyMacAddress failed to set promiscuous mode. rc=%d\n", rc)); 1508 mac_unicast_remove(pVNIC->hClient, pVNIC->hUnicast); 1509 pVNIC->hUnicast = NULL; 1510 #endif 1437 1511 } 1438 1512 else
Note:
See TracChangeset
for help on using the changeset viewer.