From c3ccfe455e6a858ffa3472b7f0eb2fc2fb857cc0 Mon Sep 17 00:00:00 2001 From: stephb9959 Date: Mon, 13 Nov 2023 13:26:11 -0800 Subject: [PATCH] https://telecominfraproject.atlassian.net/browse/WIFI-13110 Signed-off-by: stephb9959 --- src/RADIUS_Destination.h | 16 ++++++++++------ src/RADIUS_helpers.h | 9 +++++++++ 2 files changed, 19 insertions(+), 6 deletions(-) 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 ||