From c5c17f2ccfc73e0a72fbac9ccf1a6da7a76d94f6 Mon Sep 17 00:00:00 2001 From: Bram Matthys Date: Thu, 30 Dec 2021 13:20:37 +0100 Subject: [PATCH] Include "client_port" (eg 6697) and "server_port" (eg 55123) in JSON output for local clients. --- src/log.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/log.c b/src/log.c index 1e6bc71fd..bfddcddce 100644 --- a/src/log.c +++ b/src/log.c @@ -536,6 +536,10 @@ void json_expand_client(json_t *j, const char *key, Client *client, int detail) /* same for ip, is there for all (well, some services pseudo-users may not have one) */ json_object_set_new(child, "ip", json_string_unreal(client->ip)); + if (client->local && client->local->listener) + json_object_set_new(child, "server_port", json_integer(client->local->listener->port)); + if (client->local && client->local->port) + json_object_set_new(child, "client_port", json_integer(client->local->port)); /* client.details is always available: it is nick!user@host, nick@host, server@host * server@ip, or just server.