mirror of
https://bitbucket.org/smil3y/katie.git
synced 2025-02-23 10:22:55 +00:00
do not assume the hardware address is IPv4 address in QNetworkInterfacePrivate::scan()
may or may not hold true in the future Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
9a5c6fe1e6
commit
3c0dd6b866
1 changed files with 1 additions and 11 deletions
|
@ -46,16 +46,6 @@
|
|||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
static QString makeHwAddress(const uchar *data)
|
||||
{
|
||||
QSTACKARRAY(char, snprintfbuf, 18);
|
||||
::snprintf(snprintfbuf, sizeof(snprintfbuf),
|
||||
"%02hX:%02hX:%02hX:%02hX:%02hX:%02hX",
|
||||
ushort(data[0]), ushort(data[1]), ushort(data[2]), ushort(data[3]), ushort(data[4]), ushort(data[5])
|
||||
);
|
||||
return QString::fromLatin1(snprintfbuf, sizeof(snprintfbuf) - 1);
|
||||
}
|
||||
|
||||
QList<QNetworkInterfacePrivate *> QNetworkInterfacePrivate::scan()
|
||||
{
|
||||
QList<QNetworkInterfacePrivate *> interfaces;
|
||||
|
@ -125,7 +115,7 @@ QList<QNetworkInterfacePrivate *> QNetworkInterfacePrivate::scan()
|
|||
::memcpy(req.ifr_name, ifiter->ifa_name, sizeof(req.ifr_name) - 1);
|
||||
// Get the HW address
|
||||
if (::ioctl(socket, SIOCGIFHWADDR, &req) >= 0) {
|
||||
iface->hardwareAddress = makeHwAddress((uchar *)req.ifr_addr.sa_data);
|
||||
iface->hardwareAddress = QHostAddress(&req.ifr_addr).toString(QHostAddress::RemoveScope);
|
||||
}
|
||||
}
|
||||
#endif // SIOCGIFHWADDR
|
||||
|
|
Loading…
Add table
Reference in a new issue