VirtualBox

Ignore:
Timestamp:
Sep 5, 2011 2:34:18 PM (14 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
73847
Message:

solaris/VBoxNetFltBow: fixed multicast and IPv6 packets.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/HostDrivers/VBoxNetFlt/solaris/VBoxNetFltBow-solaris.c

    r38160 r38640  
    226226    /** The unicast address handle. */
    227227    mac_unicast_handle_t        hUnicast;
     228    /** The promiscuous handle. */
     229    mac_promisc_handle_t        hPromisc;
    228230    /* The VNIC name. */
    229231    char                        szName[MAXLINKNAMESPECIFIER];
     
    232234} VBOXNETFLTVNIC;
    233235typedef struct VBOXNETFLTVNIC *PVBOXNETFLTVNIC;
     236
    234237
    235238/*******************************************************************************
     
    982985    pVNIC->hClient         = NULL;
    983986    pVNIC->hUnicast        = NULL;
     987    pVNIC->hPromisc        = NULL;
    984988    RT_ZERO(pVNIC->szName);
    985989    list_link_init(&pVNIC->hNode);
     
    10171021                mac_unicast_remove(pVNIC->hClient, pVNIC->hUnicast);
    10181022                pVNIC->hUnicast = NULL;
     1023            }
     1024
     1025            if (pVNIC->hPromisc)
     1026            {
     1027                mac_promisc_remove(pVNIC->hPromisc);
     1028                pVNIC->hPromisc = NULL;
    10191029            }
    10201030
     
    12061216
    12071217
     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 */
     1226LOCAL 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 */
     1247LOCAL 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
    12081257/* -=-=-=-=-=- Common Hooks -=-=-=-=-=- */
    12091258
     
    12211270        for (; pVNIC != NULL; pVNIC = list_next(&pThis->u.s.hVNICs, pVNIC))
    12221271            if (pVNIC->hClient)
     1272            {
     1273#if 0
    12231274                mac_rx_set(pVNIC->hClient, vboxNetFltSolarisRecv, pThis);
     1275#endif
     1276                vboxNetFltSolarisSetPromisc(pThis, pVNIC);
     1277            }
    12241278    }
    12251279    else
     
    12271281        for (; pVNIC != NULL; pVNIC = list_next(&pThis->u.s.hVNICs, pVNIC))
    12281282            if (pVNIC->hClient)
     1283            {
     1284#if 0
    12291285                mac_rx_clear(pVNIC->hClient);
     1286#endif
     1287                vboxNetFltSolarisRemovePromisc(pThis, pVNIC);
     1288            }
    12301289    }
    12311290}
     
    14111470    {
    14121471        /*
    1413          * Remove existing unicast address and the RX hook.
     1472         * Remove existing unicast address, promisc. and the RX hook.
    14141473         */
    14151474        if (pVNIC->hUnicast)
     
    14201479        }
    14211480
    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
    14251487        mac_diag_t MacDiag = MAC_DIAG_NONE;
    14261488        /* uint16_t uVLANId = pVNIC->pVNICTemplate ? pVNIC->pVNICTemplate->uVLANId : 0; */
     1489#if 0
    14271490        rc = mac_unicast_add(pVNIC->hClient, NULL, MAC_UNICAST_PRIMARY, &pVNIC->hUnicast, 0 /* VLAN Id */, &MacDiag);
     1491#endif
    14281492        if (RT_LIKELY(!rc))
    14291493        {
    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
    14371511        }
    14381512        else
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette