]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
director: Use *_host.ip_str to avoid net_ip2addr() calls
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Fri, 3 Nov 2017 23:59:27 +0000 (01:59 +0200)
committerAki Tuomi <aki.tuomi@dovecot.fi>
Mon, 6 Nov 2017 07:34:32 +0000 (09:34 +0200)
src/director/director-connection.c
src/director/director-host.c
src/director/director.c
src/director/doveadm-connection.c
src/director/mail-host.c

index 8ed8641c6c4779bda1289ccfce70514b0874b0cc..e8726abbcce4bc9af0666e31c30f33353bb55e51 100644 (file)
@@ -246,7 +246,7 @@ static void director_connection_send_connect(struct director_connection *conn,
                return;
 
        connect_str = t_strdup_printf("CONNECT\t%s\t%u\n",
-                                     net_ip2addr(&host->ip), host->port);
+                                     host->ip_str, host->port);
        director_connection_send(conn, connect_str);
        o_stream_uncork(conn->output);
 
@@ -445,7 +445,7 @@ static bool director_cmd_me(struct director_connection *conn,
                          conn->host->port != port)) {
                i_error("Remote director thinks it's someone else "
                        "(connected to %s:%u, remote says it's %s:%u)",
-                       net_ip2addr(&conn->host->ip), conn->host->port,
+                       conn->host->ip_str, conn->host->port,
                        net_ip2addr(&ip), port);
                return FALSE;
        }
@@ -528,7 +528,7 @@ static bool director_cmd_me(struct director_connection *conn,
                                             dir->self_host) < 0) {
                /* c) */
                connect_str = t_strdup_printf("CONNECT\t%s\t%u\n",
-                                             net_ip2addr(&conn->host->ip),
+                                             conn->host->ip_str,
                                              conn->host->port);
                director_connection_send(dir->left, connect_str);
        } else {
@@ -581,8 +581,8 @@ director_user_refresh(struct director_connection *conn,
        } else if (weak) {
                dir_debug("user refresh: %u weak update to %s ignored, "
                          "we recently changed it to %s",
-                         username_hash, net_ip2addr(&host->ip),
-                         net_ip2addr(&user->host->ip));
+                         username_hash, host->ip_str,
+                         user->host->ip_str);
                host = user->host;
                ret = TRUE;
        } else if (user->host == host) {
@@ -593,15 +593,14 @@ director_user_refresh(struct director_connection *conn,
                   and we should have as well. use the new host. */
                dir_debug("user refresh: %u is nearly expired, "
                          "replacing host %s with %s", username_hash,
-                         net_ip2addr(&user->host->ip), net_ip2addr(&host->ip));
+                         user->host->ip_str, host->ip_str);
                ret = TRUE;
        } else if (USER_IS_BEING_KILLED(user)) {
                /* user is still being moved - ignore conflicting host updates
                   from other directors who don't yet know about the move. */
                dir_debug("user refresh: %u is being moved, "
                          "preserve its host %s instead of replacing with %s",
-                         username_hash, net_ip2addr(&user->host->ip),
-                         net_ip2addr(&host->ip));
+                         username_hash, user->host->ip_str, host->ip_str);
                host = user->host;
        } else {
                /* non-weak user received a non-weak update with
@@ -610,8 +609,7 @@ director_user_refresh(struct director_connection *conn,
 
                str_printfa(str, "User hash %u "
                            "is being redirected to two hosts: %s and %s",
-                           username_hash, net_ip2addr(&user->host->ip),
-                           net_ip2addr(&host->ip));
+                           username_hash, user->host->ip_str, host->ip_str);
                str_printfa(str, " (old_ts=%ld", (long)user->timestamp);
 
                if (!conn->handshake_received) {
@@ -948,7 +946,7 @@ director_cmd_user_weak(struct director_connection *conn,
                   this around the ring to the origin so it also knows it has
                   travelled through the ring. */
                dir_debug("user refresh: %u Remote USER-WEAK from %s seen by the entire ring, ignoring",
-                         username_hash, net_ip2addr(&dir_host->ip));
+                         username_hash, dir_host->ip_str);
                weak_forward = TRUE;
        }
 
