]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib: Add struct connection.local_port
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Mon, 2 Feb 2026 11:15:28 +0000 (13:15 +0200)
committeraki.tuomi <aki.tuomi@open-xchange.com>
Fri, 6 Feb 2026 07:58:43 +0000 (07:58 +0000)
src/lib/connection.c
src/lib/connection.h

index 2f2ffeb33a30ec8c7ffd4e4a34dfb0f6a5bad694..9901581b1de728ed3585a28549f53ff10e4b6ea3 100644 (file)
@@ -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 ?
index 6b994f096e59aa601528238863baa6d48d172890..6203426f6d6cda0b75c0e95c3c3503fac95b3759 100644 (file)
@@ -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. */