drop QT_NO_IPV6IFNAME config option

if_indextoname() and if_nametoindex() are POSIX.1-2001

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2024-03-30 10:01:31 +02:00
parent ed014f6145
commit 559671161a
3 changed files with 2 additions and 17 deletions

View file

@ -178,7 +178,6 @@
#cmakedefine QT_NO_IMAGEFORMAT_XPM
#cmakedefine QT_NO_IMAGE_HEURISTIC_MASK
#cmakedefine QT_NO_IPV6
#cmakedefine QT_NO_IPV6IFNAME
#cmakedefine QT_NO_LCDNUMBER
#cmakedefine QT_NO_LIBRARY
#cmakedefine QT_NO_LOCALSERVER

View file

@ -30,10 +30,7 @@
#include <sys/socket.h>
#include <arpa/inet.h>
#include <netinet/in.h>
#ifndef QT_NO_IPV6IFNAME
#include <net/if.h>
#endif
QT_BEGIN_NAMESPACE
@ -236,12 +233,10 @@ bool QHostAddress::setAddress(const struct sockaddr *sockaddr)
d->ipString = ntopbuffer;
d->scopeId.clear();
if (si6->sin6_scope_id) {
#ifndef QT_NO_IPV6IFNAME
QSTACKARRAY(char, indexofnamebuffer, IFNAMSIZ);
if (::if_indextoname(si6->sin6_scope_id, indexofnamebuffer)) {
d->scopeId = indexofnamebuffer;
}
#endif
if (d->scopeId.isEmpty()) {
d->scopeId = QByteArray::number(si6->sin6_scope_id);
}

View file

@ -37,10 +37,7 @@
#include <netinet/in.h>
#include <netinet/tcp.h>
#include <arpa/inet.h>
#ifndef QT_NO_IPV6IFNAME
#include <net/if.h>
#endif
#ifdef Q_OS_SOLARIS
# include <sys/filio.h> // FIONREAD
@ -292,11 +289,9 @@ bool QAbstractSocketEnginePrivate::nativeConnect(const QHostAddress &addr, quint
const QByteArray scopeid = addr.scopeId();
bool ok = false;
sockAddrIPv6.sin6_scope_id = scopeid.toInt(&ok);
#ifndef QT_NO_IPV6IFNAME
if (!ok) {
sockAddrIPv6.sin6_scope_id = ::if_nametoindex(scopeid.constData());
}
#endif
struct in6_addr inAddrIPv6;
::memset(&inAddrIPv6, 0, sizeof(inAddrIPv6));
inet_pton(AF_INET6, addrStr.constData(), &inAddrIPv6);
@ -404,11 +399,9 @@ bool QAbstractSocketEnginePrivate::nativeBind(const QHostAddress &address, quint
sockAddrIPv6.sin6_port = htons(port);
bool ok = false;
sockAddrIPv6.sin6_scope_id = scopeid.toInt(&ok);
#ifndef QT_NO_IPV6IFNAME
if (!ok) {
sockAddrIPv6.sin6_scope_id = ::if_nametoindex(scopeid.constData());
}
#endif
struct in6_addr inAddrIPv6;
::memset(&inAddrIPv6, 0, sizeof(inAddrIPv6));
inet_pton(AF_INET6, addrStr.constData(), &inAddrIPv6);
@ -811,11 +804,9 @@ qint64 QAbstractSocketEnginePrivate::nativeSendDatagram(const char *data, qint64
const QByteArray scopeid = host.scopeId();
bool ok = false;
sockAddrIPv6.sin6_scope_id = scopeid.toInt(&ok);
#ifndef QT_NO_IPV6IFNAME
if (!ok) {
sockAddrIPv6.sin6_scope_id = ::if_nametoindex(scopeid.constData());
}
#endif
sockAddrSize = sizeof(sockAddrIPv6);
sockAddrPtr = (struct sockaddr *)&sockAddrIPv6;
} else