Always use a 'v6' flag, rather than sometimes a 'v4' flag. Signed-off-by: David Gibson <david(a)gibson.dropbear.id.au> --- tcp_vu.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tcp_vu.c b/tcp_vu.c index 2415118..b994817 100644 --- a/tcp_vu.c +++ b/tcp_vu.c @@ -204,14 +204,14 @@ int tcp_vu_send_flag(const struct ctx *c, struct tcp_tap_conn *conn, int flags) /** tcp_vu_sock_recv() - Receive datastream from socket into vhost-user buffers * @c: Execution context * @conn: Connection pointer - * @v4: Set for IPv4 connections + * @v6: Set for IPv6 connections * @fillsize: Number of bytes we can receive * @dlen: Size of received data (output) * * Return: Number of iov entries used to store the data */ static ssize_t tcp_vu_sock_recv(const struct ctx *c, - struct tcp_tap_conn *conn, bool v4, + struct tcp_tap_conn *conn, bool v6, size_t fillsize, ssize_t *dlen) { struct vu_dev *vdev = c->vdev; @@ -225,7 +225,7 @@ static ssize_t tcp_vu_sock_recv(const struct ctx *c, *dlen = 0; - l2_hdrlen = tcp_vu_l2_hdrlen(!v4); + l2_hdrlen = tcp_vu_l2_hdrlen(v6); vu_init_elem(elem, &iov_vu[1], VIRTQUEUE_MAX_SIZE); @@ -357,8 +357,8 @@ int tcp_vu_data_from_sock(const struct ctx *c, struct tcp_tap_conn *conn) uint16_t mss = MSS_GET(conn); size_t l2_hdrlen, fillsize; int i, iov_cnt, iov_used; - int v4 = CONN_V4(conn); uint32_t already_sent = 0; + int v6 = CONN_V6(conn); const uint16_t *check; struct iovec *first; int frame_size; @@ -401,7 +401,7 @@ int tcp_vu_data_from_sock(const struct ctx *c, struct tcp_tap_conn *conn) /* collect the buffers from vhost-user and fill them with the * data from the socket */ - iov_cnt = tcp_vu_sock_recv(c, conn, v4, fillsize, &len); + iov_cnt = tcp_vu_sock_recv(c, conn, v6, fillsize, &len); if (iov_cnt <= 0) return iov_cnt; @@ -418,7 +418,7 @@ int tcp_vu_data_from_sock(const struct ctx *c, struct tcp_tap_conn *conn) tcp_update_seqack_wnd(c, conn, 0, NULL); /* initialize headers */ - l2_hdrlen = tcp_vu_l2_hdrlen(!v4); + l2_hdrlen = tcp_vu_l2_hdrlen(v6); iov_used = 0; num_buffers = 0; check = NULL; -- 2.47.0