From: Timo Sirainen Date: Wed, 8 Mar 2023 14:48:30 +0000 (+0200) Subject: doveadm: Add local_ip and remote_ip fields to connection event X-Git-Tag: 2.4.0~2233 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1d1d368f4547b35082e53d684e5ebefcba4cc364;p=thirdparty%2Fdovecot%2Fcore.git doveadm: Add local_ip and remote_ip fields to connection event These will be required to preserve support for local {) and remote {} config filters after the following change. --- diff --git a/src/doveadm/client-connection.c b/src/doveadm/client-connection.c index a0d9212694..1d28b605ef 100644 --- a/src/doveadm/client-connection.c +++ b/src/doveadm/client-connection.c @@ -62,8 +62,10 @@ int client_connection_init(struct client_connection *conn, conn->type = type; conn->pool = pool; - (void)net_getsockname(fd, &conn->local_ip, &conn->local_port); - (void)net_getpeername(fd, &conn->remote_ip, &conn->remote_port); + if (net_getsockname(fd, &conn->local_ip, &conn->local_port) == 0) + event_add_ip(conn->event, "local_ip", &conn->local_ip); + if (net_getpeername(fd, &conn->remote_ip, &conn->remote_port) == 0) + event_add_ip(conn->event, "remote_ip", &conn->local_ip); ip = net_ip2addr(&conn->remote_ip); if (ip[0] != '\0')