VirtualBox

Changeset 13787 in vbox


Ignore:
Timestamp:
Nov 4, 2008 3:22:17 PM (16 years ago)
Author:
vboxsync
Message:

Solaris/VBoxNetFlt: cleanup.

File:
1 edited

Legend:

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

    r13769 r13787  
    21392139
    21402140/**
    2141  * Wrapper for attaching our module to the specificed stream on the host stack.
    2142  * As a side-effect, the streams also gets opened/closed during the actual injection/ejection phase.
    2143  *
    2144  * @returns VBox status code.
    2145  * @param   pThis       The instance.
    2146  * @param   fAttach     Is this an attach or detach.
    2147  * @param   StreamType  Identifies the host stream the module be inject/ejected.
    2148  */
    2149 static int vboxNetFltSolarisModSetup(PVBOXNETFLTINS pThis, bool fAttach, VBOXNETFLTSTREAMTYPE StreamType)
    2150 {
    2151     LogFlow(("vboxNetFltSolarisModSetup: pThis=%p (%s) fAttach=%s StreamType=%d\n", pThis, pThis->szName,
    2152             fAttach ? "true" : "false", StreamType));
    2153 
    2154     switch (StreamType)
    2155     {
    2156         case kIp4Stream:
    2157         case kArpStream:
    2158             return vboxNetFltSolarisAttachIp4(pThis, fAttach);
    2159 
    2160         case kIp6Stream:
    2161             return vboxNetFltSolarisAttachIp6(pThis, fAttach);
    2162 
    2163         default:
    2164             LogRel((DEVICE_NAME ":vboxNetFltSolarisModSetup: Invalid stream type %d\n", StreamType));
    2165             return VERR_INTNET_FLT_IF_FAILED;
    2166     }
    2167 }
    2168 
    2169 
    2170 
    2171 /**
    21722141 * Wrapper for attaching ourselves to the interface.
    21732142 *
     
    21822151    if (RT_SUCCESS(rc))
    21832152    {
    2184         rc = vboxNetFltSolarisModSetup(pThis, true, kIp4Stream);
     2153        rc = vboxNetFltSolarisAttachIp4(pThis, true /* fAttach */);
    21852154        if (RT_SUCCESS(rc))
    21862155        {
    2187             vboxNetFltSolarisModSetup(pThis, true, kIp6Stream);
     2156            vboxNetFltSolarisAttachIp6(pThis, true /* fAttach */);
    21882157            /* Ignore Ipv6 binding errors as it's optional. */
    21892158
     
    22142183    ASMAtomicWriteBool(&pThis->fDisconnectedFromHost, true);
    22152184    vboxNetFltSolarisCloseStream(pThis);
    2216     int rc = vboxNetFltSolarisModSetup(pThis, false, kIp4Stream);
     2185    int rc = vboxNetFltSolarisAttachIp4(pThis, false /* fAttach */);
    22172186    if (pThis->u.s.pvIp6Stream)
    2218         rc = vboxNetFltSolarisModSetup(pThis, false, kIp6Stream);
     2187        rc = vboxNetFltSolarisAttachIp6(pThis, false /* fAttach */);
    22192188
    22202189    return rc;
     
    31603129    {
    31613130#ifdef VBOXNETFLT_SOLARIS_USE_NETINFO
     3131        /*
     3132         * @todo try find a way for IPFilter to accept ethernet frames (currently silently drops them).
     3133         */
    31623134        mblk_t *pMsg = vboxNetFltSolarisMBlkFromSG(pThis, pSG, fDst);
    31633135        if (RT_LIKELY(pMsg))
    31643136        {
     3137            PCRTNETETHERHDR pEthHdr = (PCRTNETETHERHDR)pMsg->b_rptr;
     3138            unsigned uProtocol;
     3139            if (pEthHdr->EtherType == RT_H2BE_U16(RTNET_ETHERTYPE_IPV6))
     3140                uProtocol = AF_INET6;
     3141            else if (pEthHdr->EtherType == RT_H2BE_U16(RTNET_ETHERTYPE_IPV4))
     3142                uProtocol = AF_INET;
     3143
     3144            /*
     3145             * Queue out using netinfo.
     3146             */
    31653147            netstack_t *pNetStack = netstack_get_current();
    31663148            if (pNetStack)
     
    31763158                        InjectData.ni_physical = pInterface;
    31773159                        bzero(&InjectData.ni_addr, sizeof(InjectData.ni_addr));
    3178                         InjectData.ni_addr.ss_family = AF_INET;
     3160                        InjectData.ni_addr.ss_family = uProtocol;
    31793161
    31803162                        /*
     
    32333215        }
    32343216#endif
    3235 
    32363217    }
    32373218
     
    32953276                      * Send messages up IPv6 stream.
    32963277                      */
    3297                       LogFlow((DEVICE_NAME ":vboxNetFltPortOsXmit INTNETTRUNKDIR_HOST IPv6\n"));
     3278                     LogFlow((DEVICE_NAME ":vboxNetFltPortOsXmit INTNETTRUNKDIR_HOST IPv6\n"));
    32983279
    32993280                     pMsg->b_rptr += sizeof(RTNETETHERHDR);
Note: See TracChangeset for help on using the changeset viewer.

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