@@ -1021,7 +1019,7 @@ director_cmd_host_int(struct director_connection *conn, const char *const *args,
                host_tag = mail_host_get_tag(host);
                if (strcmp(tag, host_tag) != 0) {
                        i_error("director(%s): Host %s changed tag from '%s' to '%s'",
-                               conn->name, net_ip2addr(&host->ip),
+                               conn->name, host->ip_str,
                                host_tag, tag);
                        mail_host_set_tag(host, tag);
                        update = TRUE;
@@ -1030,7 +1028,7 @@ director_cmd_host_int(struct director_connection *conn, const char *const *args,
                        string_t *str = t_str_new(128);
 
                        str_printfa(str, "director(%s): Host %s is being updated before previous update had finished (",
-                                 conn->name, net_ip2addr(&host->ip));
+                                 conn->name, host->ip_str);
                        if (host->down != down &&
                            host->last_updown_change > last_updown_change) {
                                /* our host has a newer change. preserve it. */
@@ -1316,7 +1314,7 @@ static bool director_handshake_cmd_done(struct director_connection *conn)
                /* tell the "right" director about the "left" one */
                director_update_send(dir, director_connection_get_host(conn),
                        t_strdup_printf("DIRECTOR\t%s\t%u\n",
-                                       net_ip2addr(&conn->host->ip),
+                                       conn->host->ip_str,
                                        conn->host->port));
                /* this is our "left" side. */
                return director_connection_assign_left(conn);
@@ -1515,7 +1513,7 @@ director_connection_sync_host(struct director_connection *conn,
                        if (host->desynced_hosts_hash != hosts_hash) {
                                dir_debug("Ignore director %s stale SYNC request whose hosts don't match us "
                                          "(seq=%u, remote hosts_hash=%u, my hosts_hash=%u)",
-                                         net_ip2addr(&host->ip), seq, hosts_hash,
+                                         host->ip_str, seq, hosts_hash,
                                          mail_hosts_hash(dir->mail_hosts));
                                host->desynced_hosts_hash = hosts_hash;
                                return FALSE;
@@ -1526,7 +1524,7 @@ director_connection_sync_host(struct director_connection *conn,
                           changing rapidly. */
                        i_error("director(%s): Director %s SYNC request hosts don't match us - resending hosts "
                                "(seq=%u, remote hosts_hash=%u, my hosts_hash=%u)",
-                               conn->name, net_ip2addr(&host->ip), seq,
+                               conn->name, host->ip_str, seq,
                                hosts_hash, mail_hosts_hash(dir->mail_hosts));
                        director_resend_hosts(dir);
                        return FALSE;
@@ -1920,7 +1918,7 @@ static void director_connection_send_directors(struct director_connection *conn)
 
                str_truncate(str, 0);
                str_printfa(str, "DIRECTOR\t%s\t%u\n",
-                           net_ip2addr(&(*hostp)->ip), (*hostp)->port);
+                           (*hostp)->ip_str, (*hostp)->port);
                director_connection_send(conn, str_c(str));
        }
 }
@@ -1943,7 +1941,7 @@ director_connection_send_hosts(struct director_connection *conn)
                const char *host_tag = mail_host_get_tag(host);
 
                str_printfa(str, "HOST\t%s\t%u",
-                           net_ip2addr(&host->ip), host->vhost_count);
+                           host->ip_str, host->vhost_count);
                if (host_tag[0] != '\0' || send_updowns) {
                        str_append_c(str, '\t');
                        str_append_tabescaped(str, host_tag);
@@ -1992,7 +1990,7 @@ static int director_connection_send_users(struct director_connection *conn)
 
                        str_printfa(str, "USER\t%u\t%s\t%u",
                                    user->username_hash,
-                                   net_ip2addr(&user->host->ip),
+                                   user->host->ip_str,
                                    user->timestamp);
                        if (user->weak)
                                str_append(str, "\tw");
index e7fa597fcfd78f3912388ac27229143735eba426..58cc556a3f97e9d9f4efad9fdc1025e81eccfcbb 100644 (file)
@@ -36,7 +36,7 @@ director_host_add(struct director *dir,
        host->ip = *ip;
        host->ip_str = i_strdup(net_ip2addr(&host->ip));
        host->port = port;
-       host->name = i_strdup_printf("%s:%u", net_ip2addr(ip), port);
+       host->name = i_strdup_printf("%s:%u", host->ip_str, port);
 
        array_append(&dir->dir_hosts, &host, 1);
 
index 972a85860b40832f4b689e196d48b9cef2736072..0384b950ada6824851d5a9718b35e3198d5fdfd4 100644 (file)
@@ -142,7 +142,7 @@ director_log_connect(struct director *dir, struct director_host *host,
                            (int)(ioloop_time - host->last_protocol_failure));
        }
        i_info("Connecting to %s:%u (as %s%s): %s",
-              net_ip2addr(&host->ip), host->port,
+              host->ip_str, host->port,
               net_ip2addr(&dir->self_ip), str_c(str), reason);
 }
 
@@ -369,7 +369,7 @@ void director_sync_send(struct director *dir, struct director_host *host,
 
        str = t_str_new(128);
        str_printfa(str, "SYNC\t%s\t%u\t%u",
-                   net_ip2addr(&host->ip), host->port, seq);
+                   host->ip_str, host->port, seq);
        if (minor_version > 0 &&
            director_connection_get_minor_version(dir->right) > 0) {
                /* only minor_version>0 supports extra parameters */
@@ -501,7 +501,7 @@ void director_notify_ring_added(struct director_host *added_host,
 
        added_host->dir->ring_change_counter++;
        cmd = t_strdup_printf("DIRECTOR\t%s\t%u\n",
-                             net_ip2addr(&added_host->ip), added_host->port);
+                             added_host->ip_str, added_host->port);
        director_update_send(added_host->dir, src, cmd);
 }
 
@@ -556,8 +556,7 @@ void director_ring_remove(struct director_host *removed_host,
        /* if our left or ride side gets removed, notify them first
           before disconnecting. */
        cmd = t_strdup_printf("DIRECTOR-REMOVE\t%s\t%u\n",
-                             net_ip2addr(&removed_host->ip),
-                             removed_host->port);
+                             removed_host->ip_str, removed_host->port);
        director_update_send_version(dir, src,
                                     DIRECTOR_VERSION_RING_REMOVE, cmd);
 
@@ -593,9 +592,8 @@ director_send_host(struct director *dir, struct director_host *src,
 
        str = t_str_new(128);
        str_printfa(str, "HOST\t%s\t%u\t%u\t%s\t%u",
-                   net_ip2addr(&orig_src->ip), orig_src->port,
-                   orig_src->last_seq,
-                   net_ip2addr(&host->ip), host->vhost_count);
+                   orig_src->ip_str, orig_src->port, orig_src->last_seq,
+                   host->ip_str, host->vhost_count);
        if (dir->ring_min_version >= DIRECTOR_VERSION_TAGS_V2) {
                str_append_c(str, '\t');
                str_append_tabescaped(str, host_tag);
@@ -603,10 +601,10 @@ director_send_host(struct director *dir, struct director_host *src,
                   dir->ring_min_version < DIRECTOR_VERSION_TAGS_V2) {
                if (dir->ring_min_version < DIRECTOR_VERSION_TAGS) {
                        i_error("Ring has directors that don't support tags - removing host %s with tag '%s'",
-                               net_ip2addr(&host->ip), host_tag);
+                               host->ip_str, host_tag);
                } else {
                        i_error("Ring has directors that support mixed versions of tags - removing host %s with tag '%s'",
-                               net_ip2addr(&host->ip), host_tag);
+                               host->ip_str, host_tag);
                }
                director_remove_host(dir, NULL, NULL, host);
                return;
@@ -640,7 +638,7 @@ void director_update_host(struct director *dir, struct director_host *src,
 
        dir_debug("Updating host %s vhost_count=%u "
                  "down=%d last_updown_change=%ld (hosts_hash=%u)",
-                 net_ip2addr(&host->ip), host->vhost_count, host->down ? 1 : 0,
+                 host->ip_str, host->vhost_count, host->down ? 1 : 0,
                  (long)host->last_updown_change,
                  mail_hosts_hash(dir->mail_hosts));
 
@@ -667,8 +665,8 @@ void director_remove_host(struct director *dir, struct director_host *src,
 
                director_update_send(dir, src, t_strdup_printf(
                        "HOST-REMOVE\t%s\t%u\t%u\t%s\n",
-                       net_ip2addr(&orig_src->ip), orig_src->port,
-                       orig_src->last_seq, net_ip2addr(&host->ip)));
+                       orig_src->ip_str, orig_src->port,
+                       orig_src->last_seq, host->ip_str));
        }
 
        user_directory_remove_host(users, host);
@@ -689,8 +687,8 @@ void director_flush_host(struct director *dir, struct director_host *src,
 
        director_update_send(dir, src, t_strdup_printf(
                "HOST-FLUSH\t%s\t%u\t%u\t%s\n",
-               net_ip2addr(&orig_src->ip), orig_src->port, orig_src->last_seq,
-               net_ip2addr(&host->ip)));
+               orig_src->ip_str, orig_src->port, orig_src->last_seq,
+               host->ip_str));
        user_directory_remove_host(users, host);
        director_sync(dir);
 }
