aboutgitcodebugslistschat
path: root/arp.c
diff options
context:
space:
mode:
authorDavid Gibson <david@gibson.dropbear.id.au>2024-03-08 17:53:24 +1100
committerStefano Brivio <sbrivio@redhat.com>2024-03-14 16:57:37 +0100
commit4db947d17c8c7dac3b344c8ce0a266f7be159200 (patch)
tree5db310fa193a86befdf4df2ff940aa6aeed59f82 /arp.c
parent1ebe787fe460eb83d67792b6af1b02f4f555dc86 (diff)
downloadpasst-4db947d17c8c7dac3b344c8ce0a266f7be159200.tar
passt-4db947d17c8c7dac3b344c8ce0a266f7be159200.tar.gz
passt-4db947d17c8c7dac3b344c8ce0a266f7be159200.tar.bz2
passt-4db947d17c8c7dac3b344c8ce0a266f7be159200.tar.lz
passt-4db947d17c8c7dac3b344c8ce0a266f7be159200.tar.xz
passt-4db947d17c8c7dac3b344c8ce0a266f7be159200.tar.zst
passt-4db947d17c8c7dac3b344c8ce0a266f7be159200.zip
tap: Implement tap_send() "slow path" in terms of fast path
Most times we send frames to the guest it goes via tap_send_frames(). However "slow path" protocols - ARP, ICMP, ICMPv6, DHCP and DHCPv6 - go via tap_send(). As well as being a semantic duplication, tap_send() contains at least one serious problem: it doesn't properly handle short sends, which can be fatal on the qemu socket connection, since frame boundaries will get out of sync. Rewrite tap_send() to call tap_send_frames(). While we're there, rename it tap_send_single() for clarity. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Diffstat (limited to 'arp.c')
-rw-r--r--arp.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/arp.c b/arp.c
index a35c1b6..113cda2 100644
--- a/arp.c
+++ b/arp.c
@@ -44,7 +44,6 @@ int arp(const struct ctx *c, const struct pool *p)
struct arphdr *ah;
struct arpmsg *am;
size_t len;
- int ret;
eh = packet_get(p, 0, 0, sizeof(*eh), NULL);
ah = packet_get(p, 0, sizeof(*eh), sizeof(*ah), NULL);
@@ -83,8 +82,7 @@ int arp(const struct ctx *c, const struct pool *p)
memcpy(eh->h_dest, eh->h_source, sizeof(eh->h_dest));
memcpy(eh->h_source, c->mac, sizeof(eh->h_source));
- if ((ret = tap_send(c, eh, len)) < 0)
- warn("ARP: send: %s", strerror(ret));
+ tap_send_single(c, eh, len);
return 1;
}