VirtualBox

Changeset 64166 in vbox for trunk/src/VBox/Main


Ignore:
Timestamp:
Oct 6, 2016 2:11:46 PM (8 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
111147
Message:

NAT: Don't use user supplied port-forwarding rule names as node names
in CFGM. Instead move all rules under new .../Config/PortForwarding/
node, use (transient) rule index as the node name and put the rule
name into the "Name" leaf value. Note that this is a private
interface between components, so nothing else should be affected by
this layout change.

Location:
trunk/src/VBox/Main
Files:
2 edited

Legend:

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

    r64155 r64166  
    49674967                SafeArray<BSTR> pfs;
    49684968                hrc = natEngine->COMGETTER(Redirects)(ComSafeArrayAsOutParam(pfs));         H();
    4969                 PCFGMNODE pPF = NULL;          /* /Devices/Dev/.../Config/PF#0/ */
     4969
     4970                PCFGMNODE pPFTree = NULL;
     4971                if (pfs.size() > 0)
     4972                    InsertConfigNode(pCfg, "PortForwarding", &pPFTree);
     4973
    49704974                for (unsigned int i = 0; i < pfs.size(); ++i)
    49714975                {
     4976                    PCFGMNODE pPF = NULL; /* /Devices/Dev/.../Config/PortForwarding/$n/ */
     4977
    49724978                    uint16_t port = 0;
    49734979                    BSTR r = pfs[i];
     
    50185024                        continue;
    50195025
    5020                     if (strName.isEmpty())
    5021                         VMSetError(VMR3GetVM(mpUVM), VERR_CFGM_NO_NODE, RT_SRC_POS,
    5022                                    N_("NAT redirection rule without a name"));
    5023 
    5024                     InsertConfigNode(pCfg, strName.c_str(), &pPF);
     5026                    InsertConfigNode(pPFTree, Utf8StrFmt("%u", i).c_str(), &pPF);
     5027
     5028                    if (!strName.isEmpty())
     5029                        InsertConfigString(pPF, "Name", strName);
     5030
    50255031                    InsertConfigString(pPF, "Protocol", strProto);
    50265032
  • trunk/src/VBox/Main/src-server/NATEngineImpl.cpp

    r64142 r64166  
    275275                                tr("Whitespace in NAT rule name"));
    276276
    277             if (   c == '/'  /* CFGM node path separator */
    278                 || c == ',') /* VBoxManage natpf<N> argument is csv */
     277            if (c == ',') /* we use csv in several places e.g. GetRedirects or natpf<N> argument */
    279278                return setError(E_INVALIDARG,
    280279                                tr("'%c' - invalid character in NAT rule name"), c);
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