@@ -702,7 +700,7 @@ void director_update_user(struct director *dir, struct director_host *src,
 
        i_assert(!user->weak);
        director_update_send(dir, src, t_strdup_printf("USER\t%u\t%s\n",
-               user->username_hash, net_ip2addr(&user->host->ip)));
+               user->username_hash, user->host->ip_str));
 }
 
 void director_update_user_weak(struct director *dir, struct director_host *src,
@@ -721,8 +719,8 @@ void director_update_user_weak(struct director *dir, struct director_host *src,
        }
 
        cmd = t_strdup_printf("USER-WEAK\t%s\t%u\t%u\t%u\t%s\n",
-               net_ip2addr(&orig_src->ip), orig_src->port, orig_src->last_seq,
-               user->username_hash, net_ip2addr(&user->host->ip));
+               orig_src->ip_str, orig_src->port, orig_src->last_seq,
+               user->username_hash, user->host->ip_str);
 
        if (src != dir->self_host && dir->left != NULL && dir->right != NULL &&
            director_connection_get_host(dir->left) ==
@@ -766,8 +764,7 @@ director_flush_user_continue(int result, struct director_kill_context *ctx)
                        i_error("%s: Failed to flush user hash %u in host %s: %s",
                                ctx->socket_path,
                                ctx->username_hash,
-                               net_ip2addr(&ctx->host_ip),
-                               data);
+                               net_ip2addr(&ctx->host_ip), data);
                }
                i_stream_unref(&is);
        } else {
@@ -794,7 +791,7 @@ director_flush_user(struct director *dir, struct user *user)
 {
        struct director_kill_context *ctx = user->kill_ctx;
        struct var_expand_table tab[] = {
-               { 'i', net_ip2addr(&user->host->ip), "ip" },
+               { 'i', user->host->ip_str, "ip" },
                { 'h', user->host->hostname, "host" },
                { '\0', NULL, NULL }
        };
@@ -838,7 +835,7 @@ director_flush_user(struct director *dir, struct user *user)
                "FLUSH",
                t_strdup_printf("%u", user->username_hash),
                net_ip2addr(&ctx->old_host_ip),
-               net_ip2addr(&user->host->ip),
+               user->host->ip_str,
                ctx->old_host_down ? "down" : "up",
                dec2str(ctx->old_host_vhost_count),
                NULL
@@ -853,7 +850,7 @@ director_flush_user(struct director *dir, struct user *user)
                i_error("%s: Failed to flush user hash %u in host %s: %s",
                        ctx->socket_path,
                        user->username_hash,
-                       net_ip2addr(&user->host->ip),
+                       user->host->ip_str,
                        error);
                director_flush_user_continue(0, ctx);
                return;
@@ -862,7 +859,7 @@ director_flush_user(struct director *dir, struct user *user)
        ctx->reply =
                iostream_temp_create_named("/tmp", 0,
                                           t_strdup_printf("flush response from %s",
-                                                          net_ip2addr(&user->host->ip)));
+                                                          user->host->ip_str));
        o_stream_set_no_error_handling(ctx->reply, TRUE);
        program_client_set_output(ctx->pclient, ctx->reply);
        ctx->callback_pending = TRUE;
