NetIf-generic.cpp revision 4a4d0b7611a832602800898d4ec5da6d588b535a
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync * VirtualBox Main - Generic NetIf implementation.
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync * Copyright (C) 2009-2012 Oracle Corporation
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync * available from http://www.virtualbox.org. This file is free software;
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync * you can redistribute it and/or modify it under the terms of the GNU
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync * General Public License (GPL) as published by the Free Software
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsyncstatic int NetIfAdpCtl(const char * pcszIfName, const char *pszAddr, const char *pszOption, const char *pszMask)
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync const char *args[] = { NULL, pcszIfName, pszAddr, pszOption, pszMask, NULL };
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync int rc = RTPathExecDir(szAdpCtl, sizeof(szAdpCtl) - sizeof("/" VBOXNETADPCTL_NAME));
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync LogRel(("NetIfAdpCtl: failed to get program path, rc=%Rrc.\n", rc));
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync LogRel(("NetIfAdpCtl: path %s does not exist. Failed to run " VBOXNETADPCTL_NAME " helper.\n",
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync rc = RTProcCreate(szAdpCtl, args, RTENV_DEFAULT, 0, &pid);
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync LogRel(("NetIfAdpCtl: failed to create process for %.\n",
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsyncstatic int NetIfAdpCtl(HostNetworkInterface * pIf, const char *pszAddr, const char *pszOption, const char *pszMask)
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync return NetIfAdpCtl(strName.c_str(), pszAddr, pszOption, pszMask);
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsyncint NetIfAdpCtlOut(const char * pcszName, const char * pcszCmd, char *pszBuffer, size_t cBufSize)
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync int rc = RTPathExecDir(szAdpCtl, sizeof(szAdpCtl) - sizeof("/" VBOXNETADPCTL_NAME " ") - strlen(pcszCmd));
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync LogRel(("NetIfAdpCtlOut: Failed to get program path, rc=%Rrc\n", rc));
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync if (pcszName && strlen(pcszName) <= RTPATH_MAX - strlen(szAdpCtl) - 1 - strlen(pcszCmd))
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync LogRel(("NetIfAdpCtlOut: Command line is too long: %s%s %s\n", szAdpCtl, pcszName, pcszCmd));
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync if (strlen(szAdpCtl) < RTPATH_MAX - sizeof(" 2>&1"))
a5e7ae69e440f6816420fc99599f044e79e716b6vboxsync if (!strncmp(VBOXNETADPCTL_NAME ":", pszBuffer, sizeof(VBOXNETADPCTL_NAME)))
return rc;
int NetIfEnableStaticIpConfig(VirtualBox * /* vBox */, HostNetworkInterface * pIf, ULONG aOldIp, ULONG aNewIp, ULONG aMask)
if (aNewIp == 0)
int NetIfEnableStaticIpConfigV6(VirtualBox * /* vBox */, HostNetworkInterface * pIf, IN_BSTR aOldIPV6Address, IN_BSTR aIPV6Address, ULONG aIPV6MaskPrefixLength)
return VERR_NOT_IMPLEMENTED;
const char *pcszName)
return rc;
if (fp)
*pLast = 0;
return E_FAIL;
if (!pInfo)
return hrc;
return VERR_NOT_IMPLEMENTED;
return VERR_INVALID_PARAMETER;
return VERR_INTERNAL_ERROR;
return rc;
return VERR_NOT_IMPLEMENTED;
return VERR_NOT_IMPLEMENTED;
return VERR_NOT_IMPLEMENTED;
if (sock < 0)
return VERR_OUT_OF_RESOURCES;
return VINF_SUCCESS;