Skip to content

Commit

Permalink
DiameterFW session correlation bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
p1-martin committed Nov 13, 2018
1 parent 4d13880 commit 3186dd7
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ private static void configLog4j() {
// Diameter sessions
// TODO consider additng Diameter Host into Key
// Used to correlate Diameter Answers with Requests, to learn the Dest-Realm for the answer
// Key: AppID + ":" + "CommandCode" + ":" + Dest_realm + ":" + msg.getEndToEndIdentifier() + ":" + msg.getHopByHopIdentifier())
// Key: AppID + ":" + "CommandCode" + ":" + Dest_realm + ":" + msg.getEndToEndIdentifier()
// Value: Origin-Realm from first message detected (Request)
private static Map<String, String> diameter_sessions = ExpiringMap.builder()
.expiration(10, TimeUnit.SECONDS)
Expand Down Expand Up @@ -1034,7 +1034,7 @@ public void run() {
// ------ Request/Answer correlation --------
// Store the Diameter session, to be able encrypt also answers. Store Origin Realm from Request
if (!dest_realm.equals("") && msg.isRequest()) {
String session_id = ai + ":" + cc + ":" + dest_realm + ":" + msg.getEndToEndIdentifier() + ":" + msg.getHopByHopIdentifier();
String session_id = ai + ":" + cc + ":" + dest_realm + ":" + msg.getEndToEndIdentifier();
diameter_sessions.put(session_id, orig_realm);
}
// ------------------------------------------
Expand Down Expand Up @@ -1064,7 +1064,7 @@ public void run() {
// Answers without Dest-Realm, but seen previously Request
else if (!msg.isRequest()) {
String _dest_realm = "";
String session_id = ai + ":" + cc + ":" + orig_realm + ":" + msg.getEndToEndIdentifier() + ":" + msg.getHopByHopIdentifier();
String session_id = ai + ":" + cc + ":" + orig_realm + ":" + msg.getEndToEndIdentifier();
if (diameter_sessions.containsKey(session_id)) {
_dest_realm = diameter_sessions.get(session_id);
}
Expand Down Expand Up @@ -1318,7 +1318,7 @@ else if (!msg.isRequest()) {


// ---------- Diameter encryption -----------
String session_id = ai + ":" + cc + ":" + orig_realm + ":" + msg.getEndToEndIdentifier() + ":" + msg.getHopByHopIdentifier();
String session_id = ai + ":" + cc + ":" + orig_realm + ":" + msg.getEndToEndIdentifier();

// Requests containing Dest-Realm
if (!dest_realm.equals("") && msg.isRequest() && DiameterFirewallConfig.destination_realm_encryption.containsKey(dest_realm)) {
Expand Down

0 comments on commit 3186dd7

Please sign in to comment.