@@ -1110,7 +1107,7 @@ void director_move_user(struct director *dir, struct director_host *src,
                old_host = user->host;
                user->timestamp = ioloop_time;
                dir_debug("User %u move forwarded: host is already %s",
-                         username_hash, net_ip2addr(&host->ip));
+                         username_hash, host->ip_str);
        } else {
                /* user is looked up via the new host's tag, so if it's found
                   the old tag has to be the same. */
@@ -1122,8 +1119,8 @@ void director_move_user(struct director *dir, struct director_host *src,
                user->host->user_count++;
                user->timestamp = ioloop_time;
                dir_debug("User %u move started: host %s -> %s",
-                         username_hash, net_ip2addr(&old_host->ip),
-                         net_ip2addr(&host->ip));
+                         username_hash, old_host->ip_str,
+                         host->ip_str);
        }
 
        if (orig_src == NULL) {
@@ -1132,8 +1129,8 @@ void director_move_user(struct director *dir, struct director_host *src,
        }
        director_update_send(dir, src, t_strdup_printf(
                "USER-MOVE\t%s\t%u\t%u\t%u\t%s\n",
-               net_ip2addr(&orig_src->ip), orig_src->port, orig_src->last_seq,
-               user->username_hash, net_ip2addr(&user->host->ip)));
+               orig_src->ip_str, orig_src->port, orig_src->last_seq,
+               user->username_hash, user->host->ip_str));
        /* kill the user only after sending the USER-MOVE, because the kill
           may finish instantly. */
        director_kill_user(dir, src, user, host->tag, old_host, FALSE);
