mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 21:43:03 +02:00
send the mac address with domain-server check in
This commit is contained in:
parent
36d8e6d64d
commit
47f82a8046
5 changed files with 30 additions and 2 deletions
|
@ -29,6 +29,9 @@ NodeConnectionData NodeConnectionData::fromDataStream(QDataStream& dataStream, c
|
||||||
|
|
||||||
// NOTE: QDataStream::readBytes() - The buffer is allocated using new []. Destroy it with the delete [] operator.
|
// NOTE: QDataStream::readBytes() - The buffer is allocated using new []. Destroy it with the delete [] operator.
|
||||||
delete[] rawBytes;
|
delete[] rawBytes;
|
||||||
|
|
||||||
|
// read the hardware address sent by the client
|
||||||
|
dataStream >> newHeader.hardwareAddress;
|
||||||
}
|
}
|
||||||
|
|
||||||
dataStream >> newHeader.nodeType
|
dataStream >> newHeader.nodeType
|
||||||
|
|
|
@ -28,6 +28,7 @@ public:
|
||||||
HifiSockAddr senderSockAddr;
|
HifiSockAddr senderSockAddr;
|
||||||
QList<NodeType_t> interestList;
|
QList<NodeType_t> interestList;
|
||||||
QString placeName;
|
QString placeName;
|
||||||
|
QString hardwareAddress;
|
||||||
|
|
||||||
QByteArray protocolVersion;
|
QByteArray protocolVersion;
|
||||||
};
|
};
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
#include <QtCore/QUrl>
|
#include <QtCore/QUrl>
|
||||||
#include <QtCore/QThread>
|
#include <QtCore/QThread>
|
||||||
#include <QtNetwork/QHostInfo>
|
#include <QtNetwork/QHostInfo>
|
||||||
|
#include <QtNetwork/QNetworkInterface>
|
||||||
|
|
||||||
#include <LogHandler.h>
|
#include <LogHandler.h>
|
||||||
#include <UUID.h>
|
#include <UUID.h>
|
||||||
|
@ -346,6 +347,28 @@ void NodeList::sendDomainServerCheckIn() {
|
||||||
// include the protocol version signature in our connect request
|
// include the protocol version signature in our connect request
|
||||||
QByteArray protocolVersionSig = protocolVersionsSignature();
|
QByteArray protocolVersionSig = protocolVersionsSignature();
|
||||||
packetStream.writeBytes(protocolVersionSig.constData(), protocolVersionSig.size());
|
packetStream.writeBytes(protocolVersionSig.constData(), protocolVersionSig.size());
|
||||||
|
|
||||||
|
// if possible, include the MAC address for the current interface in our connect request
|
||||||
|
QString hardwareAddress;
|
||||||
|
|
||||||
|
for (auto networkInterface : QNetworkInterface::allInterfaces()) {
|
||||||
|
for (auto interfaceAddress : networkInterface.addressEntries()) {
|
||||||
|
if (interfaceAddress.ip() == _localSockAddr.getAddress()) {
|
||||||
|
// this is the interface whose local IP matches what we've detected the current IP to be
|
||||||
|
hardwareAddress = networkInterface.hardwareAddress();
|
||||||
|
|
||||||
|
// stop checking interfaces and addresses
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// stop looping if this was the current interface
|
||||||
|
if (!hardwareAddress.isEmpty()) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
packetStream << hardwareAddress;
|
||||||
}
|
}
|
||||||
|
|
||||||
// pack our data to send to the domain-server including
|
// pack our data to send to the domain-server including
|
||||||
|
|
|
@ -67,7 +67,7 @@ PacketVersion versionForPacketType(PacketType packetType) {
|
||||||
return static_cast<PacketVersion>(DomainConnectionDeniedVersion::IncludesExtraInfo);
|
return static_cast<PacketVersion>(DomainConnectionDeniedVersion::IncludesExtraInfo);
|
||||||
|
|
||||||
case PacketType::DomainConnectRequest:
|
case PacketType::DomainConnectRequest:
|
||||||
return static_cast<PacketVersion>(DomainConnectRequestVersion::HasProtocolVersions);
|
return static_cast<PacketVersion>(DomainConnectRequestVersion::HasMACAddress);
|
||||||
|
|
||||||
case PacketType::DomainServerAddedNode:
|
case PacketType::DomainServerAddedNode:
|
||||||
return static_cast<PacketVersion>(DomainServerAddedNodeVersion::PermissionsGrid);
|
return static_cast<PacketVersion>(DomainServerAddedNodeVersion::PermissionsGrid);
|
||||||
|
|
|
@ -207,7 +207,8 @@ enum class AvatarMixerPacketVersion : PacketVersion {
|
||||||
enum class DomainConnectRequestVersion : PacketVersion {
|
enum class DomainConnectRequestVersion : PacketVersion {
|
||||||
NoHostname = 17,
|
NoHostname = 17,
|
||||||
HasHostname,
|
HasHostname,
|
||||||
HasProtocolVersions
|
HasProtocolVersions,
|
||||||
|
HasMACAddress
|
||||||
};
|
};
|
||||||
|
|
||||||
enum class DomainConnectionDeniedVersion : PacketVersion {
|
enum class DomainConnectionDeniedVersion : PacketVersion {
|
||||||
|
|
Loading…
Reference in a new issue