I was setting up a VM pf firewall and noticed I was not able to nat out for some reason. Looking at the pcap, it seems when the vm is in forwarding mode, I get tcp checksum errors. If I do a ifconfig vtnet1 -rxcsum ifconfig vtnet0 -rxcsum nat then seems to work fine The setup is a simple VM with the hypervisor libvirt/KVM ubuntu 20 LTS. Guest is RELENG_13 from Apr 11/2022 e.g. vtnet1 is facing another internal VM. If I try and connect to the internal NIC vtnet1 (192.168.199.7) I dont get any errors. But if I try and get out via nat, it fails. If I switch both nics to Intel em NICs, it works without modification public_internet <---> vtnet0-vtnet1 <---> another guest vm vtnet0 = public IP vtnet1 = 192.168.199.7/24 guest = 192.168.199.100 tcpdump -s0 -vnei vtnet1 port 443 tcpdump: listening on vtnet1, link-type EN10MB (Ethernet), capture size 262144 bytes 18:35:05.937364 52:54:00:b6:ae:7b > 52:54:00:09:6e:82, ethertype IPv4 (0x0800), length 74: (tos 0x10, ttl 64, id 64547, offset 0, flags [DF], proto TCP (6), length 60) 192.168.199.100.56996 > 172.217.1.4.443: Flags [S], cksum 0x3619 (incorrect -> 0x4755), seq 2994289493, win 64240, options [mss 1460,sackOK,TS val 1606656477 ecr 0,nop,wscale 7], length 0 18:35:06.939305 52:54:00:b6:ae:7b > 52:54:00:09:6e:82, ethertype IPv4 (0x0800), length 74: (tos 0x10, ttl 64, id 64548, offset 0, flags [DF], proto TCP (6), length 60) 192.168.199.100.56996 > 172.217.1.4.443: Flags [S], cksum 0x3619 (incorrect -> 0x436b), seq 2994289493, win 64240, options [mss 1460,sackOK,TS val 1606657479 ecr 0,nop,wscale 7], length 0 18:35:21.040936 52:54:00:b6:ae:7b > 52:54:00:09:6e:82, ethertype IPv4 (0x0800), length 74: (tos 0x10, ttl 64, id 45298, offset 0, flags [DF], proto TCP (6), length 60) 192.168.199.100.59876 > 192.168.199.7.443: Flags [S], cksum 0x0fec (incorrect -> 0xf8f6), seq 1122263205, win 64240, options [mss 1460,sackOK,TS val 2124691085 ecr 0,nop,wscale 7], length 0 18:35:21.040993 52:54:00:09:6e:82 > 52:54:00:b6:ae:7b, ethertype IPv4 (0x0800), length 74: (tos 0x0, ttl 64, id 0, offset 0, flags [DF], proto TCP (6), length 60) 192.168.199.7.443 > 192.168.199.100.59876: Flags [S.], cksum 0x0fec (incorrect -> 0x5be5), seq 3948792593, ack 1122263206, win 65535, options [mss 1460,nop,wscale 6,sackOK,TS val 2270714410 ecr 2124691085], length 0 18:35:21.041224 52:54:00:b6:ae:7b > 52:54:00:09:6e:82, ethertype IPv4 (0x0800), length 66: (tos 0x10, ttl 64, id 45299, offset 0, flags [DF], proto TCP (6), length 52) 192.168.199.100.59876 > 192.168.199.7.443: Flags [.], cksum 0x0fe4 (incorrect -> 0x88b9), ack 1, win 502, options [nop,nop,TS val 2124691086 ecr 2270714410], length 0 18:35:22.843871 52:54:00:b6:ae:7b > 52:54:00:09:6e:82, ethertype IPv4 (0x0800), length 66: (tos 0x10, ttl 64, id 45300, offset 0, flags [DF], proto TCP (6), length 52) 192.168.199.100.59876 > 192.168.199.7.443: Flags [F.], cksum 0x0fe4 (incorrect -> 0x81ae), seq 1, ack 1, win 502, options [nop,nop,TS val 2124692888 ecr 2270714410], length 0 18:35:22.843910 52:54:00:09:6e:82 > 52:54:00:b6:ae:7b, ethertype IPv4 (0x0800), length 66: (tos 0x0, ttl 64, id 0, offset 0, flags [DF], proto TCP (6), length 52) 192.168.199.7.443 > 192.168.199.100.59876: Flags [.], cksum 0x0fe4 (incorrect -> 0x7895), ack 2, win 1027, options [nop,nop,TS val 2270716214 ecr 2124692888], length 0 18:35:22.843980 52:54:00:09:6e:82 > 52:54:00:b6:ae:7b, ethertype IPv4 (0x0800), length 66: (tos 0x0, ttl 64, id 0, offset 0, flags [DF], proto TCP (6), length 52) 192.168.199.7.443 > 192.168.199.100.59876: Flags [F.], cksum 0x0fe4 (incorrect -> 0x7894), seq 1, ack 2, win 1027, options [nop,nop,TS val 2270716214 ecr 2124692888], length 0 18:35:22.844159 52:54:00:b6:ae:7b > 52:54:00:09:6e:82, ethertype IPv4 (0x0800), length 66: (tos 0x10, ttl 64, id 0, offset 0, flags [DF], proto TCP (6), length 52) 192.168.199.100.59876 > 192.168.199.7.443: Flags [.], cksum 0x7aa0 (correct), ack 2, win 502, options [nop,nop,TS val 2124692889 ecr 2270716214], length 0 e.g. after disabling rxcsum (ifconfig vtnet1 -rxcsum ifconfig vtnet0 -rxcsum) tcpdump: listening on vtnet1, link-type EN10MB (Ethernet), capture size 262144 bytes 18:39:57.425940 52:54:00:b6:ae:7b > 52:54:00:09:6e:82, ethertype IPv4 (0x0800), length 74: (tos 0x10, ttl 64, id 53398, offset 0, flags [DF], proto TCP (6), length 60) 192.168.199.101.55810 > 142.251.32.68.443: Flags [S], cksum 0x5467 (correct), seq 2136333436, win 64240, options [mss 1460,sackOK,TS val 2746738194 ecr 0,nop,wscale 7], length 0 18:39:57.432020 52:54:00:09:6e:82 > 52:54:00:b6:ae:7b, ethertype IPv4 (0x0800), length 74: (tos 0x0, ttl 123, id 58394, offset 0, flags [none], proto TCP (6), length 60) 142.251.32.68.443 > 192.168.199.101.55810: Flags [S.], cksum 0xa929 (correct), seq 292800283, ack 2136333437, win 65535, options [mss 1430,sackOK,TS val 460829236 ecr 2746738194,nop,wscale 8], length 0 18:39:57.432265 52:54:00:b6:ae:7b > 52:54:00:09:6e:82, ethertype IPv4 (0x0800), length 66: (tos 0x10, ttl 64, id 53399, offset 0, flags [DF], proto TCP (6), length 52) 192.168.199.101.55810 > 142.251.32.68.443: Flags [.], cksum 0xd5dc (correct), ack 1, win 502, options [nop,nop,TS val 2746738200 ecr 460829236], length 0 18:39:58.605990 52:54:00:b6:ae:7b > 52:54:00:09:6e:82, ethertype IPv4 (0x0800), length 66: (tos 0x10, ttl 64, id 53400, offset 0, flags [DF], proto TCP (6), length 52) 192.168.199.101.55810 > 142.251.32.68.443: Flags [F.], cksum 0xd145 (correct), seq 1, ack 1, win 502, options [nop,nop,TS val 2746739374 ecr 460829236], length 0 18:39:58.612128 52:54:00:09:6e:82 > 52:54:00:b6:ae:7b, ethertype IPv4 (0x0800), length 66: (tos 0x0, ttl 123, id 58984, offset 0, flags [none], proto TCP (6), length 52) 142.251.32.68.443 > 192.168.199.101.55810: Flags [F.], cksum 0xcd9e (correct), seq 1, ack 2, win 256, options [nop,nop,TS val 460830416 ecr 2746739374], length 0 18:39:58.612402 52:54:00:b6:ae:7b > 52:54:00:09:6e:82, ethertype IPv4 (0x0800), length 66: (tos 0x10, ttl 64, id 53401, offset 0, flags [DF], proto TCP (6), length 52) 192.168.199.101.55810 > 142.251.32.68.443: Flags [.], cksum 0xcca2 (correct), ack 2, win 502, options [nop,nop,TS val 2746739380 ecr 460830416], length 0 I am guessing txcsum is fine as I can connect out from the FreeBSD VM, so packets originating on the firewall's vtnet0 interface is ok.
Actually this looks related to this long standing bug :( https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=165059
I'm having the same issue on FreeBSD 15 running on LXD (qemu/kvm). In my case DHCP fails with the error below. Disabling RXCSUM makes it work immediately. vtnet0: flags=1008802<BROADCAST,SIMPLEX,MULTICAST,LOWER_UP> metric 0 mtu 1500 options=4c07bb<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,JUMBO_MTU,VLAN_HWCSUM,TSO4,TSO6,LRO,VLAN_HWTSO,LINKSTATE,TXCSUM_IPV6> ether 00:16:3e:e2:a7:60 media: Ethernet autoselect (10Gbase-T <full-duplex>) status: active nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL> lo0: flags=1008049<UP,LOOPBACK,RUNNING,MULTICAST,LOWER_UP> metric 0 mtu 16384 options=680003<RXCSUM,TXCSUM,LINKSTATE,RXCSUM_IPV6,TXCSUM_IPV6> inet 127.0.0.1 netmask 0xff000000 inet6 ::1 prefixlen 128 inet6 fe80::1%lo0 prefixlen 64 scopeid 0x2 groups: lo nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL> root@:/mnt/root # dhclient vtnet0 DHCPDISCOVER on vtnet0 to 255.255.255.255 port 67 interval 4 DHCPDISCOVER on vtnet0 to 255.255.255.255 port 67 interval 6 DHCPDISCOVER on vtnet0 to 255.255.255.255 port 67 interval 9 DHCPDISCOVER on vtnet0 to 255.255.255.255 port 67 interval 9 DHCPDISCOVER on vtnet0 to 255.255.255.255 port 67 interval 13 5 bad udp checksums in 5 packets DHCPDISCOVER on vtnet0 to 255.255.255.255 port 67 interval 13 ^C root@:/mnt/root # ifconfig vtnet0 -rxcsum root@:/mnt/root # dhclient vtnet0 DHCPDISCOVER on vtnet0 to 255.255.255.255 port 67 interval 3 DHCPOFFER from 10.86.126.1 DHCPREQUEST on vtnet0 to 255.255.255.255 port 67 DHCPACK from 10.86.126.1 bound to 10.86.126.96 -- renewal in 1800 seconds.
Same issue here on Proxmox 9.0.5
Please retest, since I think this has been fixed in FreeBSD main.
(In reply to Michael Tuexen from comment #4) Thanks for looking at this long standing issue! if I backport this commit https://cgit.freebsd.org/src/commit/?id=1c23d8f9f39870951c1d0dfbb112fc4e53237737 to releng_14 does it depend on anything else in HEAD ? Its easier for me to test in RELENG_14 than HEAD right now
(In reply to mike from comment #5) I think this is a sequence of commits: * https://cgit.FreeBSD.org/src/commit/?id=bcb298fa9e23c1192c5707086a67d3b396186abc * https://cgit.FreeBSD.org/src/commit/?id=ac87d70563f85d53575956c6fe40615b2e501c13 * https://cgit.FreeBSD.org/src/commit/?id=3077532b1bb2911d3012ee90bae9d9499c960569 * https://cgit.FreeBSD.org/src/commit/?id=c7263f873ee9abb772f67b5536e2380a046e1b94 * https://cgit.FreeBSD.org/src/commit/?id=03da4395158d374b5e38623f6744ce31302b530c * https://cgit.FreeBSD.org/src/commit/?id=e6253eac1ab346d70db79d638c200bffa65cae02 * https://cgit.FreeBSD.org/src/commit/?id=491986942dd2b3be8a6f232c487b3bb7c1ea412b * https://cgit.FreeBSD.org/src/commit/?id=1c23d8f9f39870951c1d0dfbb112fc4e53237737 The first and the last commit are crucial. The other ones are included to minimize merge conflicts. Except for the last commit, I can MFC them to stable/14 if that helps. Please let me know.
(In reply to Michael Tuexen from comment #6) If you can generate a patch against RELENG_14, that would be the safest way for me to test and confirm. Thank you again on looking at this issue!
Hi, I just updated and rebuilt my kernel and I'm still seeing the same problem on main: root@freebsd:~ # ifconfig vtnet0: flags=1008843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST,LOWER_UP> metric 0 mtu 1500 options=4c07bb<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,JUMBO_MTU,VLAN_HWCSUM,TSO4,TSO6,LRO,VLAN_HWTSO,LINKSTATE,TXCSUM_IPV6> ether 00:16:3e:10:64:20 inet6 fe80::216:3eff:fe10:6420%vtnet0 prefixlen 64 scopeid 0x1 media: Ethernet autoselect (10Gbase-T <full-duplex>) status: active nd6 options=23<PERFORMNUD,ACCEPT_RTADV,AUTO_LINKLOCAL> lo0: flags=1008049<UP,LOOPBACK,RUNNING,MULTICAST,LOWER_UP> metric 0 mtu 16384 options=680003<RXCSUM,TXCSUM,LINKSTATE,RXCSUM_IPV6,TXCSUM_IPV6> inet 127.0.0.1 netmask 0xff000000 inet6 ::1 prefixlen 128 inet6 fe80::1%lo0 prefixlen 64 scopeid 0x2 groups: lo nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL> root@freebsd:~ # dhclient vtnet0 DHCPREQUEST on vtnet0 to 255.255.255.255 port 67 DHCPREQUEST on vtnet0 to 255.255.255.255 port 67 DHCPDISCOVER on vtnet0 to 255.255.255.255 port 67 interval 4 DHCPDISCOVER on vtnet0 to 255.255.255.255 port 67 interval 4 DHCPDISCOVER on vtnet0 to 255.255.255.255 port 67 interval 6 5 bad udp checksums in 5 packets DHCPDISCOVER on vtnet0 to 255.255.255.255 port 67 interval 10 DHCPDISCOVER on vtnet0 to 255.255.255.255 port 67 interval 18 DHCPDISCOVER on vtnet0 to 255.255.255.255 port 67 interval 7 DHCPDISCOVER on vtnet0 to 255.255.255.255 port 67 interval 7 DHCPDISCOVER on vtnet0 to 255.255.255.255 port 67 interval 4 5 bad udp checksums in 5 packets No DHCPOFFERS received. Trying recorded lease 10.86.126.93 bound: renewal in 601 seconds. When I disable rxcsum and txcsum it works again.
Oh, wait. Even though dhclient fails with bad udp checksum, once the interface has an IP assigned after the timeout, everything else seems to work fine. root@freebsd:~ # dhclient vtnet0 DHCPREQUEST on vtnet0 to 255.255.255.255 port 67 DHCPREQUEST on vtnet0 to 255.255.255.255 port 67 DHCPREQUEST on vtnet0 to 255.255.255.255 port 67 DHCPDISCOVER on vtnet0 to 255.255.255.255 port 67 interval 8 DHCPDISCOVER on vtnet0 to 255.255.255.255 port 67 interval 12 5 bad udp checksums in 5 packets DHCPDISCOVER on vtnet0 to 255.255.255.255 port 67 interval 7 DHCPDISCOVER on vtnet0 to 255.255.255.255 port 67 interval 12 DHCPDISCOVER on vtnet0 to 255.255.255.255 port 67 interval 16 DHCPDISCOVER on vtnet0 to 255.255.255.255 port 67 interval 6 No DHCPOFFERS received. Trying recorded lease 10.86.126.93 bound: renewal in 1286 seconds. root@freebsd:~ # ping -c 5 freebsd.org PING freebsd.org (96.47.72.84): 56 data bytes 64 bytes from 96.47.72.84: icmp_seq=0 ttl=51 time=117.169 ms 64 bytes from 96.47.72.84: icmp_seq=1 ttl=51 time=110.150 ms 64 bytes from 96.47.72.84: icmp_seq=2 ttl=51 time=130.459 ms 64 bytes from 96.47.72.84: icmp_seq=3 ttl=51 time=123.061 ms 64 bytes from 96.47.72.84: icmp_seq=4 ttl=51 time=138.597 ms --- freebsd.org ping statistics --- 5 packets transmitted, 5 packets received, 0.0% packet loss round-trip min/avg/max/stddev = 110.150/123.887/138.597/9.941 ms root@freebsd:~ # curl freebsd.org <html> <head><title>301 Moved Permanently</title></head> <body> <center><h1>301 Moved Permanently</h1></center> <hr><center>nginx</center> </body> </html>
(In reply to mike from comment #7) OK. Give me a day or two. Need to test that.
(In reply to Danilo Egea Gondolfo from comment #9) Can you post the output of sysctl dev.vtnet.0 We need to look at dhclient. Maybe it is no relying on the standard UDP input / ouput path...
(In reply to Michael Tuexen from comment #11) OK, I looked at the code. The dhclient does not work, if packets are received which are still marked for UDP checksum offloading. The work around is to disable receive checksum offloading. Give me a day or two to come up with a patch for dhclient to work in this setup.
Created attachment 263490 [details] Patch for dhclient
(In reply to Danilo Egea Gondolfo from comment #9) Hi Danilo, could you try the patch for dhclient I just attached? Since I can't reproduce your issue, I could not test it. So please report if it fixes the DHCP issue you are observing. Thanks for your help. Best regards Michael
Hi Michael, Yes, it does fix it. Thanks! I'm just curious, is it the expected behavior to get a packet without checksum when you're using SOCK_RAW and offloading?
(In reply to Danilo Egea Gondolfo from comment #15) Thanks for testing. I will put it up for review. It is possible to receive a SCTP/TCP/UDP packet, where the checksum is not yet computed. There is meta information available about this status. If you receive such packets via SCTP/TCP/UDP sockets, everything will be handled correctly. Please note that you can't receive TCP/UDP packets via raw sockets (the same applies to SCTP if the kernel module is loaded). The point here is that the dhclient doesn't use a UDP socket, but a bpf device. This passes the packet up as is without the metainformation. So the information that the checksum has not been computed is lost in this case. With the patch the checksum validation of received UDP packets accepts packets where the checksum field contains: (1) zero. (2) the correct checksum. (3) the correct pseudoheader checksum. (3) is new and corresponds to the case where the checksum is not computed yet. Does this makes things cleaner?
Yes, thanks a lot Michael :)
(In reply to Danilo Egea Gondolfo from comment #17) Could you also try the patch at review D52394? Is adds some more improvements... Thanks for your help.
(In reply to Michael Tuexen from comment #18) I tried it, it works just fine. Thanks.
(In reply to Danilo Egea Gondolfo from comment #19) Thanks for the confirmation.
(In reply to mike from comment #7) Are you referring to the stable/14 branch or the releng/14.3 branch? I am not aware of a RELENG_14 branch...
(In reply to Michael Tuexen from comment #21) Sorry, stable/14
(In reply to mike from comment #22) OK, that makes things simple. I MFC'ed all prerequisites to stable/14. So the only thing you need to do is: git cherry-pick -x 3008f30d2c2cabdd7e17f7fb922139da8681ffbd Please not that I reverted some commits since I got the author wrong. No change in the actual context. I plan to MFC the fix to stable/14 and stable/15 in three days. Please test and report if you experience any issues.
A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=187ee62c71f2be62870f26ae98de865e330121be commit 187ee62c71f2be62870f26ae98de865e330121be Author: Michael Tuexen <tuexen@FreeBSD.org> AuthorDate: 2025-09-10 15:13:35 +0000 Commit: Michael Tuexen <tuexen@FreeBSD.org> CommitDate: 2025-09-10 15:19:23 +0000 dhclient: improve UDP checksum handling When sending UDP packets: * compute the checksum in the correct order. This only has an impact if the length of the payload is odd. * don't send packet with a checksum of zero, use 0xffff instead as required. When receiving UDP packets: * don't do any computations when the checksum is zero. * compute the checksum in the correct order. This only has an impact if the length of the payload is odd. * when computing the checksum, store the pseudo header checksum * if the checksum is computed as zero, use 0xffff instead. * also accept packets, when the checksum in the packet is the pseudo header checksum. The last point fixes a problem when the DHCP client runs in a VM, the DHCP server runs on the host serving the VM and the network interface supports transmit checksum offloading. Since dhclient doesn't use UDP sockets but bpf devices to read the packets, the checksum will be incorrect and only contain the checksum of the pseudo header. PR: 263229 Reviewed by: markj, Timo Völker Tested by: danilo MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D52394 sbin/dhclient/packet.c | 53 +++++++++++++++++++++++++++++++++----------------- 1 file changed, 35 insertions(+), 18 deletions(-)
(In reply to mike from comment #22) The fix is now in main, stable/14, and stable/15. Please test and report if the issue you reported is fixed or not. If not, I would like to investigate...
(In reply to Michael Tuexen from comment #25) Just to be crystal clear: this bug report covers (in my understanding) two issues: * a generic vtnet checksum issue * a dhclient specific issue Both the fixed with different patches.
Created attachment 263708 [details] results of vtnet output Thank you for all the efforts here Michael, I (and I am sure the wider FreeBSD community) appreciate it greatly!! TLDR; maybe a problem with LRO still ? I set up 2 VMs R14 and R15 both with 2 interfaces and am using iperf3 to test speeds R14 and R15 share 192.168.122.0/24 as a common subnet iperf3 between 192.168.122.0/24 looks good at expected speeds doing both iperf3 -R -c 192.168.122.3 and iperf3 -c 192.168.122.3 gives between 15Gb/s and 18Gb/s which is great From R14 to an outside server on gigabit gets about gigabit in both directions which is typical From R15 to an outside server on gigabit gets about gigabit in both directions which is typical from R15 that is routed across R14's 192.168.122.0/24 network however, I am getting 2-3Mb/s If I ifconfig vtnet0 -lro ifconfig vtnet1 -lro on the R14 box acting as a router, all works at expected speeds If I reverse the jobs or R14 and R15 so that R15 acts as the router, it is the same issue. I have to do both interfaces for both directions to work otherwise just one direction gets full speed.
(In reply to mike from comment #27) Hi Mike, thanks for testing. Let me see if I can reproduce the problem locally... Timo (who is doing most of the work) and myself will look into LRO. Best regards Michael
(In reply to mike from comment #27) I can reproduce the problem. I am not sure if the problem is vtnet specific. LRO is a feature which improves the performance of a host. But if a node acts as a router, you don't want LRO, since you want to see every packet. However, I have not found this clearly documented in the man pages. I also don't know yet, if there is anything which could be done in vtnet (or and other network driver).
I am fine with closing this PR as the main issue with checksum offloading seems fixed. I guess the larger question is should routing performance be impacted so significantly. I havent done any tests in a while, but I dont recall if using em nics in a VM have the same negative impact or not. For my use case, turning off LRO when using a VM as a firewall/router just becomes a tuneable for me. But I imagine others *might* run into this and not know that needs to be done ?
(In reply to mike from comment #30) I guess setting hw.vtnet.lro_disable=1 in /boot/loader.conf on a box intended for forwarding should fix the issue. I agree, that we can close this issue, since the checksum issues in vtnet and dhclient are fixed. I would just like to understand if there is a generic problem and if that is the case, this should be documented at least.
A commit in branch stable/15 references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=1162a78e0d403c4619dae3fed99ce9a923bc4795 commit 1162a78e0d403c4619dae3fed99ce9a923bc4795 Author: Michael Tuexen <tuexen@FreeBSD.org> AuthorDate: 2025-09-10 15:13:35 +0000 Commit: Michael Tuexen <tuexen@FreeBSD.org> CommitDate: 2025-09-14 20:15:57 +0000 dhclient: improve UDP checksum handling When sending UDP packets: * compute the checksum in the correct order. This only has an impact if the length of the payload is odd. * don't send packet with a checksum of zero, use 0xffff instead as required. When receiving UDP packets: * don't do any computations when the checksum is zero. * compute the checksum in the correct order. This only has an impact if the length of the payload is odd. * when computing the checksum, store the pseudo header checksum * if the checksum is computed as zero, use 0xffff instead. * also accept packets, when the checksum in the packet is the pseudo header checksum. The last point fixes a problem when the DHCP client runs in a VM, the DHCP server runs on the host serving the VM and the network interface supports transmit checksum offloading. Since dhclient doesn't use UDP sockets but bpf devices to read the packets, the checksum will be incorrect and only contain the checksum of the pseudo header. PR: 263229 Reviewed by: markj, Timo Völker Tested by: danilo Differential Revision: https://reviews.freebsd.org/D52394 (cherry picked from commit 187ee62c71f2be62870f26ae98de865e330121be) sbin/dhclient/packet.c | 53 +++++++++++++++++++++++++++++++++----------------- 1 file changed, 35 insertions(+), 18 deletions(-)
A commit in branch stable/14 references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=ffd956a3918cd5e64c8850eb77247428a29f7221 commit ffd956a3918cd5e64c8850eb77247428a29f7221 Author: Michael Tuexen <tuexen@FreeBSD.org> AuthorDate: 2025-09-10 15:13:35 +0000 Commit: Michael Tuexen <tuexen@FreeBSD.org> CommitDate: 2025-09-14 20:33:24 +0000 dhclient: improve UDP checksum handling When sending UDP packets: * compute the checksum in the correct order. This only has an impact if the length of the payload is odd. * don't send packet with a checksum of zero, use 0xffff instead as required. When receiving UDP packets: * don't do any computations when the checksum is zero. * compute the checksum in the correct order. This only has an impact if the length of the payload is odd. * when computing the checksum, store the pseudo header checksum * if the checksum is computed as zero, use 0xffff instead. * also accept packets, when the checksum in the packet is the pseudo header checksum. The last point fixes a problem when the DHCP client runs in a VM, the DHCP server runs on the host serving the VM and the network interface supports transmit checksum offloading. Since dhclient doesn't use UDP sockets but bpf devices to read the packets, the checksum will be incorrect and only contain the checksum of the pseudo header. PR: 263229 Reviewed by: markj, Timo Völker Tested by: danilo Differential Revision: https://reviews.freebsd.org/D52394 (cherry picked from commit 187ee62c71f2be62870f26ae98de865e330121be) sbin/dhclient/packet.c | 53 +++++++++++++++++++++++++++++++++----------------- 1 file changed, 35 insertions(+), 18 deletions(-)
(In reply to mike from comment #30) OK, I now understand what was going on: * When you have enabled hardware LRO on the vtnet driver, you forward too large packets. They trigger an ICMP response (packet too big), which is ignored, because the sender is honoring already the MTU. * The sender is doing TSO, which is generating the too large packets. However, not all packets where actually TSOed. This is fixed in: https://cgit.FreeBSD.org/src/commit/?id=1bb72d3d6eee50232b6d6acbc201f9aaac93e2b5 Now the throughput will be even less in your problematic scenario. * The crucial point is that hardware LRO should be turned off by default, and software LRO should be turned on by default. This does not interfere with IP forwarding. This is something also done by other NIC drivers supporting hardware and software LRO. The patch is under review D52684. With that you setup works just fine in the default setup (as it should). * Finally there is some cleanup to actually announce receive checksum offloading for IPv6 in review D52682. Once that is reviewed and committed, I will close this PR.
A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=6e4b811009d63f33c59d51f28fd4a030ca90843e commit 6e4b811009d63f33c59d51f28fd4a030ca90843e Author: Michael Tuexen <tuexen@FreeBSD.org> AuthorDate: 2025-09-29 23:58:37 +0000 Commit: Michael Tuexen <tuexen@FreeBSD.org> CommitDate: 2025-09-30 00:03:49 +0000 vtnet: disable hardware TCP LRO by default Hardware TCP LRO results in problems in settings with IP forwarding being enabled. In case of nodes without IP forwarding, using software LRO is also beneficial in general, since it can provide better information about what was received on the wire. Therefore, disable hardware TCP LRO by default. By tuning the loader tunable, this can be changed. PR: 263229 Reviewed by: Timo Völker MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D52684 share/man/man4/vtnet.4 | 22 +++++++++++++++++----- sys/dev/virtio/network/if_vtnet.c | 2 +- 2 files changed, 18 insertions(+), 6 deletions(-)
A commit in branch stable/14 references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=3d548504c705ac9a38a0fee2e85985340c1fe488 commit 3d548504c705ac9a38a0fee2e85985340c1fe488 Author: Michael Tuexen <tuexen@FreeBSD.org> AuthorDate: 2025-09-29 23:58:37 +0000 Commit: Michael Tuexen <tuexen@FreeBSD.org> CommitDate: 2025-10-03 08:28:45 +0000 vtnet: disable hardware TCP LRO by default Hardware TCP LRO results in problems in settings with IP forwarding being enabled. In case of nodes without IP forwarding, using software LRO is also beneficial in general, since it can provide better information about what was received on the wire. Therefore, disable hardware TCP LRO by default. By tuning the loader tunable, this can be changed. PR: 263229 Reviewed by: Timo Völker Differential Revision: https://reviews.freebsd.org/D52684 (cherry picked from commit 6e4b811009d63f33c59d51f28fd4a030ca90843e) share/man/man4/vtnet.4 | 22 +++++++++++++++++----- sys/dev/virtio/network/if_vtnet.c | 2 +- 2 files changed, 18 insertions(+), 6 deletions(-)
A commit in branch stable/15 references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=e1a7840dd941f5bf320f474a34f2f6d891cdaf66 commit e1a7840dd941f5bf320f474a34f2f6d891cdaf66 Author: Michael Tuexen <tuexen@FreeBSD.org> AuthorDate: 2025-09-29 23:58:37 +0000 Commit: Michael Tuexen <tuexen@FreeBSD.org> CommitDate: 2025-10-03 08:34:08 +0000 vtnet: disable hardware TCP LRO by default Hardware TCP LRO results in problems in settings with IP forwarding being enabled. In case of nodes without IP forwarding, using software LRO is also beneficial in general, since it can provide better information about what was received on the wire. Therefore, disable hardware TCP LRO by default. By tuning the loader tunable, this can be changed. PR: 263229 Reviewed by: Timo Völker Differential Revision: https://reviews.freebsd.org/D52684 (cherry picked from commit 6e4b811009d63f33c59d51f28fd4a030ca90843e) share/man/man4/vtnet.4 | 22 +++++++++++++++++----- sys/dev/virtio/network/if_vtnet.c | 2 +- 2 files changed, 18 insertions(+), 6 deletions(-)
FreeBSD current, stable/15, and stable/14 should now work out of the box without any configuration change.
If the problems reported here still do exist, please reopen.