VBoxNetDHCP.cpp revision 8de446465b0fe681ff32488983e3e08df04743d6
31734da27b3f913bfb1da241a2e2571f33ab4629Mark de Reeper * VBoxNetDHCP - DHCP Service for connecting to IntNet.
31734da27b3f913bfb1da241a2e2571f33ab4629Mark de Reeper * Copyright (C) 2009 Sun Microsystems, Inc.
31734da27b3f913bfb1da241a2e2571f33ab4629Mark de Reeper * This file is part of VirtualBox Open Source Edition (OSE), as
31734da27b3f913bfb1da241a2e2571f33ab4629Mark de Reeper * available from http://www.virtualbox.org. This file is free software;
31734da27b3f913bfb1da241a2e2571f33ab4629Mark de Reeper * you can redistribute it and/or modify it under the terms of the GNU
31734da27b3f913bfb1da241a2e2571f33ab4629Mark de Reeper * General Public License (GPL) as published by the Free Software
31734da27b3f913bfb1da241a2e2571f33ab4629Mark de Reeper * Foundation, in version 2 as it comes in the "COPYING" file of the
31734da27b3f913bfb1da241a2e2571f33ab4629Mark de Reeper * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
31734da27b3f913bfb1da241a2e2571f33ab4629Mark de Reeper * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
31734da27b3f913bfb1da241a2e2571f33ab4629Mark de Reeper * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
31734da27b3f913bfb1da241a2e2571f33ab4629Mark de Reeper * Clara, CA 95054 USA or visit http://www.sun.com if you need
31734da27b3f913bfb1da241a2e2571f33ab4629Mark de Reeper * additional information or have any questions.
31734da27b3f913bfb1da241a2e2571f33ab4629Mark de Reeper/** @page pg_net_dhcp VBoxNetDHCP
31734da27b3f913bfb1da241a2e2571f33ab4629Mark de Reeper * Write a few words...
31734da27b3f913bfb1da241a2e2571f33ab4629Mark de Reeper/*******************************************************************************
31734da27b3f913bfb1da241a2e2571f33ab4629Mark de Reeper* Header Files *
31734da27b3f913bfb1da241a2e2571f33ab4629Mark de Reeper*******************************************************************************/
31734da27b3f913bfb1da241a2e2571f33ab4629Mark de Reeper/*******************************************************************************
31734da27b3f913bfb1da241a2e2571f33ab4629Mark de Reeper* Structures and Typedefs *
31734da27b3f913bfb1da241a2e2571f33ab4629Mark de Reeper*******************************************************************************/
31734da27b3f913bfb1da241a2e2571f33ab4629Mark de Reeper * DHCP configuration item.
31734da27b3f913bfb1da241a2e2571f33ab4629Mark de Reeper * This is all public data because I'm too lazy to do it propertly right now.
31734da27b3f913bfb1da241a2e2571f33ab4629Mark de Reeper /** The etheret addresses this matches config applies to.
int validate(void)
class VBoxNetDhcpLease
class VBoxNetDhcp
VBoxNetDhcp();
virtual ~VBoxNetDhcp();
int tryGoOnline(void);
int run(void);
m_cVerbosity = 0;
m_cbCurMsg = 0;
if (m_pSession)
int rc = 0;
if (pCfg)
if (!rc)
delete pCfg;
return rc;
if (!rc)
switch (rc)
m_cVerbosity++;
if (rc)
if (!pCurCfg)
if (!pCurCfg)
switch (rc)
rc = 0;
return rc;
RTStrmPrintf(g_pStdErr, "VBoxNetDHCP: SUPCallVMMR0Ex(,VMMR0_DO_INTNET_IF_SET_PROMISCUOUS_MODE,) failed, rc=%Rrc\n", rc);
RTStrmPrintf(g_pStdErr, "VBoxNetDHCP: SUPCallVMMR0Ex(,VMMR0_DO_INTNET_IF_GET_RING3_BUFFER,) failed, rc=%Rrc\n", rc);
RTStrmPrintf(g_pStdErr, "VBoxNetDHCP: SUPCallVMMR0Ex(,VMMR0_DO_INTNET_OPEN,) failed, rc=%Rrc\n", rc);
WaitReq.cMillies = 2000; /* 2 secs - the sleep is for some reason uninterruptible... */ /** @todo fix interruptability in SrvIntNet! */
m_cbCurMsg = 0;
RTStrmPrintf(g_pStdErr, "VBoxNetDHCP: %s: %N\n", iMinLevel >= 2 ? "debug" : "info", pszFmt, &vaCopy);
if ( fMsg
&& m_pCurMsg)
RTStrmPrintf(g_pStdErr, "VBoxNetDHCP: debug: %8s chaddr=%.6Rhxs ciaddr=%d.%d.%d.%d yiaddr=%d.%d.%d.%d siaddr=%d.%d.%d.%d\n",
m_pCurMsg->bp_ciaddr.au8[0], m_pCurMsg->bp_ciaddr.au8[1], m_pCurMsg->bp_ciaddr.au8[2], m_pCurMsg->bp_ciaddr.au8[3],
m_pCurMsg->bp_yiaddr.au8[0], m_pCurMsg->bp_yiaddr.au8[1], m_pCurMsg->bp_yiaddr.au8[2], m_pCurMsg->bp_yiaddr.au8[3],
m_pCurMsg->bp_siaddr.au8[0], m_pCurMsg->bp_siaddr.au8[1], m_pCurMsg->bp_siaddr.au8[2], m_pCurMsg->bp_siaddr.au8[3]);
switch (uMsgType)
if (!pDhcp)
if (rc)
return rc;
if (rc)
delete pDhcp;
return rc;
delete pDhcp;
return rc;
#ifndef VBOX_WITH_HARDENING