|
@@ -179,7 +179,7 @@ static void net_socket_send(void *opaque)
|
|
s->fd = -1;
|
|
s->fd = -1;
|
|
net_socket_rs_init(&s->rs, net_socket_rs_finalize, false);
|
|
net_socket_rs_init(&s->rs, net_socket_rs_finalize, false);
|
|
s->nc.link_down = true;
|
|
s->nc.link_down = true;
|
|
- memset(s->nc.info_str, 0, sizeof(s->nc.info_str));
|
|
|
|
|
|
+ qemu_set_info_str(&s->nc, "");
|
|
|
|
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
@@ -387,16 +387,15 @@ static NetSocketState *net_socket_fd_init_dgram(NetClientState *peer,
|
|
/* mcast: save bound address as dst */
|
|
/* mcast: save bound address as dst */
|
|
if (is_connected && mcast != NULL) {
|
|
if (is_connected && mcast != NULL) {
|
|
s->dgram_dst = saddr;
|
|
s->dgram_dst = saddr;
|
|
- snprintf(nc->info_str, sizeof(nc->info_str),
|
|
|
|
- "socket: fd=%d (cloned mcast=%s:%d)",
|
|
|
|
- fd, inet_ntoa(saddr.sin_addr), ntohs(saddr.sin_port));
|
|
|
|
|
|
+ qemu_set_info_str(nc, "socket: fd=%d (cloned mcast=%s:%d)", fd,
|
|
|
|
+ inet_ntoa(saddr.sin_addr), ntohs(saddr.sin_port));
|
|
} else {
|
|
} else {
|
|
if (sa_type == SOCKET_ADDRESS_TYPE_UNIX) {
|
|
if (sa_type == SOCKET_ADDRESS_TYPE_UNIX) {
|
|
s->dgram_dst.sin_family = AF_UNIX;
|
|
s->dgram_dst.sin_family = AF_UNIX;
|
|
}
|
|
}
|
|
|
|
|
|
- snprintf(nc->info_str, sizeof(nc->info_str),
|
|
|
|
- "socket: fd=%d %s", fd, SocketAddressType_str(sa_type));
|
|
|
|
|
|
+ qemu_set_info_str(nc, "socket: fd=%d %s", fd,
|
|
|
|
+ SocketAddressType_str(sa_type));
|
|
}
|
|
}
|
|
|
|
|
|
return s;
|
|
return s;
|
|
@@ -430,7 +429,7 @@ static NetSocketState *net_socket_fd_init_stream(NetClientState *peer,
|
|
|
|
|
|
nc = qemu_new_net_client(&net_socket_info, peer, model, name);
|
|
nc = qemu_new_net_client(&net_socket_info, peer, model, name);
|
|
|
|
|
|
- snprintf(nc->info_str, sizeof(nc->info_str), "socket: fd=%d", fd);
|
|
|
|
|
|
+ qemu_set_info_str(nc, "socket: fd=%d", fd);
|
|
|
|
|
|
s = DO_UPCAST(NetSocketState, nc, nc);
|
|
s = DO_UPCAST(NetSocketState, nc, nc);
|
|
|
|
|
|
@@ -497,9 +496,8 @@ static void net_socket_accept(void *opaque)
|
|
s->fd = fd;
|
|
s->fd = fd;
|
|
s->nc.link_down = false;
|
|
s->nc.link_down = false;
|
|
net_socket_connect(s);
|
|
net_socket_connect(s);
|
|
- snprintf(s->nc.info_str, sizeof(s->nc.info_str),
|
|
|
|
- "socket: connection from %s:%d",
|
|
|
|
- inet_ntoa(saddr.sin_addr), ntohs(saddr.sin_port));
|
|
|
|
|
|
+ qemu_set_info_str(&s->nc, "socket: connection from %s:%d",
|
|
|
|
+ inet_ntoa(saddr.sin_addr), ntohs(saddr.sin_port));
|
|
}
|
|
}
|
|
|
|
|
|
static int net_socket_listen_init(NetClientState *peer,
|
|
static int net_socket_listen_init(NetClientState *peer,
|
|
@@ -597,9 +595,8 @@ static int net_socket_connect_init(NetClientState *peer,
|
|
return -1;
|
|
return -1;
|
|
}
|
|
}
|
|
|
|
|
|
- snprintf(s->nc.info_str, sizeof(s->nc.info_str),
|
|
|
|
- "socket: connect to %s:%d",
|
|
|
|
- inet_ntoa(saddr.sin_addr), ntohs(saddr.sin_port));
|
|
|
|
|
|
+ qemu_set_info_str(&s->nc, "socket: connect to %s:%d",
|
|
|
|
+ inet_ntoa(saddr.sin_addr), ntohs(saddr.sin_port));
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -642,9 +639,8 @@ static int net_socket_mcast_init(NetClientState *peer,
|
|
|
|
|
|
s->dgram_dst = saddr;
|
|
s->dgram_dst = saddr;
|
|
|
|
|
|
- snprintf(s->nc.info_str, sizeof(s->nc.info_str),
|
|
|
|
- "socket: mcast=%s:%d",
|
|
|
|
- inet_ntoa(saddr.sin_addr), ntohs(saddr.sin_port));
|
|
|
|
|
|
+ qemu_set_info_str(&s->nc, "socket: mcast=%s:%d",
|
|
|
|
+ inet_ntoa(saddr.sin_addr), ntohs(saddr.sin_port));
|
|
return 0;
|
|
return 0;
|
|
|
|
|
|
}
|
|
}
|
|
@@ -697,9 +693,8 @@ static int net_socket_udp_init(NetClientState *peer,
|
|
|
|
|
|
s->dgram_dst = raddr;
|
|
s->dgram_dst = raddr;
|
|
|
|
|
|
- snprintf(s->nc.info_str, sizeof(s->nc.info_str),
|
|
|
|
- "socket: udp=%s:%d",
|
|
|
|
- inet_ntoa(raddr.sin_addr), ntohs(raddr.sin_port));
|
|
|
|
|
|
+ qemu_set_info_str(&s->nc, "socket: udp=%s:%d", inet_ntoa(raddr.sin_addr),
|
|
|
|
+ ntohs(raddr.sin_port));
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
|