summaryrefslogtreecommitdiff
path: root/src/VBox/Main/src-server/darwin/NetIf-darwin.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/VBox/Main/src-server/darwin/NetIf-darwin.cpp')
-rw-r--r--src/VBox/Main/src-server/darwin/NetIf-darwin.cpp23
1 files changed, 18 insertions, 5 deletions
diff --git a/src/VBox/Main/src-server/darwin/NetIf-darwin.cpp b/src/VBox/Main/src-server/darwin/NetIf-darwin.cpp
index 99cf52e2..cfde818e 100644
--- a/src/VBox/Main/src-server/darwin/NetIf-darwin.cpp
+++ b/src/VBox/Main/src-server/darwin/NetIf-darwin.cpp
@@ -4,7 +4,7 @@
*/
/*
- * Copyright (C) 2008 Oracle Corporation
+ * Copyright (C) 2008-2011 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
@@ -85,7 +85,7 @@ int NetIfList(std::list <ComObjPtr<HostNetworkInterface> > &list)
memcpy(pNew->szName, pEtherNICs->szName, cbNameLen);
struct ifreq IfReq;
- strcpy(IfReq.ifr_name, pNew->szShortName);
+ RTStrCopy(IfReq.ifr_name, sizeof(IfReq.ifr_name), pNew->szShortName);
if (ioctl(sock, SIOCGIFFLAGS, &IfReq) < 0)
{
Log(("NetIfList: ioctl(SIOCGIFFLAGS) -> %d\n", errno));
@@ -391,7 +391,7 @@ int NetIfList(std::list <ComObjPtr<HostNetworkInterface> > &list)
if (pSdl->sdl_type == IFT_ETHER)
{
struct ifreq IfReq;
- strcpy(IfReq.ifr_name, pNew->szShortName);
+ RTStrCopy(IfReq.ifr_name, sizeof(IfReq.ifr_name), pNew->szShortName);
if (ioctl(sock, SIOCGIFFLAGS, &IfReq) < 0)
{
Log(("NetIfList: ioctl(SIOCGIFFLAGS) -> %d\n", errno));
@@ -401,7 +401,7 @@ int NetIfList(std::list <ComObjPtr<HostNetworkInterface> > &list)
pNew->enmStatus = (IfReq.ifr_flags & IFF_UP) ? NETIF_S_UP : NETIF_S_DOWN;
HostNetworkInterfaceType_T enmType;
- if (strncmp("vboxnet", pNew->szName, 7))
+ if (strncmp(pNew->szName, RT_STR_TUPLE("vboxnet")))
enmType = HostNetworkInterfaceType_Bridged;
else
enmType = HostNetworkInterfaceType_HostOnly;
@@ -511,7 +511,7 @@ int NetIfGetConfigByName(PNETIFINFO pInfo)
pInfo->Uuid = uuid;
struct ifreq IfReq;
- strcpy(IfReq.ifr_name, pInfo->szShortName);
+ RTStrCopy(IfReq.ifr_name, sizeof(IfReq.ifr_name), pInfo->szShortName);
if (ioctl(sock, SIOCGIFFLAGS, &IfReq) < 0)
{
Log(("NetIfList: ioctl(SIOCGIFFLAGS) -> %d\n", errno));
@@ -528,4 +528,17 @@ int NetIfGetConfigByName(PNETIFINFO pInfo)
return rc;
}
+/**
+ * Retrieve the physical link speed in megabits per second. If the interface is
+ * not up or otherwise unavailable the zero speed is returned.
+ *
+ * @returns VBox status code.
+ *
+ * @param pcszIfName Interface name.
+ * @param puMbits Where to store the link speed.
+ */
+int NetIfGetLinkSpeed(const char * /*pcszIfName*/, uint32_t * /*puMbits*/)
+{
+ return VERR_NOT_IMPLEMENTED;
+}
#endif