Commit graph

293733 commits

Author SHA1 Message Date
Olivier BLANC
5c2ebd3ad6 igmp: apply net.inet.igmp.default_version to existing interfaces
IGMP requires hosts to use the lowest version they have seen on the network.
When net.inet.igmp.default_version is changed, we do not change IGMP
version used by interface even if the interface use an higher version than
V_igmp_default_version. So we could send IGMPv3 even if the user has requested
IGMPv2 or IGMPv1 via the sysctl.

Change IGMP version for each interface when V_igmp_default_version is smaller
than the version used by the interface.

Pull Request:	https://github.com/freebsd/freebsd-src/pull/1615
Differential Revision:	https://reviews.freebsd.org/D50071
2026-02-11 10:12:58 +01:00
Kristof Provost
ca941d769a igmp: do not upgrade IGMP version beyond net.inet.igmp.default_version
IGMP requires hosts to use the lowest version they've seen on the
network. When the IGMP timers expire we take the opportunity to upgrade again.
However, we did not take the net.inet.igmp.default_version sysctl
setting into account, so we could end up switching to IGMPv3 even if the
user had requested IGMPv2 or IGMPv1 via the sysctl.

Check V_igmp_default_version before we upgrade the IGMP version.

Reviewed by:	adrian
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D41628
2026-02-11 10:12:54 +01:00
Mark Johnston
c961e158e2 Add UPDATING entries and bump patch version
Approved by:	so
2026-01-28 07:36:34 +01:00
Gordon Tetlow
401deecfd9 openssl: Fix multiple vulnerabilities
This is a rollup commit from upstream to fix:
  Stack buffer overflow in CMS AuthEnvelopedData parsing (CVE-2025-15467)
  Heap out-of-bounds write in BIO_f_linebuffer on short writes (CVE-2025-68160)
  Unauthenticated/unencrypted trailing bytes with low-level OCB function calls (CVE-2025-69418)
  Out of bounds write in PKCS12_get_friendlyname() UTF-8 conversion (CVE-2025-69419)
  Missing ASN1_TYPE validation in TS_RESP_verify_response() function (CVE-2025-69420)
  NULL Pointer Dereference in PKCS12_item_decrypt_d2i_ex function (CVE-2025-69421)
  Missing ASN1_TYPE validation in PKCS#12 parsing (CVE-2026-22795)
  ASN1_TYPE Type Confusion in the PKCS7_digest_from_attributes() function (CVE-2026-22796)

See https://openssl-library.org/news/secadv/ for additional details.

Approved by:	so
Obtained from:	OpenSSL
Security:	FreeBSD-SA-26:01.openssl
Security:	CVE-2025-15467
Security:	CVE-2025-68160
Security:	CVE-2025-69418
Security:	CVE-2025-69419
Security:	CVE-2025-69420
Security:	CVE-2025-69421
Security:	CVE-2026-22795
Security:	CVE-2026-22796
2026-01-28 07:36:33 +01:00
Mark Johnston
163ae89560 tests: Add a regression test for commit 7587f6d484
Approved by:	so
Reviewed by:	kib
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D50533

(cherry picked from commit a5dac34f6e)
(cherry picked from commit f56b66f1260a33e49c65bbc05213ec8267978a93)
2026-01-28 07:36:32 +01:00
Konstantin Belousov
6f7cf6b0ee namei: clear internal flags in NDREINIT()
same as it is done for NDRESTART()

Approved by:	so
Fixes:  e05e33041c
Reported and tested by:	pho
Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 58b2bd33af)
(cherry picked from commit 53963866f7088dd96f6d56169e6b4fb899277306)
2026-01-28 07:36:31 +01:00
Mark Johnston
81eacb8f36 vfs: Don't clobber namei flags in vn_open_cred()
Otherwise NAMEILOOKUP is cleared.  More generally it seems quite
surprising that the flags set by vn_open_cred() callers are not
automatically preserved.  Modify open2nameif() such that it takes
already-set namei flags into account.

