aboutgitcodebugslistschat
diff options
context:
space:
mode:
authorLaurent Vivier <lvivier@redhat.com>2024-06-13 14:36:55 +0200
committerStefano Brivio <sbrivio@redhat.com>2024-06-13 15:45:42 +0200
commit4070bac7a48f92041617363a5e94ab760ba72073 (patch)
treeff1e92f175f133b5601c5f2256fe1775acfb83de
parent7290335b146c61495178c73310bc6727608988cc (diff)
downloadpasst-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.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/tap.c b/tap.c
index 2a74980..c9aeff1 100644
--- a/tap.c
+++ b/tap.c
@@ -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);