]> git.ipfire.org Git - thirdparty/openldap.git/commitdiff
Save connection ids on operation for logging purposes
authorOndřej Kuzník <ondra@mistotebe.net>
Fri, 14 Apr 2017 08:43:37 +0000 (09:43 +0100)
committerOndřej Kuzník <okuznik@symas.com>
Tue, 17 Nov 2020 17:55:46 +0000 (17:55 +0000)
servers/lloadd/bind.c
servers/lloadd/operation.c
servers/lloadd/slap.h
servers/lloadd/upstream.c

index a658fa06822cb050912bc9b4ef6907906e1832c0..09a4b5661b7b932c9982f567830400dc314e7f5e 100644 (file)
@@ -91,6 +91,10 @@ request_bind( Operation *op )
             LDAP_REQ_BIND, &op->o_request,
             LDAP_TAG_CONTROLS, BER_BV_OPTIONAL( &op->o_ctrls ) );
 
+    Debug( LDAP_DEBUG_TRACE, "request_bind: "
+            "added bind from client connid=%lu to upstream connid=%lu as "
+            "msgid=%d\n",
+            op->o_client_connid, op->o_upstream_connid, op->o_upstream_msgid );
     if ( tavl_insert( &upstream->c_ops, op, operation_upstream_cmp,
                  avl_dup_error ) ) {
         assert(0);
@@ -216,6 +220,10 @@ request_bind_as_vc( Operation *op )
     }
 
     ldap_pvt_thread_mutex_lock( &upstream->c_mutex );
+    Debug( LDAP_DEBUG_TRACE, "request_bind_as_vc: "
+            "added bind from client connid=%lu to upstream connid=%lu as VC "
+            "exop msgid=%d\n",
+            op->o_client_connid, op->o_upstream_connid, op->o_upstream_msgid );
     if ( tavl_insert( &upstream->c_ops, op, operation_upstream_cmp,
                  avl_dup_error ) ) {
         assert(0);
@@ -300,6 +308,7 @@ client_bind( void *ctx, void *arg )
     }
 
     op->o_upstream = upstream;
+    op->o_upstream_connid = upstream->c_connid;
     if ( lload_features & LLOAD_FEATURE_VC ) {
         rc = request_bind_as_vc( op );
     } else {
index 66021dc4b36a93c183b947c89fb2c61471672723..185d07a3fac80c6645db5f1b8ca661e20db87dba 100644 (file)
@@ -139,6 +139,7 @@ operation_init( Connection *c, BerElement *ber )
 
     op = ch_calloc( 1, sizeof(Operation) );
     op->o_client = c;
+    op->o_client_connid = c->c_connid;
     op->o_ber = ber;
 
     tag = ber_get_int( ber, &op->o_client_msgid );
@@ -149,9 +150,9 @@ operation_init( Connection *c, BerElement *ber )
     rc = tavl_insert( &c->c_ops, op, operation_client_cmp, avl_dup_error );
     if ( rc ) {
         Debug( LDAP_DEBUG_PACKETS, "operation_init: "
-                "several operations with same msgid=%d in-flight "
-                "from the client\n",
-                op->o_client_msgid );
+                "several operations with same msgid=%d in-flight from client "
+                "%lu\n",
+                op->o_client_msgid, op->o_client_connid );
         goto fail;
     }
 
@@ -173,7 +174,8 @@ operation_init( Connection *c, BerElement *ber )
 
     Debug( LDAP_DEBUG_TRACE, "operation_init: "
             "set up a new operation, %s with msgid=%d for client %lu\n",
-            slap_msgtype2str( op->o_tag ), op->o_client_msgid, c->c_connid );
+            slap_msgtype2str( op->o_tag ), op->o_client_msgid,
+            op->o_client_connid );
 
     return op;
 
@@ -241,7 +243,7 @@ operation_send_reject(
 
     Debug( LDAP_DEBUG_TRACE, "operation_send_reject: "
             "rejecting %s from client %lu with message: \"%s\"\n",
-            slap_msgtype2str( op->o_tag ), c->c_connid, msg );
+            slap_msgtype2str( op->o_tag ), op->o_client_connid, msg );
 
     ldap_pvt_thread_mutex_lock( &c->c_mutex );
     found = ( tavl_delete( &c->c_ops, op, operation_client_cmp ) == op );
@@ -295,6 +297,7 @@ request_process( void *ctx, void *arg )
         goto fail;
     }
     op->o_upstream = upstream;
+    op->o_upstream_connid = upstream->c_connid;
 
     output = upstream->c_pendingber;
     if ( output == NULL && (output = ber_alloc()) == NULL ) {
index 8ff91a938ce18f77809dc3d81a48993a59028c20..9e06ed51b79ca234a7ba70a6e6fe586485520afd 100644 (file)
@@ -330,6 +330,7 @@ struct Connection {
 
 struct Operation {
     Connection *o_client, *o_upstream;
+    unsigned long o_client_connid, o_upstream_connid;
 
     ber_int_t o_client_msgid, o_upstream_msgid;
     ber_tag_t o_tag;
index 611801e081543910152b655dacdc7840022e0d97..bd77b6a9a35517e3e0a841a717e7efce658da945 100644 (file)
@@ -42,7 +42,8 @@ forward_response( Operation *op, BerElement *ber )
 
     Debug( LDAP_DEBUG_CONNS, "forward_response: "
             "%s to client %lu request #%d\n",
-            slap_msgtype2str( response_tag ), c->c_connid, op->o_client_msgid );
+            slap_msgtype2str( response_tag ), op->o_client_connid,
+            op->o_client_msgid );
 
     ldap_pvt_thread_mutex_lock( &c->c_io_mutex );
     output = c->c_pendingber;
@@ -72,7 +73,7 @@ forward_final_response( Operation *op, BerElement *ber )
 
     Debug( LDAP_DEBUG_CONNS, "forward_final_response: "
             "finishing up with request #%d for client %lu\n",
-            op->o_client_msgid, op->o_client->c_connid );
+            op->o_client_msgid, op->o_client_connid );
     rc = forward_response( op, ber );
     operation_destroy( op );
 
@@ -104,7 +105,7 @@ handle_bind_response( Operation *op, BerElement *ber )
 
     Debug( LDAP_DEBUG_CONNS, "handle_bind_response: "
             "received response for bind request by client %lu, result=%d\n",
-            c->c_connid, result );
+            op->o_client_connid, result );
 
     switch ( result ) {
         case LDAP_SASL_BIND_IN_PROGRESS:
@@ -360,7 +361,7 @@ handle_one_response( Connection *c )
     if ( op ) {
         Debug( LDAP_DEBUG_TRACE, "handle_one_response: "
                 "upstream=%lu, processing response for client %lu, msgid=%d\n",
-                c->c_connid, op->o_client->c_connid, op->o_client_msgid );
+                c->c_connid, op->o_client_connid, op->o_client_msgid );
     } else {
         tag = ber_peek_tag( ber, &len );
         Debug( LDAP_DEBUG_TRACE, "handle_one_response: "