Approved by:	so
Reviewed by:	olce, kib
Fixes:		7587f6d484 ("namei: Make stackable filesystems check harder for jail roots")
Differential Revision:	https://reviews.freebsd.org/D50531

(cherry picked from commit e05e33041c)
(cherry picked from commit a66767844690dfd82e14df2d22bd9bc40e46546b)
2026-01-28 07:36:30 +01:00
Mark Johnston
0b5aa71186 vfs cache: Add NAMEILOOKUP to the whitelist of fastpath lookup flags
Otherwise the lockless name lookup path is inadvertently disabled since
NAMEILOOKUP isn't recognized.

Approved by:	so
Reviewed by:	olce, kib
Fixes:		7587f6d484 ("namei: Make stackable filesystems check harder for jail roots")
Differential Revision:	https://reviews.freebsd.org/D50532

(cherry picked from commit f415895300)
(cherry picked from commit 031cd548775c26314e6ae9cad35b01c5ab1aea6c)
2026-01-28 07:36:28 +01:00
Mark Johnston
ec57109a0f namei: Remove a now-unused variable
Approved by:	so
Reported by:	bapt
Fixes:		7587f6d484 ("namei: Make stackable filesystems check harder for jail roots")

(cherry picked from commit 14ec281a09)
(cherry picked from commit 3f4efe392b7039686057838d723a2d43ae144be5)
2026-01-28 07:36:27 +01:00
Mark Johnston
3d1e822916 namei: Make stackable filesystems check harder for jail roots
Suppose a process has its cwd pointing to a nullfs directory, where the
lower directory is also visible in the jail's filesystem namespace.
Suppose that the lower directory vnode is moved out from under the
nullfs mount.  The nullfs vnode still shadows the lower vnode, and
dotdot lookups relative to that directory will instantiate new nullfs
vnodes outside of the nullfs mountpoint, effectively shadowing the lower
filesystem.

This phenomenon can be abused to escape a chroot, since the nullfs
vnodes instantiated by these dotdot lookups defeat the root vnode check
in vfs_lookup(), which uses vnode pointer equality to test for the
process root.

Fix this by extending nullfs and unionfs to perform the same check,
exploiting the fact that the passed componentname is embedded in a
nameidata structure to avoid changing the VOP_LOOKUP interface.  That
is, add a flag to indicate that containerof can be used to get the full
nameidata structure, and perform the root vnode check on the lower vnode
when performing a dotdot lookup.

Approved by:	so
Security:	FreeBSD-SA-26:02.jail
Security:	CVE-2025-15547
PR:		262180
Reviewed by:	olce, kib
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D50418

(cherry picked from commit 7587f6d484)
(cherry picked from commit 3feafab4a34c95209cd4fc3e6224c324efc056f3)
2026-01-28 07:36:26 +01:00
Konstantin Belousov
8b81e0345d nullfs lookup: cn_flags is 64bit
Approved by:	so

(cherry picked from commit 89549c2348)
(cherry picked from commit 2013ad7490f2a80d3b3260d9811422bbd25a915e)
2026-01-28 07:36:24 +01:00
Konstantin Belousov
bb4385b285 vm_fault: only rely on PG_ZERO when the page was newly allocated
Approved by:	so
Security:	FreeBSD-EN-26:03.vm

(cherry picked from commit cff67bc43df14d492ccc08ec92fddceadd069953)
(cherry picked from commit 99f641267d449f26a2e13449964f29d17897c29f)
2026-01-28 07:36:23 +01:00
Konstantin Belousov
60d89920a3 vm_object_page_remove(): clear pager even if there is no resident pages
Approved by:	so
Security:	FreeBSD-EN-26:03.vm

(cherry picked from commit 72a447d0bc768c7fe8a9c972f710c75afebd581b)
(cherry picked from commit feac4c32a5f87434a17a804d8148cea78f81ebea)
2026-01-28 07:36:21 +01:00
Andrew Turner
7958956b94 arm64: Correctly align the SVE signal context
The SVE signal context needs to be correctly aligned. Fix this by
creating a new macro to calculate the needed size to provide this
alignment, and use it when setting and checking the saved SVE signal
context.

