aboutgitcodebugslistschat
path: root/udp.c
diff options
context:
space:
mode:
authorLaurent Vivier <lvivier@redhat.com>2022-11-08 21:16:46 +0100
committerLaurent Vivier <lvivier@redhat.com>2024-03-12 11:54:26 +0100
commit37f457a76c8f412a0a2ceb79c77b91eea24ef341 (patch)
tree9922b7899d7c28b5995c4c6b9f750870b7c241e4 /udp.c
parentb2229bd24ffc75b2538073958221e1ae82ac0767 (diff)
downloadpasst-37f457a76c8f412a0a2ceb79c77b91eea24ef341.tar
passt-37f457a76c8f412a0a2ceb79c77b91eea24ef341.tar.gz
passt-37f457a76c8f412a0a2ceb79c77b91eea24ef341.tar.bz2
passt-37f457a76c8f412a0a2ceb79c77b91eea24ef341.tar.lz
passt-37f457a76c8f412a0a2ceb79c77b91eea24ef341.tar.xz
passt-37f457a76c8f412a0a2ceb79c77b91eea24ef341.tar.zst
passt-37f457a76c8f412a0a2ceb79c77b91eea24ef341.zip
vhost-user: add vhost-user
add virtio and vhost-user functions to connect with QEMU. $ ./passt --vhost-user and # qemu-system-x86_64 ... -m 4G \ -object memory-backend-memfd,id=memfd0,share=on,size=4G \ -numa node,memdev=memfd0 \ -chardev socket,id=chr0,path=/tmp/passt_1.socket \ -netdev vhost-user,id=netdev0,chardev=chr0 \ -device virtio-net,mac=9a:2b:2c:2d:2e:2f,netdev=netdev0 \ ... Signed-off-by: Laurent Vivier <lvivier@redhat.com>
Diffstat (limited to 'udp.c')
-rw-r--r--udp.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/udp.c b/udp.c
index de5313d..8c8f7c3 100644
--- a/udp.c
+++ b/udp.c
@@ -681,9 +681,12 @@ static size_t udp_update_hdr6(const struct ctx *c, struct ipv6hdr *ip6h,
uh->dest = htons(dstport);
uh->len = ip6h->payload_len;
uh->check = 0;
- uh->check = csum(uh, payload_len,
- proto_ipv6_header_psum(payload_len, IPPROTO_UDP,
- src, dst));
+ if (c->mode != MODE_VU || *c->pcap)
+ uh->check = csum(uh, payload_len,
+ proto_ipv6_header_psum(payload_len, IPPROTO_UDP,
+ src, dst));
+ else
+ uh->check = 0xffff; /* zero checksum is invalid with IPv6 */
return ip_len;
}