IPv6 scope ID of zero is not valid
IANA reserves scope ID of 0x0 to mean "no scope ID", so make sure that we don't try to set it when reading from the sockaddr_in6 structure. Change-Id: I71b207e6f8262ab2bf9fde993288a71ba63c7572 Reviewed-by: Richard J. Moore <rich@kde.org>bb10
parent
1a4ff6f122
commit
385692b3ad
|
|
@ -111,13 +111,15 @@ static inline void qt_socket_getPortAndAddress(const qt_sockaddr *s, quint16 *po
|
|||
QHostAddress tmpAddress;
|
||||
tmpAddress.setAddress(tmp);
|
||||
*addr = tmpAddress;
|
||||
if (s->a6.sin6_scope_id) {
|
||||
#ifndef QT_NO_IPV6IFNAME
|
||||
char scopeid[IFNAMSIZ];
|
||||
if (::if_indextoname(s->a6.sin6_scope_id, scopeid)) {
|
||||
addr->setScopeId(QLatin1String(scopeid));
|
||||
} else
|
||||
char scopeid[IFNAMSIZ];
|
||||
if (::if_indextoname(s->a6.sin6_scope_id, scopeid)) {
|
||||
addr->setScopeId(QLatin1String(scopeid));
|
||||
} else
|
||||
#endif
|
||||
addr->setScopeId(QString::number(s->a6.sin6_scope_id));
|
||||
addr->setScopeId(QString::number(s->a6.sin6_scope_id));
|
||||
}
|
||||
}
|
||||
if (port)
|
||||
*port = ntohs(s->a6.sin6_port);
|
||||
|
|
|
|||
|
|
@ -182,7 +182,8 @@ static inline void qt_socket_getPortAndAddress(SOCKET socketDescriptor, const qt
|
|||
if (address) {
|
||||
QHostAddress a;
|
||||
a.setAddress(tmp);
|
||||
a.setScopeId(QString::number(sa6->sin6_scope_id));
|
||||
if (sa6->sin6_scope_id)
|
||||
a.setScopeId(QString::number(sa6->sin6_scope_id));
|
||||
*address = a;
|
||||
}
|
||||
if (port)
|
||||
|
|
|
|||
Loading…
Reference in New Issue