Approved by:	so
Security:	FreeBSD-EN-26:02.arm64
Reported by:	cperciva
Reviewed by:	cperciva, markj
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D54396

(cherry picked from commit a9e77eb7016df70723c208fc09fbd01ec23a732d)
(cherry picked from commit bcd6bb8067d13d28d13a309e32818cda9e0d29ff)
2026-01-28 07:36:19 +01:00
Gordon Bergling
1bab7230df netpfil/ipfw: Fix a typo in a source code comment
- s/vaues/values/

(cherry picked from commit 9be9ab2a242080dea6254e187cf211604170de07)
2026-01-27 13:49:57 +01:00
Kevin Bowling
b535c315b7 Revert "e1000: Try auto-negotiation for fixed 100 or 10 configuration"
We've gotten a report of this breaking a fixed no autoneg setup.

Since no link is worse than what this intends to fix (negotiating full
duplex at forced speed), revert for the undeway 15.0 release cycle
until this can be further reviewed.

PR:		288827
Differential Revision:	https://reviews.freebsd.org/D47336

This reverts commit 645c45e297.

(cherry picked from commit 3ff0231c87)
2026-01-27 13:47:41 +01:00
Michael Tuexen
e55e4cbdfb ipv6: account for jumbo payload option
If a jumbo payload option is added, the length of the mbuf chain is
increased by 8 but the actual hop-by-hop extension header with the
jumbo playload option is only inserted in the packet if there are
other options. Therefore, adjust optlen to reflect the actual size
of IPv6 extension headers including the hop-by-hop extension header
containing the jumbo payload option.

Reported by:		syzbot+73fe316271df473230eb@syzkaller.appspotmail.com
Reviewed by:		markj, Timo Voelker
Differential Revision:	https://reviews.freebsd.org/D54394

(cherry picked from commit 1f5b1de1fdf2924066c1851ed6c73f36fe20b438)
2026-01-27 13:47:18 +01:00
Jean-Sébastien Pédron
6e530e85be linuxkpi: Take const root in read-only radix tree functions
This is a preparation step for a future addition to this file. This is
also closer to what Linux does.

Reviewed by:	emaste
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit cf39b51d36d82214ebdfd03055d321ddd2d85274)
(cherry picked from commit c544554099)
2026-01-27 13:46:46 +01:00
Timo Völker
fc112dc6eb tcp: fix checksum calculation bug
The new function in_delayed_cksum_o() was introduced to compute
the checksum in the case the mbuf chain does not start with the
IP header. The offset of the IP header is specified by the
parameter iph_offset.
If iph_offset was positive, the function computed an incorrect
checksum.

Reviewed by:		sobomax, tuexen
Fixes:			5feb38e378 ("netinet: provide "at offset" variant of the in_delayed_cksum() API")
Differential Revision:	https://reviews.freebsd.org/D54269

(cherry picked from commit c8b3b605ae854ead6c8804e0400d80cb8fa73fdf)
2026-01-27 13:46:27 +01:00
Jonathan T. Looney
1877dad3cf ip6: add SO_BINTIME support
This adds support for obtaining timestamps from IPv6 packets using the
SO_BINTIME socket option, bringing it in parity with IPv4 behavior.

Enable testing the SO_BINTIME option in the relevant (manual) regression
test.

PR:		289423
Reviewed by:	markj
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D52504

(cherry picked from commit cd02a8a9f8be2085d5242606a79668dc3720e7b0)
2026-01-20 10:18:46 +01:00
Peter Lei
35ea0e428a tcp: save progress timeout cause in connection end status
TCP stats are currently incremented for the persist and progress
timeout conditions, but only the persist cause was saved in the
connection end info status, which in turn is logged in the
blackbox "connection end" event.

Reviewed by:	tuexen
Sponsored by:	Netflix, Inc.

(cherry picked from commit 1a61a673a3700c0ebdb0c5847b5923d0e3641f89)
2026-01-20 10:16:32 +01:00
Michael Tuexen
e9cca1aa23 tcp: remove stray ;
Sponsored by:	Netflix, Inc.

