VirtualBox

Changeset 17864 in vbox


Ignore:
Timestamp:
Mar 13, 2009 11:04:21 PM (16 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
44415
Message:

VBoxNetDHCP: A couple of more options for configuring the trunk.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/NetworkServices/DHCP/VBoxNetDHCP.cpp

    r17812 r17864  
    396396    std::string         m_Name;
    397397    std::string         m_Network;
     398    std::string         m_TrunkName;
     399    INTNETTRUNKTYPE     m_enmTrunkType;
    398400    RTMAC               m_MacAddress;
    399401    RTNETADDRIPV4       m_Ipv4Address;
     
    510512    m_Name                  = "VBoxNetDhcp";
    511513    m_Network               = "VBoxNetDhcp";
     514    m_TrunkName             = "";
     515    m_enmTrunkType          = kIntNetTrunkType_WhateverNone;
    512516    m_MacAddress.au8[0]     = 0x08;
    513517    m_MacAddress.au8[1]     = 0x00;
     
    689693        { "--name",           'N',   RTGETOPT_REQ_STRING },
    690694        { "--network",        'n',   RTGETOPT_REQ_STRING },
     695        { "--trunk-name",     't',   RTGETOPT_REQ_STRING },
     696        { "--trunk-type",     'T',   RTGETOPT_REQ_STRING },
    691697        { "--mac-address",    'a',   RTGETOPT_REQ_MACADDR },
    692698        { "--ip-address",     'i',   RTGETOPT_REQ_IPV4ADDR },
     
    722728            case 'n':
    723729                m_Network = Val.psz;
     730                break;
     731            case 't':
     732                m_TrunkName = Val.psz;
     733                break;
     734            case 'T':
     735                if (!strcmp(Val.psz, "whatever"))
     736                    m_enmTrunkType = kIntNetTrunkType_WhateverNone;
     737                else if (!strcmp(Val.psz, "netflt"))
     738                    m_enmTrunkType = kIntNetTrunkType_NetFlt;
     739                else if (!strcmp(Val.psz, "netadp"))
     740                    m_enmTrunkType = kIntNetTrunkType_NetAdp;
     741                else if (!strcmp(Val.psz, "srvnat"))
     742                    m_enmTrunkType = kIntNetTrunkType_SrvNat;
     743                else
     744                {
     745                    RTStrmPrintf(g_pStdErr, "Invalid trunk type '%s'\n", Val.psz);
     746                    return 1;
     747                }
    724748                break;
    725749            case 'a':
     
    794818                         "All rights reserved\n"
    795819                         "\n"
    796                          "Usage:\n"
    797                          "  TODO\n",
     820                         "Usage: VBoxNetDHCP <options>\n"
     821                         "\n"
     822                         "Options:\n"
    798823                         VBOX_VERSION_STRING);
     824                for (size_t i = 0; i < RT_ELEMENTS(s_aOptionDefs); i++)
     825                    RTPrintf("    -%c, %s\n", s_aOptionDefs[i].iShort, s_aOptionDefs[i].pszLong);
    799826                return 1;
    800827
     
    855882    OpenReq.pSession = m_pSession;
    856883    strncpy(OpenReq.szNetwork, m_Network.c_str(), sizeof(OpenReq.szNetwork));
    857     OpenReq.szTrunk[0] = '\0';
    858     OpenReq.enmTrunkType = kIntNetTrunkType_WhateverNone;
     884    OpenReq.szNetwork[sizeof(OpenReq.szNetwork) - 1] = '\0';
     885    strncpy(OpenReq.szTrunk, m_TrunkName.c_str(), sizeof(OpenReq.szTrunk));
     886    OpenReq.szTrunk[sizeof(OpenReq.szTrunk) - 1] = '\0';
     887    OpenReq.enmTrunkType = m_enmTrunkType;
    859888    OpenReq.fFlags = 0; /** @todo check this */
    860889    OpenReq.cbSend = m_cbSendBuf;
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