summaryrefslogtreecommitdiffstats
path: root/src/network/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'src/network/kernel')
-rw-r--r--src/network/kernel/qnetworkinterface_unix.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/network/kernel/qnetworkinterface_unix.cpp b/src/network/kernel/qnetworkinterface_unix.cpp
index 5b34b99caa..b1e351a289 100644
--- a/src/network/kernel/qnetworkinterface_unix.cpp
+++ b/src/network/kernel/qnetworkinterface_unix.cpp
@@ -111,7 +111,11 @@ uint QNetworkInterfaceManager::interfaceIndexFromName(const QString &name)
uint id = 0;
if (qt_safe_ioctl(socket, SIOCGIFINDEX, &req) >= 0)
+# if QT_CONFIG(ifr_index)
+ id = req.ifr_index;
+# else
id = req.ifr_ifindex;
+# endif
qt_safe_close(socket);
return id;
#else
@@ -130,7 +134,11 @@ QString QNetworkInterfaceManager::interfaceNameFromIndex(uint index)
int socket = qt_safe_socket(AF_INET, SOCK_STREAM, 0);
if (socket >= 0) {
memset(&req, 0, sizeof(ifreq));
+# if QT_CONFIG(ifr_index)
+ req.ifr_index = index;
+# else
req.ifr_ifindex = index;
+# endif
if (qt_safe_ioctl(socket, SIOCGIFNAME, &req) >= 0) {
qt_safe_close(socket);
@@ -216,7 +224,7 @@ static QNetworkInterfacePrivate *findInterface(int socket, QList<QNetworkInterfa
// Get the interface index
# ifdef SIOCGIFINDEX
if (qt_safe_ioctl(socket, SIOCGIFINDEX, &req) >= 0)
-# if defined(Q_OS_HAIKU)
+# if QT_CONFIG(ifr_index)
ifindex = req.ifr_index;
# else
ifindex = req.ifr_ifindex;