(cherry picked from commit 0faa9ca827a5e91273ba757bd87bd9e8179a0862)
2026-01-20 10:15:58 +01:00
Michael Tuexen
5eed60a3a1 tcp: improve SEG.ACK validation in SYN-RECEIVED
According to the fifth step in SEGMENT ARRIVES, send a RST segment in
response to an ACK segment which fails the SEG.ACK check, but leave
the endpoint state unchanged.
FreeBSD handles this correctly when entering the SYN-RECEIVED state via
the SYN-SENT state, but not in the SYN-cache code, which handles the
SYN-RECEIVED state via the LISTEN state.

This also fixes a panic reported by Alexander Leidinger.

Reviewed by:		jtl, glebius
Sponsored by:		Netflix, Inc.
Differential Revision:	https://reviews.freebsd.org/D52934

(cherry picked from commit 8af2f06a99b10c0d3ab9021949e750852662672a)
2026-01-20 10:15:58 +01:00
Michael Tuexen
d06545d68e tcp: improve credential handling in syncache
When adding a syncache entry, take a reference count of the
credentials while the inp is still locked.
Thanks to markj@ for providing a hint regarding the root cause.

Reported by:		David Marker
Reviewed by:		glebius
Tested by:		David Marker
Fixes:			cbc9438f05 ("tcp: improve ref count handling when processing SYN")
Sponsored by:		Netflix, Inc.
Differential Revision:	https://reviews.freebsd.org/D53380

(cherry picked from commit 44cb1e857f048d2326bdc1a032ccd2c04d2bcdc9)
2026-01-20 10:15:00 +01:00
Michael Tuexen
8069bc6e43 tcp: cleanup of syncache_expand()
* Consistently free the string after unlocking the sch, if possible.
* Remove the failure handling in case of sc != NULL, since this is
  not possible anymore.
* Remove the use of goto and instead return 0 in the three cases.
The only change in behavior is that in three out of the four cases,
where 0 is returned, *lsop is not set to NULL anymore. So the behavior
is now consistent and also documented in a comment. The current in
tree callers only look at *lsop, if and only if syncache_expand()
returns 1.

Reviewed by:		Peter Lei
Sponsored by:		Netflix, Inc.
Differential Revision:	https://reviews.freebsd.org/D52948

(cherry picked from commit aafdbf83b926519cb47de8f16a1a40c1ef3c84b5)
2026-01-20 10:14:39 +01:00
Michael Tuexen
5e8113a3ab tcp: improve sending of SYN-cookies
Ensure that when the sysctl-variable net.inet.tcp.syncookies_only is
non zero, SYN-cookies are sent and no SYN-cache entry is added to the
SYN-cache. In particular, this behavior should not depend on the value
of the sysctl-variable net.inet.tcp.syncookies, which controls whether
SYN cookies are used in combination with the SYN-cache to deal with
bucket overflows.
Also ensure that tcps_sc_completed does not include TCP connections
established via a SYN-cookie.
While there, make V_tcp_syncookies and V_tcp_syncookiesonly bool
instead of int, since they are used as boolean variables.

Reviewed by:		rscheff, cc, Peter Lei, Nick Banks
Sponsored by:		Netflix, Inc.
Differential Revision:	https://reviews.freebsd.org/D52225

(cherry picked from commit 7b57f25133)
2026-01-20 10:13:31 +01:00
Gleb Smirnoff
7e9fb66af5 tcp: unlock before syncookie_expand()
The function doesn't need a lock on sch.  It uses the pointer as value for
the SipHash calculation.

Reviewed by:		tuexen
Differential Revision:	https://reviews.freebsd.org/D50898

(cherry picked from commit 0809d26de2)
2026-01-20 10:13:18 +01:00
Gleb Smirnoff
9c793e0dbe tcp: increase tcps_sc_recvcookie only in the syncache_expand()
The syncookie_expand() is called from syncookie_cmp() in INVARIANTS mode
to confirm that values calculated via syncookies mechanism match those
stored in the syncache entry.  This creates a counting bug, that with
INVARIANTS every successful use of syncache also counts as use of a
syncookie.

