VirtualBox

Changeset 36075 in vbox for trunk/src/VBox/Main/src-client


Ignore:
Timestamp:
Feb 24, 2011 4:36:48 PM (14 years ago)
Author:
vboxsync
Message:

More flexible internal network promisc mode (++) policy management.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/src-client/ConsoleImpl2.cpp

    r36053 r36075  
    34793479        H();
    34803480
     3481        hrc = pMachine->GetExtraData(Bstr("AllowPromiscousGuests").raw(), bstr.asOutParam());
     3482        if (SUCCEEDED(hrc) && bstr.isEmpty())
     3483            hrc = virtualBox->GetExtraData(Bstr("AllowPromiscousGuests").raw(), bstr.asOutParam());
     3484        H();
     3485        const char * const pszPromiscuousGuestPolicy = bstr.isNotEmpty() ? "allow" : "deny";
     3486
    34813487        if (fAttachDetach && fSniffer)
    34823488        {
     
    36423648        ppos = pos + 1; \
    36433649    } while (0)
    3644                 ITERATE_TO_NEXT_TERM(strName, utf, pos, ppos);
    3645                 ITERATE_TO_NEXT_TERM(strProto, utf, pos, ppos);
    3646                 ITERATE_TO_NEXT_TERM(strHostIP, utf, pos, ppos);
    3647                 ITERATE_TO_NEXT_TERM(strHostPort, utf, pos, ppos);
    3648                 ITERATE_TO_NEXT_TERM(strGuestIP, utf, pos, ppos);
    3649                 strGuestPort = utf.substr(ppos, utf.length() - ppos);
     3650                    ITERATE_TO_NEXT_TERM(strName, utf, pos, ppos);
     3651                    ITERATE_TO_NEXT_TERM(strProto, utf, pos, ppos);
     3652                    ITERATE_TO_NEXT_TERM(strHostIP, utf, pos, ppos);
     3653                    ITERATE_TO_NEXT_TERM(strHostPort, utf, pos, ppos);
     3654                    ITERATE_TO_NEXT_TERM(strGuestIP, utf, pos, ppos);
     3655                    strGuestPort = utf.substr(ppos, utf.length() - ppos);
    36503656#undef ITERATE_TO_NEXT_TERM
    36513657
     
    39663972                InsertConfigInteger(pCfg, "TrunkType", kIntNetTrunkType_NetFlt);
    39673973                InsertConfigInteger(pCfg, "IgnoreConnectFailure", (uint64_t)fIgnoreConnectFailure);
     3974                InsertConfigString(pCfg, "IfPolicyPromisc", pszPromiscuousGuestPolicy);
    39683975                char szNetwork[INTNET_MAX_NETWORK_NAME];
    39693976                RTStrPrintf(szNetwork, sizeof(szNetwork), "HostInterfaceNetworking-%s", pszHifName);
     
    41034110# if defined(RT_OS_SOLARIS)
    41044111#  if 0 /* bird: this is a bit questionable and might cause more trouble than its worth.  */
    4105             /* Zone access restriction, don't allow snooping the global zone. */
    4106             zoneid_t ZoneId = getzoneid();
    4107             if (ZoneId != GLOBAL_ZONEID)
    4108             {
    4109                 InsertConfigInteger(pCfg, "IgnoreAllPromisc", true);
    4110             }
     4112                /* Zone access restriction, don't allow snooping the global zone. */
     4113                zoneid_t ZoneId = getzoneid();
     4114                if (ZoneId != GLOBAL_ZONEID)
     4115                {
     4116                    InsertConfigInteger(pCfg, "IgnoreAllPromisc", true);
     4117                }
    41114118#  endif
    41124119# endif
     
    41374144                    InsertConfigString(pCfg, "Network", bstr);
    41384145                    InsertConfigInteger(pCfg, "TrunkType", kIntNetTrunkType_WhateverNone);
     4146                    InsertConfigString(pCfg, "IfPolicyPromisc", pszPromiscuousGuestPolicy);
    41394147                    networkName = bstr;
    41404148                    trunkType = Bstr(TRUNKTYPE_WHATEVER);
     
    42294237                    H();
    42304238                }
    4231 #define VBOX_WIN_BINDNAME_PREFIX "\\DEVICE\\"
     4239#  define VBOX_WIN_BINDNAME_PREFIX "\\DEVICE\\"
    42324240                char szTrunkName[INTNET_MAX_TRUNK_NAME];
    42334241                char *pszTrunkName = szTrunkName;
     
    42854293                InsertConfigString(pCfg, "Trunk", pszTrunk);
    42864294                InsertConfigString(pCfg, "Network", szNetwork);
    4287                 InsertConfigInteger(pCfg, "IgnoreConnectFailure", (uint64_t)fIgnoreConnectFailure);
     4295                InsertConfigInteger(pCfg, "IgnoreConnectFailure", (uint64_t)fIgnoreConnectFailure); /** @todo why is this windows only?? */
    42884296                networkName = Bstr(szNetwork);
    42894297                trunkName   = Bstr(pszTrunk);
     
    43054313                trunkType   = TRUNKTYPE_NETFLT;
    43064314#endif
     4315                InsertConfigString(pCfg, "IfPolicyPromisc", pszPromiscuousGuestPolicy);
     4316
    43074317#if !defined(RT_OS_WINDOWS) && defined(VBOX_WITH_NETFLT)
    43084318
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