From: Timo Sirainen Date: Mon, 2 Feb 2026 11:15:28 +0000 (+0200) Subject: lib: Add struct connection.local_port X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6fd20df6495a4e0430f7402b3d2e6d6d79c414e0;p=thirdparty%2Fdovecot%2Fcore.git lib: Add struct connection.local_port --- diff --git a/src/lib/connection.c b/src/lib/connection.c index 2f2ffeb33a..9901581b1d 100644 --- a/src/lib/connection.c +++ b/src/lib/connection.c @@ -441,6 +441,11 @@ void connection_update_event(struct connection *conn) "source_ip" : "local_ip", net_ip2addr(&conn->local_ip)); } + if (conn->local_port > 0) { + event_add_int(conn->event, conn->list->set.client ? + "source_port" : "local_port", + conn->local_port); + } if (conn->remote_ip.family > 0) { event_add_str(conn->event, conn->list->set.client ? diff --git a/src/lib/connection.h b/src/lib/connection.h index 6b994f096e..6203426f6d 100644 --- a/src/lib/connection.h +++ b/src/lib/connection.h @@ -167,8 +167,8 @@ struct connection { /* Local and remote IP for TCP connections. */ struct ip_addr local_ip, remote_ip; - /* Remote port for TCP connections. */ - in_port_t remote_port; + /* Local and remote port for TCP connections. */ + in_port_t local_port, remote_port; /* Remote pid, UNIX socket only. */ pid_t remote_pid; /* Remote user id, UNIX socket only. */