Reviewed by:		tuexen
Differential Revision:	https://reviews.freebsd.org/D50897

(cherry picked from commit 3ed8d5645d)
2026-01-20 10:13:08 +01:00
Gleb Smirnoff
653fe47d90 tcp: refactor debug function syncookie_cmp()
- Don't bzero() the test structure.  All fields checked are set by
  syncache_expand().
- Don't allocate TCP address logging string if there is nothing to report.
- Mark hash bucket argument as pointer to const.
- Make it void.

Differential Revision:	https://reviews.freebsd.org/D50896

(cherry picked from commit e9e6a025b4)
2026-01-20 10:12:58 +01:00
Gleb Smirnoff
7c4a53cc23 tcp: rename syncookie_lookup() into syncookie_expand() and make it bool
This function always returns the same pointer it was passed.  With new
name and return type the code is easier to understand.  Mark the hash
bucket argument as pointer to const, since function doesn't modify it,
just uses value as integer.  No functional changes.

Reviewed by:		tuexen
Differential Revision:	https://reviews.freebsd.org/D50895

(cherry picked from commit 6538742c1a)
2026-01-20 10:12:50 +01:00
Michael Tuexen
3e999affea tcp: micro-optimize SYN-cookie expansion
Only compute wscale when it is actually used. While there, change the
type of wscale to u_int as suggested by glebius.
No functional change intended.

Reviewed by:		glebius, rscheff (older version)
Sponsored by:		Netflix, Inc.
Differential Revision:	https://reviews.freebsd.org/D52296

(cherry picked from commit 341d1aabc1)
2026-01-20 10:12:39 +01:00
Peter Lei
a15cc7631a tcp: fix typo in comment
Reviewed by:	tuexen
Sponsored by:	Netflix, Inc.

(cherry picked from commit daac364e611532c7bfd4bb20f9fea8d365496aa1)
2026-01-20 10:10:27 +01:00
Michael Tuexen
3cb252b57a tcp: remove stray ;
No functional change intended.

Sponsored by:		Netflix, Inc.

(cherry picked from commit 941b8ecdc08749eeec1b88aac0442dad8cb8fb09)
2026-01-20 10:10:08 +01:00
Jonathan T. Looney
90725e4383 tcp: close two minor races with debug messages
The syncache entry is locked by the hash bucket lock. After running
SCH_UNLOCK(), we have no guarantee that the syncache entry still
exists.

Resolve the race by moving SCH_UNLOCK() after the log() call which
reads variables from the syncache entry.

Reviewed by:	rrs, tuexen, Nick Banks
Sponsored by:	Netflix
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D52868

(cherry picked from commit ad38f6a0b466bf05a0d40ce1daa8c7bce0936271)
2026-01-20 10:09:59 +01:00
Michael Tuexen
fa831e1df2 tcp: improve segment validation in SYN-RECEIVED
The validation of SEG.SEQ (first step in SEGMENT ARRIVES of RFC 9293)
should be done before the validation of SEG.ACK (fifth step in
SEGMENT ARRIVES in RFC 9293).
Furthermore, when the SEG.SEQ validation fails, a challenge ACK
should be sent instead of sending a RST-segment and moving the
endpoint to CLOSED.

Reported by:		Tilnel on freebsd-net
Reviewed by:		Nick Banks
Sponsored by:		Netflix, Inc.
Differential Revision:	https://reviews.freebsd.org/D52849

(cherry picked from commit b7118461f9099876cb2c2923948f8fb647defd57)
2026-01-20 10:09:45 +01:00
Michael Tuexen
f7726fe807 tcp: cleanup syncache_expand()
Only validate SEG.SEQ and SEG.ACK when processing a real SYN-cache
entry. In the SYN-cookie case, these conditions are always true, since
the SYN-cache entry on the stack is constructed from the incoming
TCP segment.
While there, fix the logging messages.

Reviewed by:		Nick Banks
Sponsored by:		Netflix, Inc.
Differential Revision:	https://reviews.freebsd.org/D52816

