NetIfList-solaris.cpp revision b642fb1edcf7e8c0ddb37bed00c3960e9368e5e1
/* $Id$ */
/** @file
* Main - NetIfList, Solaris implementation.
*/
/*
* Copyright (C) 2008 Sun Microsystems, Inc.
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
* General Public License (GPL) as published by the Free Software
* Foundation, in version 2 as it comes in the "COPYING" file of the
* VirtualBox OSE distribution. VirtualBox OSE is distributed in the
* hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
* Clara, CA 95054 USA or visit http://www.sun.com if you need
* additional information or have any questions.
*/
/*******************************************************************************
* Header Files *
*******************************************************************************/
#define LOG_GROUP LOG_GROUP_MAIN
#include <list>
#include "Logging.h"
#include "HostNetworkInterfaceImpl.h"
#include "netif.h"
#ifdef VBOX_WITH_HOSTNETIF_API
#include <map>
#include <string>
#include <fcntl.h>
#include <unistd.h>
#include <stropts.h>
#include <errno.h>
#include <limits.h>
#include <stdio.h>
#ifdef VBOX_SOLARIS_NSL_RESOLVED
# include <libdevinfo.h>
#endif
#include "DynLoadLibSolaris.h"
{
std::list<ComObjPtr <HostNetworkInterface> > *pList = (std::list<ComObjPtr <HostNetworkInterface> > *)pvHostNetworkInterfaceList;
static NICMap SolarisNICMap;
if (SolarisNICMap.empty())
{
}
/*
* Try picking up description from our NIC map.
*/
char szNICInstance[128];
char szNICDesc[256];
if (Description != "")
else
/*
* Try to get IP V4 address and netmask as well as Ethernet address.
*/
if (Sock > 0)
{
{
/*
* We might fail if the interface has not been assigned an IP address.
* That doesn't matter; as long as it's plumbed we can pick it up.
* But, if it has not acquired an IP address we cannot obtain it's MAC
* address this way, so we just use all zeros there.
*/
{
}
}
{
}
{
}
}
/*
* Try to get IP V6 address and netmask.
*/
if (Sock > 0)
{
{
}
{
}
}
/*
* Construct UUID with interface name and the MAC address if available.
*/
RTUuidClear(&Uuid);
}
static boolean_t vboxSolarisAddLinkHostIface(const char *pszIface, void *pvHostNetworkInterfaceList)
{
/*
* Clip off the zone instance number from the interface name (if any).
*/
char szIfaceName[128];
if (pszColon)
*pszColon = '\0';
/*
* Get the instance number from the interface name, then clip it off.
*/
int cbInstance = 0;
for (int i = 0; i < cbIface - 1; i++)
{
if (!RT_C_IS_DIGIT(*pszEnd))
break;
cbInstance++;
pszEnd--;
}
/*
* Add the interface.
*/
/*
* Continue walking...
*/
return _B_FALSE;
}
static bool vboxSolarisSortNICList(const ComObjPtr <HostNetworkInterface> Iface1, const ComObjPtr <HostNetworkInterface> Iface2)
{
}
static bool vboxSolarisSameNIC(const ComObjPtr <HostNetworkInterface> Iface1, const ComObjPtr <HostNetworkInterface> Iface2)
{
}
# ifdef VBOX_SOLARIS_NSL_RESOLVED
static int vboxSolarisAddPhysHostIface(di_node_t Node, di_minor_t Minor, void *pvHostNetworkInterfaceList)
{
/*
* Skip aggregations.
*/
return DI_WALK_CONTINUE;
/*
* Skip softmacs.
*/
return DI_WALK_CONTINUE;
return DI_WALK_CONTINUE;
}
# endif /* VBOX_SOLARIS_NSL_RESOLVED */
{
# ifdef VBOX_SOLARIS_NSL_RESOLVED
/*
* Use libdevinfo for determining all physical interfaces.
*/
if (Root != DI_NODE_NIL)
{
}
/*
* Use libdlpi for determining all DLPI interfaces.
*/
if (VBoxSolarisLibDlpiFound())
# endif /* VBOX_SOLARIS_NSL_RESOLVED */
/*
* This gets only the list of all plumbed logical interfaces.
* This is needed for zones which cannot access the device tree
* and in this case we just let them use the list of plumbed interfaces
* on the zone.
*/
if (Sock > 0)
{
if (!rc)
{
if (!rc)
{
for (int i = 0; i < IfNum.lifn_count; i++)
{
/*
* Skip loopback interfaces.
*/
continue;
#if 0
if (rc >= 0)
{
// SIOCGLIFNETMASK
/*
* We might fail if the interface has not been assigned an IP address.
* That doesn't matter; as long as it's plumbed we can pick it up.
* But, if it has not acquired an IP address we cannot obtain it's MAC
* address this way, so we just use all zeros there.
*/
if (rc >= 0)
}
#endif
}
}
}
}
/*
* Weed out duplicates caused by dlpi_walk inconsistencies across Nevadas.
*/
return VINF_SUCCESS;
}
#else
{
return VERR_NOT_IMPLEMENTED;
}
#endif