From fa2bce26e0af48f3c85ce2d7cce11d1dde3a47f8 Mon Sep 17 00:00:00 2001 From: Eddie Carpenter Date: Wed, 18 Sep 2024 08:21:26 +1200 Subject: [PATCH 1/2] Detect unknown avps and include in the log message --- .../org/jdiameter/common/impl/DiameterUtilities.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/core/jdiameter/impl/src/main/java/org/jdiameter/common/impl/DiameterUtilities.java b/core/jdiameter/impl/src/main/java/org/jdiameter/common/impl/DiameterUtilities.java index 297a2e44b..cfb1fb503 100644 --- a/core/jdiameter/impl/src/main/java/org/jdiameter/common/impl/DiameterUtilities.java +++ b/core/jdiameter/impl/src/main/java/org/jdiameter/common/impl/DiameterUtilities.java @@ -24,6 +24,7 @@ import org.jdiameter.api.Message; import org.jdiameter.api.validation.AvpRepresentation; import org.jdiameter.api.validation.Dictionary; +import org.jdiameter.common.impl.validation.AvpRepresentationImpl; import org.jdiameter.common.impl.validation.DictionaryImpl; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -71,14 +72,17 @@ public static String printAvps(AvpSet avps, String pKeywordSep, String indentati for (Avp avp : avps) { AvpRepresentation avpRep = AVP_DICTIONARY.getAvp(avp.getCode(), avp.getVendorId()); if (avpRep == null) { - continue; - } //if + avpRep = new AvpRepresentationImpl("Unknown AVP "+avp.getCode(), "Unknown AVP", + avp.getCode(), false, null, null, null, + avp.getVendorId(), + null,null); + } Object avpValue; boolean isGrouped = false; try { - String avpType = AVP_DICTIONARY.getAvp(avp.getCode(), avp.getVendorId()).getType(); + String avpType = avpRep.getType(); if (null == avpType) { avpValue = avp.getUTF8String().replace("\r", "").replace("\n", ""); @@ -136,7 +140,7 @@ public static String printAvps(AvpSet avps, String pKeywordSep, String indentati LOG.debug(avpLine.toString()); } //if - stringBuilder.append(avpLine.toString()).append('\n'); + stringBuilder.append(avpLine).append('\n'); if (isGrouped) { try { From fc0582aff4936e4254e407e7e4544ac0e9e83623 Mon Sep 17 00:00:00 2001 From: Eddie Carpenter Date: Wed, 18 Sep 2024 08:35:23 +1200 Subject: [PATCH 2/2] Detect unknown avps and include in the log message --- .../java/org/jdiameter/common/impl/DiameterUtilities.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/core/jdiameter/impl/src/main/java/org/jdiameter/common/impl/DiameterUtilities.java b/core/jdiameter/impl/src/main/java/org/jdiameter/common/impl/DiameterUtilities.java index cfb1fb503..e3736a154 100644 --- a/core/jdiameter/impl/src/main/java/org/jdiameter/common/impl/DiameterUtilities.java +++ b/core/jdiameter/impl/src/main/java/org/jdiameter/common/impl/DiameterUtilities.java @@ -73,9 +73,10 @@ public static String printAvps(AvpSet avps, String pKeywordSep, String indentati AvpRepresentation avpRep = AVP_DICTIONARY.getAvp(avp.getCode(), avp.getVendorId()); if (avpRep == null) { avpRep = new AvpRepresentationImpl("Unknown AVP "+avp.getCode(), "Unknown AVP", - avp.getCode(), false, null, null, null, - avp.getVendorId(), - null,null); + avp.getCode(), false, null, null, null, + avp.getVendorId(), + AvpRepresentation.Type.UTF8String.toString(), + AvpRepresentation.Type.UTF8String.toString()); } Object avpValue;