(cherry picked from commit 3034fa3d4321fdc487428c9050711de9ce234567)
2026-01-20 10:09:35 +01:00
Michael Tuexen
f380f0c0b8 tcp: keep SYN-cache entry when sending of challenge ACK fails
Don't drop a SYN-cache entry just because a challenge ACK couldn't
be sent. This might only be a temporary failure.

Reviewed by:		Nick Banks, glebius, jtl
Sponsored by:		Netflix, Inc.
Differential Revision:	https://reviews.freebsd.org/D52840

(cherry picked from commit 7841b44f8491d69c75207d0f3a1eb34501d99edd)
2026-01-20 10:09:22 +01:00
Michael Tuexen
a3bbe4a9a9 tcp: apply rate limits to challenge ACKs
When sending challenge ACKs from the SYN-cache, apply the same rate
limiting as in other states.

Reviewed by:		cc, rrs
Sponsored by:		Netflix, Inc.
Differential Revision:	https://reviews.freebsd.org/D52754

(cherry picked from commit c2900b6e8255ba4f54dbd897cf42427db577ed3d)
2026-01-20 10:09:14 +01:00
Michael Tuexen
4e8b40433d tcp: whitespace cleanup
No functional change intended.

Sponsored by:	Netflix, Inc.

(cherry picked from commit 40417930f6ba50f61990fb995dd071c6fd42d080)
2026-01-20 10:08:53 +01:00
Michael Tuexen
d206fa4490 tcp: improve comments in the syncache code
Add a comment explaining why syncache entries are dropped and fix a
typo in a comment.

Reviewed by:		rrs, glebius
Sponsored by:		Netflix, Inc.
Differential Revision:	https://reviews.freebsd.org/D53564

(cherry picked from commit 17fb082104ee281365b72bd5135604cea5051df2)
2026-01-20 10:07:46 +01:00
Michael Tuexen
8c70c23ce5 tcp over udp: don't copy more bytes than avaiable
When copying the data in the first mbuf to get rid of the UDP
header, use the correct length. It was copying too much (8 bytes,
the length of the UDP header).
This only applies to handling TCP over UDP packets. The support for
TCP over UDP is disabled by default.

Reported by:		jtl
Reviewed by:		Peter Lei
Sponsored by:		Netflix, Inc.

(cherry picked from commit bfda98a42027417b2fa74738c63327532013e93b)
2026-01-20 10:06:36 +01:00
Michael Tuexen
ffa99f8d3a tcp: refactor tcp_send_challenge_ack()
Refactor tcp_send_challenge_ack() such that the logic checking whether
a challenge ACK is sent or not is available in the separate function
tcp_challenge_ack_check(). This new function will also be used for
sending challenge ACKs in the SYN-cache code, which will be added in
upcoming commits.
No functional change intended.

Reviewed by:		cc, Nick Banks, Peter Lei
Sponsored by:		Netflix, Inc.
Differential Revision:	https://reviews.freebsd.org/D52717

(cherry picked from commit db37256ce5437e6c667a537afff0fd9f59576514)
2026-01-20 10:06:36 +01:00
Michael Tuexen
b716b9b45c tcp: minor cleanup
No functional change intended.

Sponsored by:	Netflix, Inc.

(cherry picked from commit c3d5387a7bd814a6c341902c29a3f8aaa956fadb)
2026-01-20 10:06:23 +01:00
Michael Tuexen
04d3368ff5 tcp: mitigate a side channel for detection of TCP connections
If a blind attacker wants to guess by sending ACK segments if there
exists a TCP connection , this might trigger a challenge ACK on an
existing TCP connection. To make this hit non-observable for the
attacker, also increment the global counter, which would have been
incremented if it would have been a non-hit.
This issue was reported as issue number 11 in Keyu Man et al.:
SCAD: Towards a Universal and Automated Network Side-Channel
      Vulnerability Detection

Reviewed by:		Nick Banks, Peter Lei
Sponsored by:		Netflix, Inc.
Differential Revision:	https://reviews.freebsd.org/D51724

