VirtualBox

Ignore:
Timestamp:
Nov 20, 2018 11:41:35 AM (6 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
126789
Message:

Main/DHCPD: bugref:9288 Use new implementation of DHCP server (VCC 10 and GCC 4.4.4 support).

Location:
trunk/src/VBox/NetworkServices/Dhcpd
Files:
2 added
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/NetworkServices/Dhcpd/ClientId.h

    r75569 r75614  
    3535    ClientId()
    3636      : m_mac(), m_id() {}
    37     ClientId(const RTMAC &mac, const OptClientId &id)
    38       : m_mac(mac), m_id(id) {}
     37    ClientId(const RTMAC &macParam, const OptClientId &idParam)
     38      : m_mac(macParam), m_id(idParam) {}
    3939
    4040    const RTMAC &mac() const { return m_mac; }
  • trunk/src/VBox/NetworkServices/Dhcpd/Config.cpp

    r75569 r75614  
    589589    /** @todo r=bird: Visual C++ 2010 does not grok this use of 'auto'. */
    590590    // XXX: debug
    591     for (auto it: m_GlobalOptions) {
    592         std::shared_ptr<DhcpOption> opt(it.second);
     591    for (optmap_t::const_iterator it = m_GlobalOptions.begin(); it != m_GlobalOptions.end(); ++it) {
     592        std::shared_ptr<DhcpOption> opt(it->second);
    593593
    594594        octets_t data;
     
    596596
    597597        bool space = false;
    598         for (auto c: data) {
     598        for (octets_t::const_iterator itData = data.begin(); itData != data.end(); ++itData) {
     599            uint8_t c = *itData;
    599600            if (space)
    600601                std::cout << " ";
     
    854855    optmap << new OptSubnetMask(m_IPv4Netmask);
    855856
    856     for (auto optreq: reqOpts.value())
    857     {
     857    const OptParameterRequest::value_t& reqValue = reqOpts.value();
     858    for (octets_t::const_iterator itOptReq = reqValue.begin(); itOptReq != reqValue.end(); ++itOptReq)
     859    {
     860        uint8_t optreq = *itOptReq;
    858861        std::cout << ">>> requested option " << (int)optreq << std::endl;
    859862
     
    890893    if (vmopts != NULL)
    891894    {
    892         for (auto it: *vmopts) {
    893             std::shared_ptr<DhcpOption> opt(it.second);
     895        for (optmap_t::const_iterator it = vmopts->begin(); it != vmopts->end(); ++it) {
     896            std::shared_ptr<DhcpOption> opt(it->second);
    894897            if (optmap.count(opt->optcode()) == 0 && opt->optcode() > 127)
    895898            {
     
    900903    }
    901904
    902     for (auto it: m_GlobalOptions) {
    903         std::shared_ptr<DhcpOption> opt(it.second);
     905    for (optmap_t::const_iterator it = m_GlobalOptions.begin(); it != m_GlobalOptions.end(); ++it) {
     906        std::shared_ptr<DhcpOption> opt(it->second);
    904907        if (optmap.count(opt->optcode()) == 0 && opt->optcode() > 127)
    905908        {
  • trunk/src/VBox/NetworkServices/Dhcpd/Db.h

    r75569 r75614  
    5151    Binding(const Binding &);
    5252
    53     explicit Binding(RTNETADDRIPV4 addr)
    54       : m_addr(addr), m_state(FREE),
     53    explicit Binding(RTNETADDRIPV4 addrParam)
     54      : m_addr(addrParam), m_state(FREE),
    5555        m_issued(), m_secLease() {}
    5656
    57     Binding(RTNETADDRIPV4 addr, const ClientId &id)
    58       : m_addr(addr), m_state(FREE), m_id(id),
     57    Binding(RTNETADDRIPV4 addrParam, const ClientId &idParam)
     58      : m_addr(addrParam), m_state(FREE), m_id(idParam),
    5959        m_issued(), m_secLease() {}
    6060
     
    7070    TimeStamp issued() const { return m_issued; }
    7171
    72     Binding &setState(State state)
     72    Binding &setState(State stateParam)
    7373    {
    74         m_state = state;
     74        m_state = stateParam;
    7575        return *this;
    7676    }
     
    8585    }
    8686
    87     Binding &giveTo(const ClientId &id)
     87    Binding &giveTo(const ClientId &idParam)
    8888    {
    89         m_id = id;
     89        m_id = idParam;
    9090        m_state = FREE;
    9191        return *this;
  • trunk/src/VBox/NetworkServices/Dhcpd/Defs.h

    r75569 r75614  
    2424
    2525#include <map>
     26#include <vector>
     27
     28#if __cplusplus >= 199711
    2629#include <memory>
    27 #include <vector>
     30using std::shared_ptr;
     31#else
     32#include <tr1/memory>
     33using std::tr1::shared_ptr;
     34#endif
     35
     36#ifdef _MSC_VER
     37# define __func__ __FUNCTION__
     38#endif
    2839
    2940typedef std::vector<uint8_t> octets_t;
     
    3243
    3344class DhcpOption;
    34 typedef std::map<uint8_t, std::shared_ptr<DhcpOption>> optmap_t;
     45typedef std::map<uint8_t, std::shared_ptr<DhcpOption> > optmap_t;
    3546
    3647inline bool operator==(const RTMAC &l, const RTMAC &r)
  • trunk/src/VBox/NetworkServices/Dhcpd/DhcpMessage.cpp

    r75569 r75614  
    323323
    324324DhcpServerMessage::DhcpServerMessage(const DhcpClientMessage &req,
    325                                      uint8_t messageType, RTNETADDRIPV4 serverAddr)
     325                                     uint8_t messageTypeParam, RTNETADDRIPV4 serverAddr)
    326326  : DhcpMessage(),
    327327    m_optServerId(serverAddr)
     
    329329    m_dst.u = 0xffffffff;       /* broadcast */
    330330
    331     m_optMessageType = OptMessageType(messageType);
     331    m_optMessageType = OptMessageType(messageTypeParam);
    332332
    333333    /* copy values from the request (cf. RFC2131 Table 3) */
  • trunk/src/VBox/NetworkServices/Dhcpd/DhcpOptions.cpp

    r75569 r75614  
    3636optmap_t &operator<<(optmap_t &optmap, const std::shared_ptr<DhcpOption> &option)
    3737{
    38     if (option == NULL)
     38    if (!option)
    3939        return optmap;
    4040
  • trunk/src/VBox/NetworkServices/Dhcpd/DhcpOptions.h

    r71703 r75614  
    342342    static OptValue *parse(const char *pcszValue)
    343343    {
    344         value_t v;
     344        typename OptValueBase<T>::value_t v;
    345345        int rc = DhcpOption::parse1(v, pcszValue);
    346346        if (RT_FAILURE(rc))
     
    544544    static OptList *parse(const char *pcszValue)
    545545    {
    546         value_t v;
     546        typename OptListBase<T>::value_t v;
    547547        int rc = DhcpOption::parseList(v, pcszValue);
    548548        if (RT_FAILURE(rc) || v.empty())
  • trunk/src/VBox/NetworkServices/Dhcpd/Makefile.kmk

    r75569 r75614  
    2929 ifdef VBOX_WITH_HARDENING
    3030  PROGRAMS += VBoxNetDhcpdHardened
    31   VBoxNetDhcpdHardened_TEMPLATE = VBOXR3HARDENEDEXE
    32   VBoxNetDhcpdHardened_NAME     = VBoxNetDhcpd
    33   VBoxNetDhcpdHardened_DEFS     = SERVICE_NAME=\"VBoxNetDhcpd\"
    34   VBoxNetDhcpdHardened_SOURCES  = VBoxNetDhcpdHardened.cpp
    35   VBoxNetDhcpdHardened_SOURCES.win = $(VBoxNetLwipNAT_0_OUTDIR)/VBoxNetDhcpd-icon.rc
    36   VBoxNetDhcpdHardened_LDFLAGS.win = /SUBSYSTEM:windows
     31  DLLS += VBoxNetDhcpd
    3732 else
    3833  PROGRAMS += VBoxNetDhcpd
    3934 endif
    4035
    41  VBoxNetDhcpd_TEMPLATE := $(if-expr defined(VBOX_WITH_HARDENING),VBOXMAINDLL,VBOXMAINCLIENTEXE)
    42  VBoxNetDhcpd_NAME     := VBoxNetDhcpd
     36 VBoxNetDhcpdHardened_TEMPLATE = VBOXR3HARDENEDEXE
     37 VBoxNetDhcpdHardened_NAME     = VBoxNetDHCP
     38 VBoxNetDhcpdHardened_DEFS     = SERVICE_NAME=\"VBoxNetDhcpd\"
     39 VBoxNetDhcpdHardened_SOURCES  = VBoxNetDhcpdHardened.cpp
     40 VBoxNetDhcpdHardened_SOURCES.win = $(VBoxNetDhcpd_0_OUTDIR)/VBoxNetDhcpd-icon.rc
     41 VBoxNetDhcpdHardened_LDFLAGS.win = /SUBSYSTEM:windows
     42
     43 VBoxNetDhcpd_TEMPLATE := $(if-expr defined(VBOX_WITH_HARDENING),VBoxR3Dll,VBOXR3EXE)
     44 VBoxNetDhcpd_NAME      = VBoxNetDHCP
    4345 # VBoxNetDhcpd_DEFS      = IPv6
    44  # VBoxNetLwipNAT_DEFS.linux = WITH_VALGRIND
    45  VBoxNetDhcpd_DEFS.win  = VBOX_COM_OUTOFPROC_MODULE _WIN32_WINNT=0x501 # Windows XP
     46 # VBoxNetDhcpd_DEFS.linux = WITH_VALGRIND
     47 #VBoxNetDhcpd_DEFS.win  = VBOX_COM_OUTOFPROC_MODULE _WIN32_WINNT=0x501 # Windows XP
    4648
    4749 # (current dir is for for lwipopts.h)
    4850 VBoxNetDhcpd_INCS += . $(addprefix ../../Devices/Network/lwip-new/,$(LWIP_INCS))
    4951
    50  VBoxNetDhcpd_SOURCES  =
    51  VBoxNetDhcpd_SOURCES += ClientId.cpp
    52  VBoxNetDhcpd_SOURCES += Config.cpp
    53  VBoxNetDhcpd_SOURCES += DHCPD.cpp
    54  VBoxNetDhcpd_SOURCES += Db.cpp
    55  VBoxNetDhcpd_SOURCES += DhcpMessage.cpp
    56  VBoxNetDhcpd_SOURCES += DhcpOptions.cpp
    57  VBoxNetDhcpd_SOURCES += IPv4Pool.cpp
    58  VBoxNetDhcpd_SOURCES += TimeStamp.cpp
    59  VBoxNetDhcpd_SOURCES += VBoxNetDhcpd.cpp
    60  VBoxNetDhcpd_SOURCES += $(addprefix ../../Devices/Network/lwip-new/,$(LWIP_SOURCES))
     52 VBoxNetDhcpd_DEFS    = KBUILD_TYPE=\"$(KBUILD_TYPE)\"
     53 ifneq ($(KBUILD_TARGET),win)
     54  VBoxNetDhcpd_DEFS     += VBOX_WITH_XPCOM
     55  VBoxNetDhcpd_INCS     += $(VBOX_XPCOM_INCS)
     56  # We want -std=c++11 for 4.7 and newer compilers, and -std=c++0x for older ones.
     57  VBoxNetDhcpd_CXXFLAGS += -std=$(if $(VBOX_GCC_VERSION_CXX),$(if $(VBOX_GCC_VERSION_CXX) < 40700,c++0x,c++11),c++0x)
     58 endif
     59 VBoxNetDhcpd_SOURCES = ../../Main/glue/VBoxLogRelCreate.cpp \
     60                        ../../Main/glue/GetVBoxUserHomeDirectory.cpp \
     61                        ClientId.cpp \
     62                        Config.cpp \
     63                        DHCPD.cpp \
     64                        Db.cpp \
     65                        DhcpMessage.cpp \
     66                        DhcpOptions.cpp \
     67                        IPv4Pool.cpp \
     68                        TimeStamp.cpp \
     69                        VBoxNetDhcpd.cpp \
     70                        $(addprefix ../../Devices/Network/lwip-new/,$(LWIP_SOURCES))
    6171
    62  VBoxNetLwipNAT_LIBS = $(LIB_RUNTIME)
     72 VBoxNetDhcpd_LIBS = $(LIB_RUNTIME)
    6373
    64  VBoxNetLwipNAT_LIBS.solaris += socket nsl
    65  VBoxNetLwipNAT_LDFLAGS.win = /SUBSYSTEM:windows
     74 VBoxNetDhcpd_LIBS.solaris += socket nsl
     75 VBoxNetDhcpd_LDFLAGS.win = /SUBSYSTEM:windows
    6676
    6777 ifeq ($(KBUILD_TARGET),win)
  • trunk/src/VBox/NetworkServices/Dhcpd/VBoxNetDhcpd.cpp

    r75569 r75614  
    448448                                                     i, cSegs,
    449449                                                     &cbSegFrame);
    450                 ifInput(pvSegFrame, cbFrame);
     450                ifInput(pvSegFrame, (uint32_t)cbFrame);
    451451            }
    452452        }
     
    738738
    739739    unique_ptr_pbuf q ( pbuf_alloc(PBUF_RAW, (u16_t)data.size(), PBUF_RAM) );
    740     if (q == NULL)
    741         return;
    742 
    743     error = pbuf_take(q.get(), &data.front(), data.size());
     740    if (!q)
     741        return;
     742
     743    error = pbuf_take(q.get(), &data.front(), (u16_t)data.size());
    744744    if (error != ERR_OK)
    745745        return;
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