diff --git a/libnymea/network/arpsocket.cpp b/libnymea/network/arpsocket.cpp index ab1ef1bc..c90ac5d1 100644 --- a/libnymea/network/arpsocket.cpp +++ b/libnymea/network/arpsocket.cpp @@ -51,6 +51,7 @@ #include NYMEA_LOGGING_CATEGORY(dcArpSocket, "ArpSocket") +NYMEA_LOGGING_CATEGORY(dcArpSocketTraffic, "ArpSocketTraffic") #define ETHER_PROTOCOL_LEN 4 // Length of the IPv4 address #define ETHER_HEADER_LEN sizeof(struct ether_header) @@ -240,7 +241,7 @@ bool ArpSocket::openSocket() QHostAddress targetHostAddress = getHostAddressString(arpPacket->arp_tpa); uint16_t etherType = htons(etherHeader->ether_type); if (etherType != ETHERTYPE_ARP) { - qCWarning(dcArpSocket()) << "Received ARP socket data header with invalid type" << etherType; + qCWarning(dcArpSocketTraffic()) << "Received ARP socket data header with invalid type" << etherType; return; } @@ -257,27 +258,27 @@ bool ArpSocket::openSocket() return; } - qCDebug(dcArpSocket()) << "ARP response from" << senderMacAddress << senderHostAddress.toString() << "on" << networkInterface.name(); + qCDebug(dcArpSocketTraffic()) << "ARP response from" << senderMacAddress << senderHostAddress.toString() << "on" << networkInterface.name(); emit arpResponse(networkInterface, senderHostAddress, senderMacAddress.toLower()); break; } case ARPOP_RREQUEST: - //qCDebug(dcArpSocket()) << "RARP request from" << senderMacAddress << senderHostAddress.toString() << "-->" << targetMacAddress << targetHostAddress.toString(); + qCDebug(dcArpSocketTraffic()) << "RARP request from" << senderMacAddress << senderHostAddress.toString() << "-->" << targetMacAddress << targetHostAddress.toString(); break; case ARPOP_RREPLY: - //qCDebug(dcArpSocket()) << "PARP response from" << senderMacAddress << senderHostAddress.toString() << "-->" << targetMacAddress << targetHostAddress.toString(); + qCDebug(dcArpSocketTraffic()) << "PARP response from" << senderMacAddress << senderHostAddress.toString() << "-->" << targetMacAddress << targetHostAddress.toString(); break; case ARPOP_InREQUEST: - //qCDebug(dcArpSocket()) << "InARP request from" << senderMacAddress << senderHostAddress.toString() << "-->" << targetMacAddress << targetHostAddress.toString(); + qCDebug(dcArpSocketTraffic()) << "InARP request from" << senderMacAddress << senderHostAddress.toString() << "-->" << targetMacAddress << targetHostAddress.toString(); break; case ARPOP_InREPLY: - //qCDebug(dcArpSocket()) << "InARP response from" << senderMacAddress << senderHostAddress.toString() << "-->" << targetMacAddress << targetHostAddress.toString(); + qCDebug(dcArpSocketTraffic()) << "InARP response from" << senderMacAddress << senderHostAddress.toString() << "-->" << targetMacAddress << targetHostAddress.toString(); break; case ARPOP_NAK: - //qCDebug(dcArpSocket()) << "(ATM)ARP NAK from" << senderMacAddress << senderHostAddress.toString() << "-->" << targetMacAddress << targetHostAddress.toString(); + qCDebug(dcArpSocketTraffic()) << "(ATM)ARP NAK from" << senderMacAddress << senderHostAddress.toString() << "-->" << targetMacAddress << targetHostAddress.toString(); break; default: - qCWarning(dcArpSocket()) << "Received unhandled ARP operation code" << arpOperationCode << "from" << senderMacAddress << senderHostAddress.toString(); + qCWarning(dcArpSocketTraffic()) << "Received unhandled ARP operation code" << arpOperationCode << "from" << senderMacAddress << senderHostAddress.toString(); break; } } diff --git a/libnymea/network/networkdevicediscovery.cpp b/libnymea/network/networkdevicediscovery.cpp index f68749a5..cadf2be5 100644 --- a/libnymea/network/networkdevicediscovery.cpp +++ b/libnymea/network/networkdevicediscovery.cpp @@ -244,12 +244,11 @@ void NetworkDeviceDiscovery::updateOrAddNetworkDeviceArp(const QNetworkInterface void NetworkDeviceDiscovery::onArpResponseRceived(const QNetworkInterface &interface, const QHostAddress &address, const QString &macAddress) { if (!m_currentReply) { - qCDebug(dcNetworkDeviceDiscovery()) << "Received ARP reply but there is no discovery running."; + qCDebug(dcNetworkDeviceDiscovery()) << "Received ARP reply from" << address.toString() << macAddress << "but there is no discovery running."; return; } qCDebug(dcNetworkDeviceDiscovery()) << "ARP reply received" << address.toString() << macAddress << interface.name(); - // Lookup the mac address vendor if possible if (m_macAddressDatabase->available()) { MacAddressDatabaseReply *reply = m_macAddressDatabase->lookupMacAddress(macAddress); diff --git a/libnymea/network/ping.cpp b/libnymea/network/ping.cpp index d921bd23..36038294 100644 --- a/libnymea/network/ping.cpp +++ b/libnymea/network/ping.cpp @@ -292,7 +292,7 @@ void Ping::onSocketReadyRead(int socketDescriptor) { // We must read all data otherwise the socket notifier does not work as expected while (true) { - // Read the socket data... + // Read the socket data and give some extra space for nested pakets... int receiveBufferSize = 2 * ICMP_PACKET_SIZE + sizeof(struct iphdr); char receiveBuffer[receiveBufferSize]; memset(&receiveBuffer, 0, sizeof(receiveBufferSize));