(cherry picked from commit f0f6e50388)
2026-01-20 10:06:16 +01:00
Peter Lei
227a9dee21 tcp rack: fix sendmap app limited count tracking
rc_app_limited_cnt is an internal counter on the rack structure
that tracks the number of sendmap entries that have the
RACK_APP_LIMITED flag set. These entries gate goodput measurements.
The counter is reported in a number of blackbox logging events.
When a sendmap entry which has the RACK_APP_LIMITED flag set is
cloned, the counter was not being maintained properly.
While here, cleanup the counter check when a sendmap entry with
the flag set is freed which previously hid this issue.

Reviewed by:	tuexen
Sponsored by:	Netflix, Inc.

(cherry picked from commit e0838f8a2e)
2026-01-20 10:05:34 +01:00
Michael Tuexen
4414498288 tcp sack: improve computation of delivered_data
delivered_data is the number of bytes, which have newly been
delivered to the peer. This includes the number of bytes
cumulatively acknowledged and selectively acknowledged.

Reviewed by:		rscheff
Sponsored by:		Netflix, Inc.
Differential Revision:	https://reviews.freebsd.org/D51718

(cherry picked from commit 0950ab7d76)
2026-01-20 10:04:52 +01:00
Richard Scheffenegger
8ef86ad4dc tcp: ensure SACK rxmit never ends up left of its hole
When a RTO happens during SACK loss recovery, snd_recover can possibly pulled left.
With Lost Retransmission Detection (LRD) this can lead to rxmit of a hole to end up
pointing to the left of the hole, which is unexpected and leads to complications.

Reviewed By: tuexen, #transport
Sponsored by: NetApp, Inc.
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D51725

(cherry picked from commit 65d4a83399)
2026-01-20 10:04:11 +01:00
Michael Tuexen
3e5845a6f3 tcp lro: use the flowid only when it has hash properties
When a packet is provided to LRO using tcp_lro_queue_mbuf(), a
sequence number is computed based on the m_pkthdr.flowid provided
by he driver. The implicit assumption is that the m_pkthdr.flowid
has hash properties.
The recent use of tcp_lro_queue_mbuf() in iflib exposed a bug in at
least one driver (igc) , which
* reports always that is uses M_HASHTYPE_OPAQUE.
* sets in some cases m_pkthdr.flowid not consistently for packets
  belonging to the same TCP connection.
This results in severe performance problems for the base TCP stack,
since it handles the packets in the wrong sequence, although they were
received in the correct sequence.
To protect against such misbehaving drivers, just take the
m_pkthdr.flowid only into account, if it has hash properties.
The performance problems were observed by gallatin@ and analyzed
together with rrs@.

Reviewed by:		gallatin
Tested by:		gallatin
Sponsored by:		Netflix, Inc.
Differential Revision:	https://reviews.freebsd.org/D52989

(cherry picked from commit 73f56fa542ecf6ea6819c9e17fc60962eeb726d8)
2026-01-20 10:03:43 +01:00
Michael Tuexen
2ec6a3bfb7 tcp lro: remove redundant check
Remove a check which is also done in tcp_lro_rx_common().

Reviewed by:		gallatin
Sponsored by:		Netflix, Inc.
Differential Revision:	https://reviews.freebsd.org/D52683

(cherry picked from commit 43bbecaeb95fe5ea1d7acffab4f2874247ba6915)
2026-01-20 10:03:43 +01:00
Michael Tuexen
adc4e2773f tcp: fix the test that a duplicate ACK has no data
When processing a TCP segment, data is removed from the head or
the tail. The test whether a segment has no data on it should
depend on the TCP segment before the removal. Without this,
received segments might trigger a fast retransmit even when they
should not.

Reported by:		syzbot+fc97a2b5a0f7ea161161@syzkaller.appspotmail.com
Reviewed by:		Peter Lei
Sponsored by:		Netflix, Inc.
Differential Revision:	https://reviews.freebsd.org/D51425

(cherry picked from commit e46c15a0f8)
2026-01-20 10:02:54 +01:00