@@ -1162,7 +1159,7 @@ void director_kick_user(struct director *dir, struct director_host *src,
        }
        str_truncate(cmd, 0);
        str_printfa(cmd, "USER-KICK\t%s\t%u\t%u\t",
-               net_ip2addr(&orig_src->ip), orig_src->port, orig_src->last_seq);
+               orig_src->ip_str, orig_src->port, orig_src->last_seq);
        str_append_tabescaped(cmd, username);
        str_append_c(cmd, '\n');
        director_update_send_version(dir, src, DIRECTOR_VERSION_USER_KICK, str_c(cmd));
@@ -1187,7 +1184,7 @@ void director_kick_user_alt(struct director *dir, struct director_host *src,
        }
        str_truncate(cmd, 0);
        str_printfa(cmd, "USER-KICK-ALT\t%s\t%u\t%u\t",
-               net_ip2addr(&orig_src->ip), orig_src->port, orig_src->last_seq);
+               orig_src->ip_str, orig_src->port, orig_src->last_seq);
        str_append_tabescaped(cmd, field);
        str_append_c(cmd, '\t');
        str_append_tabescaped(cmd, value);
@@ -1212,7 +1209,7 @@ void director_kick_user_hash(struct director *dir, struct director_host *src,
                orig_src->last_seq++;
        }
        cmd = t_strdup_printf("USER-KICK-HASH\t%s\t%u\t%u\t%u\t%s\n",
-               net_ip2addr(&orig_src->ip), orig_src->port, orig_src->last_seq,
+               orig_src->ip_str, orig_src->port, orig_src->last_seq,
                username_hash, net_ip2addr(except_ip));
        director_update_send_version(dir, src, DIRECTOR_VERSION_USER_KICK, cmd);
 }
@@ -1229,7 +1226,7 @@ director_send_user_killed_everywhere(struct director *dir,
        }
        director_update_send(dir, src, t_strdup_printf(
                "USER-KILLED-EVERYWHERE\t%s\t%u\t%u\t%u\n",
-               net_ip2addr(&orig_src->ip), orig_src->port, orig_src->last_seq,
+               orig_src->ip_str, orig_src->port, orig_src->last_seq,
                username_hash));
 }
 
