When reading received messages with MSG_PEEK, we would like to eliminate the need to read the leading bytes over and over again only to reach the part of the message we really want. We now introduce support for this feature, when supported by the kernel. Signed-off-by: Jon Maloy <jmaloy(a)redhat.com> --- tcp.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tcp.c b/tcp.c index 0ed9bfa..ebaf520 100644 --- a/tcp.c +++ b/tcp.c @@ -500,7 +500,6 @@ tcp6_l2_buf[TCP_FRAMES_MEM]; static unsigned int tcp6_l2_buf_used; /* recvmsg()/sendmsg() data for tap */ -static char tcp_buf_discard [MAX_WINDOW]; static struct iovec iov_sock [TCP_FRAMES_MEM + 1]; static struct iovec tcp4_l2_iov [TCP_FRAMES_MEM]; @@ -2239,7 +2238,7 @@ static int tcp_data_from_sock(struct ctx *c, struct tcp_tap_conn *conn) mh_sock.msg_iov = iov_sock; mh_sock.msg_iovlen = fill_bufs + 1; - iov_sock[0].iov_base = tcp_buf_discard; + iov_sock[0].iov_base = NULL; iov_sock[0].iov_len = already_sent; if (( v4 && tcp4_l2_buf_used + fill_bufs > ARRAY_SIZE(tcp4_l2_buf)) || -- 2.39.0