diff options
author | Laurent Vivier <lvivier@redhat.com> | 2024-06-13 14:36:55 +0200 |
---|---|---|
committer | Stefano Brivio <sbrivio@redhat.com> | 2024-06-13 15:45:42 +0200 |
commit | 4070bac7a48f92041617363a5e94ab760ba72073 (patch) | |
tree | ff1e92f175f133b5601c5f2256fe1775acfb83de | |
parent | 7290335b146c61495178c73310bc6727608988cc (diff) | |
download | passt-4070bac7a48f92041617363a5e94ab760ba72073.tar passt-4070bac7a48f92041617363a5e94ab760ba72073.tar.gz passt-4070bac7a48f92041617363a5e94ab760ba72073.tar.bz2 passt-4070bac7a48f92041617363a5e94ab760ba72073.tar.lz passt-4070bac7a48f92041617363a5e94ab760ba72073.tar.xz passt-4070bac7a48f92041617363a5e94ab760ba72073.tar.zst passt-4070bac7a48f92041617363a5e94ab760ba72073.zip |
tap: use in->buf_size rather than sizeof(pkt_buf)
buf_size is set to sizeof(pkt_buf) by default. And it seems more correct
to provide the actual size of the buffer.
Later a buf_size of 0 will allow vhost-user mode to detect
guest memory buffers.
Signed-off-by: Laurent Vivier <lvivier@redhat.com>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
-rw-r--r-- | tap.c | 10 |
1 files changed, 5 insertions, 5 deletions
@@ -602,7 +602,7 @@ resume: if (!eh) continue; if (ntohs(eh->h_proto) == ETH_P_ARP) { - PACKET_POOL_P(pkt, 1, in->buf, sizeof(pkt_buf)); + PACKET_POOL_P(pkt, 1, in->buf, in->buf_size); packet_add(pkt, l2len, (char *)eh); arp(c, pkt); @@ -642,7 +642,7 @@ resume: continue; if (iph->protocol == IPPROTO_ICMP) { - PACKET_POOL_P(pkt, 1, in->buf, sizeof(pkt_buf)); + PACKET_POOL_P(pkt, 1, in->buf, in->buf_size); if (c->no_icmp) continue; @@ -661,7 +661,7 @@ resume: continue; if (iph->protocol == IPPROTO_UDP) { - PACKET_POOL_P(pkt, 1, in->buf, sizeof(pkt_buf)); + PACKET_POOL_P(pkt, 1, in->buf, in->buf_size); packet_add(pkt, l2len, (char *)eh); if (dhcp(c, pkt)) @@ -810,7 +810,7 @@ resume: } if (proto == IPPROTO_ICMPV6) { - PACKET_POOL_P(pkt, 1, in->buf, sizeof(pkt_buf)); + PACKET_POOL_P(pkt, 1, in->buf, in->buf_size); if (c->no_icmp) continue; @@ -834,7 +834,7 @@ resume: uh = (struct udphdr *)l4h; if (proto == IPPROTO_UDP) { - PACKET_POOL_P(pkt, 1, in->buf, sizeof(pkt_buf)); + PACKET_POOL_P(pkt, 1, in->buf, in->buf_size); packet_add(pkt, l4len, l4h); |