index 986fc73b859ebe52c88dc2da509fbec7495b53f9..ab602b574363161587cee0da194fa5ab2671d378 100644 (file)
@@ -90,7 +90,7 @@ doveadm_cmd_host_list(struct doveadm_connection *conn,
 
        array_foreach(mail_hosts_get(conn->dir->mail_hosts), hostp) {
                str_printfa(str, "%s\t%u\t%u\t",
-                           net_ip2addr(&(*hostp)->ip), (*hostp)->vhost_count,
+                           (*hostp)->ip_str, (*hostp)->vhost_count,
                            (*hostp)->user_count);
                str_append_tabescaped(str, mail_host_get_tag(*hostp));
                str_printfa(str, "\t%c\t%ld", (*hostp)->down ? 'D' : 'U',
@@ -130,13 +130,12 @@ doveadm_cmd_host_list_removed(struct doveadm_connection *conn,
                else if (ret > 0)
                        j++;
                else {
-                       str_printfa(str, "%s\n",
-                                   net_ip2addr(&orig_hosts[i]->ip));
+                       str_printfa(str, "%s\n", orig_hosts[i]->ip_str);
                        i++;
                }
        }
        for (; i < orig_hosts_count; i++)
-               str_printfa(str, "%s\n", net_ip2addr(&orig_hosts[i]->ip));
+               str_printfa(str, "%s\n", orig_hosts[i]->ip_str);
        str_append_c(str, '\n');
        o_stream_nsend(conn->output, str_data(str), str_len(str));
 
@@ -151,7 +150,7 @@ doveadm_director_host_append_status(const struct director_host *host,
        time_t last_failed = I_MAX(host->last_network_failure,
                                   host->last_protocol_failure);
        str_printfa(str, "%s\t%u\t%s\t%"PRIdTIME_T"\t",
-                   net_ip2addr(&host->ip), host->port, type,
+                   host->ip_str, host->port, type,
                    last_failed);
 }
 
@@ -656,7 +655,7 @@ doveadm_cmd_user_lookup(struct doveadm_connection *conn,
        if (user == NULL)
                str_append(str, "\t0");
        else {
-               str_printfa(str, "%s\t%u", net_ip2addr(&user->host->ip),
+               str_printfa(str, "%s\t%u", user->host->ip_str,
                            user->timestamp +
                            conn->dir->set->director_user_expire);
        }
@@ -666,7 +665,7 @@ doveadm_cmd_user_lookup(struct doveadm_connection *conn,
        if (host == NULL)
                str_append(str, "\t");
        else
-               str_printfa(str, "\t%s", net_ip2addr(&host->ip));
+               str_printfa(str, "\t%s", host->ip_str);
 
        /* get host with default configuration */
        host = mail_host_get_by_hash(conn->dir->orig_config_hosts,
@@ -674,7 +673,7 @@ doveadm_cmd_user_lookup(struct doveadm_connection *conn,
        if (host == NULL)
                str_append(str, "\t\n");
        else
-               str_printfa(str, "\t%s\n", net_ip2addr(&host->ip));
+               str_printfa(str, "\t%s\n", host->ip_str);
        o_stream_nsend(conn->output, str_data(str), str_len(str));
        return DOVEADM_DIRECTOR_CMD_RET_OK;
 }
@@ -705,7 +704,7 @@ doveadm_cmd_user_list(struct doveadm_connection *conn, const char *const *args)
                        o_stream_nsend_str(conn->output, t_strdup_printf(
                                "%u\t%u\t%s\n",
                                user->username_hash, expire_time,
-                               net_ip2addr(&user->host->ip)));
+                               user->host->ip_str));
                } T_END;
        }
        director_iterate_users_deinit(&iter);
index f5a272e2897a4f2fd4bbac88a25f4c250d70396d..316ba29dc51045c1d17d7328bb4b99ab52aff24f 100644 (file)
@@ -54,17 +54,14 @@ static void mail_vhost_add(struct mail_tag *tag, struct mail_host *host)
        struct mail_vhost *vhost;
        struct md5_context md5_ctx, md5_ctx2;
        unsigned char md5[MD5_RESULTLEN];
-       const char *ip_str;
        char num_str[MAX_INT_STRLEN];
        unsigned int i, j;
 
        if (host->down || host->tag != tag)
                return;
 
-       ip_str = net_ip2addr(&host->ip);
-
        md5_init(&md5_ctx);
-       md5_update(&md5_ctx, ip_str, strlen(ip_str));
+       md5_update(&md5_ctx, host->ip_str, strlen(host->ip_str));
 
        for (i = 0; i < host->vhost_count; i++) {
                md5_ctx2 = md5_ctx;
@@ -341,7 +338,7 @@ void mail_host_set_down(struct mail_host *host, bool down,
                const char *updown = down ? "down" : "up";
                i_info("%sHost %s changed %s "
                       "(vhost_count=%u last_updown_change=%ld)",
-                      log_prefix, net_ip2addr(&host->ip), updown,
+                      log_prefix, host->ip_str, updown,
                       host->vhost_count, (long)host->last_updown_change);
 
                host->down = down;
@@ -354,7 +351,7 @@ void mail_host_set_vhost_count(struct mail_host *host, unsigned int vhost_count,
                               const char *log_prefix)
 {
        i_info("%sHost %s vhost count changed from %u to %u",
-              log_prefix, net_ip2addr(&host->ip),
+              log_prefix, host->ip_str,
               host->vhost_count, vhost_count);
 
        host->vhost_count = vhost_count;