You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by gm...@apache.org on 2019/10/16 18:11:25 UTC
[qpid-dispatch] branch master updated: DISPATCH-1416: Add policy
denial counts to connection close log
This is an automated email from the ASF dual-hosted git repository.
gmurthy pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/qpid-dispatch.git
The following commit(s) were added to refs/heads/master by this push:
new ff82055 DISPATCH-1416: Add policy denial counts to connection close log
ff82055 is described below
commit ff82055ed34060e24d4a4626d3c4ba921c11bfbb
Author: Chuck Rolke <ch...@apache.org>
AuthorDate: Mon Sep 23 11:31:00 2019 -0400
DISPATCH-1416: Add policy denial counts to connection close log
---
src/policy.c | 15 +++++++++++++--
tests/system_tests_policy.py | 7 +++++++
2 files changed, 20 insertions(+), 2 deletions(-)
diff --git a/src/policy.c b/src/policy.c
index b2768f3..395c850 100644
--- a/src/policy.c
+++ b/src/policy.c
@@ -301,8 +301,19 @@ void qd_policy_socket_close(qd_policy_t *policy, const qd_connection_t *conn)
qd_python_unlock(lock_state);
}
const char *hostname = qd_connection_name(conn);
- qd_log(policy->log_source, QD_LOG_DEBUG, "Connection '%s' closed with resources n_sessions=%d, n_senders=%d, n_receivers=%d. nConnections= %d.",
- hostname, conn->n_sessions, conn->n_senders, conn->n_receivers, n_connections);
+ int ssnDenied = 0;
+ int sndDenied = 0;
+ int rcvDenied = 0;
+ if (conn->policy_settings && conn->policy_settings->denialCounts) {
+ ssnDenied = conn->policy_settings->denialCounts->sessionDenied;
+ sndDenied = conn->policy_settings->denialCounts->senderDenied;
+ rcvDenied = conn->policy_settings->denialCounts->receiverDenied;
+ }
+ qd_log(policy->log_source, QD_LOG_DEBUG,
+ "Connection '%s' closed with resources n_sessions=%d, n_senders=%d, n_receivers=%d, "
+ "sessions_denied=%d, senders_denied=%d, receivers_denied=%d. nConnections= %d.",
+ hostname, conn->n_sessions, conn->n_senders, conn->n_receivers,
+ ssnDenied, sndDenied, rcvDenied, n_connections);
}
diff --git a/tests/system_tests_policy.py b/tests/system_tests_policy.py
index d5d6159..9aa5262 100644
--- a/tests/system_tests_policy.py
+++ b/tests/system_tests_policy.py
@@ -326,6 +326,13 @@ class SenderReceiverLimits(TestCase):
bs1.close()
+ def test_verify_z_connection_stats(self):
+ with open('../setUpClass/SenderReceiverLimits.log', 'r') as router_log:
+ log_lines = router_log.read().split("\n")
+ close_lines = [s for s in log_lines if "senders_denied=1, receivers_denied=1" in s]
+ self.assertTrue(len(close_lines) == 1, msg='Policy did not log sender and receiver denials.')
+
+
class PolicyVhostOverride(TestCase):
"""
Verify that listener policyVhost can override normally discovered vhost.
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org