@@ -175,6 +175,7 @@ void hmp_info_network(Monitor *mon, const QDict *qdict);
void net_socket_rs_init(SocketReadState *rs,
SocketReadStateFinalize *finalize,
bool vnet_hdr);
+NetClientState *qemu_get_peer(NetClientState *nc, int queue_index);
/* NIC info */
@@ -324,6 +324,12 @@ void *qemu_get_nic_opaque(NetClientState *nc)
return nic->opaque;
}
+NetClientState *qemu_get_peer(NetClientState *nc, int queue_index)
+{
+ assert(nc != NULL);
+ NetClientState *ncs = nc + queue_index;
+ return ncs->peer;
+}
static void qemu_cleanup_net_client(NetClientState *nc)
{
This is a small function that can get the peer from given NetClientState and queue_index Signed-off-by: Cindy Lu <lulu@redhat.com> --- include/net/net.h | 1 + net/net.c | 6 ++++++ 2 files changed, 7 insertions(+)