diff --git a/src/RADIUS_Destination.h b/src/RADIUS_Destination.h index ee6c6f01..f3a4c806 100644 --- a/src/RADIUS_Destination.h +++ b/src/RADIUS_Destination.h @@ -122,8 +122,10 @@ namespace OpenWifi { auto SerialNumber = P.ExtractSerialNumberFromProxyState(); if (!SerialNumber.empty()) { poco_debug(Logger_, - fmt::format("{}: {} Received {} bytes.", SerialNumber, - P.PacketType(), NumberOfReceivedBytes)); + fmt::format("{}: {}:{} Received {} bytes.", SerialNumber, + P.PacketType(), + P.PacketTypeToString(), + NumberOfReceivedBytes)); AP_WS_Server()->SendRadiusAuthenticationData(SerialNumber, Buffer, NumberOfReceivedBytes); } else if(P.IsStatusMessageReply(ReplySource)) { @@ -136,8 +138,9 @@ namespace OpenWifi { auto SerialNumber = P.ExtractSerialNumberFromProxyState(); if (!SerialNumber.empty()) { poco_debug(Logger_, - fmt::format("{}: {} Received {} bytes.", SerialNumber, - P.PacketType(), NumberOfReceivedBytes)); + fmt::format("{}: {}:{} Received {} bytes.", SerialNumber, + P.PacketType(), + P.PacketTypeToString(), NumberOfReceivedBytes)); AP_WS_Server()->SendRadiusAccountingData(SerialNumber, Buffer, NumberOfReceivedBytes); } else { @@ -147,8 +150,9 @@ namespace OpenWifi { auto SerialNumber = P.ExtractSerialNumberTIP(); if (!SerialNumber.empty()) { poco_debug(Logger_, - fmt::format("{}: {} Received {} bytes.", SerialNumber, - P.PacketType(), NumberOfReceivedBytes)); + fmt::format("{}: {}:{} Received {} bytes.", SerialNumber, + P.PacketType(), + P.PacketTypeToString(), NumberOfReceivedBytes)); AP_WS_Server()->SendRadiusCoAData(SerialNumber, Buffer, NumberOfReceivedBytes); } else { diff --git a/src/RADIUS_helpers.h b/src/RADIUS_helpers.h index 43940fad..ceb6f558 100644 --- a/src/RADIUS_helpers.h +++ b/src/RADIUS_helpers.h @@ -409,6 +409,15 @@ namespace OpenWifi::RADIUS { friend std::ostream &operator<<(std::ostream &os, RadiusPacket const &P); + [[nodiscard]] inline std::string PacketTypeToString() const { + + for(auto const &Name:radius_command_values) { + if(Name.cmd == P_.code) + return Name.name; + } + return "Unknown"; + } + inline bool IsAuthentication() { return (P_.code == RADIUS::Access_Request || P_.code == RADIUS::Access_Accept || P_.code == RADIUS::Access_Challenge || P_.code == RADIUS::Access_Reject ||