Commit graph

7087 commits

Author SHA1 Message Date
Hans Petter Selasky
973716df6c tcp: Correctly compute the TCP goodput in bits per second by using SEQ_SUB().
TCP sequence number differences should be computed using SEQ_SUB().

Differential Revision:	https://reviews.freebsd.org/D35505
Reviewed by:	rscheff@
Sponsored by:	NVIDIA Networking

(cherry picked from commit f5766992c0)
2022-06-30 11:39:43 +02:00
Mitchell Horne
e06f07bc3f kerneldump: remove physical argument from d_dumper
The physical address argument is essentially ignored by every dumper
method. In addition, the dump routines don't actually pass a real
address; every call to dump_append() passes a value of zero for
physical.

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

(cherry picked from commit 489ba22236)
2022-06-27 16:32:06 -03:00
Eric van Gyzen
8320036255 netdump: send key before dump, in case dump fails
Previously, if an encrypted netdump failed, such as due to a timeout or
network failure, the key was not saved, so a partial dump was
completely useless.

Send the key first, so the partial dump can be decrypted, because even a
partial dump can be useful.

Reviewed by:	bdrewery, markj
MFC after:	1 week
Sponsored by:	Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D31453

(cherry picked from commit 13a58148de)
2022-06-27 16:32:06 -03:00
Bryan Drewery
ad78db5a3f netdump: Fix leaking debugnet state on errors.
Reviewed by:	cem, markj
Sponsored by:	Dell EMC
Differential Revision: https://reviews.freebsd.org/D31319

(cherry picked from commit a573243370)
2022-06-27 16:32:06 -03:00
Dmitry Chagin
7aeec4eea8 sysent: Get rid of bogus sys/sysent.h include.
Where appropriate hide sysent.h under proper condition.

MFC after:	2 weeks

(cherry picked from commit 31d1b816fe)
2022-06-17 22:35:31 +03:00
Gordon Bergling
fb61250b96 rack: Fix a common typo in comments and a sysctl description
- s/multipler/multiplier/

(cherry picked from commit 32a01b2b86)
2022-06-10 14:32:35 +02:00
Gordon Bergling
3902536a8d tcp_rack: Fix two typos in sysctl descriptions
- s/higest/highest/

(cherry picked from commit 21b923c330)
2022-06-10 14:30:04 +02:00
Gordon Bergling
bd996b0c17 rack: Fix a typo in a source code comment
- s/enought/enough/

(cherry picked from commit c93db89231)
2022-06-10 14:27:45 +02:00
Hans Petter Selasky
95a9901996 tcp: Correctly compute the retransmit length for all 64-bit platforms.
When the TCP sequence number subtracted is greater than 2**32 minus
the window size, or 2**31 minus the window size, the use of unsigned
long as an intermediate variable, may result in an incorrect retransmit
length computation on all 64-bit platforms.

While at it create a helper macro to facilitate the computation of
the difference between two TCP sequence numbers.

Differential Revision:	https://reviews.freebsd.org/D35388
Reviewed by:	rscheff
Sponsored by:	NVIDIA Networking

(cherry picked from commit 28173d49dc)
2022-06-06 21:58:05 +02:00
Mitchell Horne
91d4608d21 netdump: check the support status of the interface
If the interface does not support debugnet(4) we should bail early,
rather than having the user find this out at the time of the panic.
dumpon(8) already expects this return value and will print a helpful
error message.

Reviewed by:	cem, markj
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D35180

(cherry picked from commit 38a36057ae)
2022-05-27 13:22:47 -03:00
Kristof Provost
f4e4c5c4c2 in_rss: fix set but not used warning
If 'options RSS' is set.

MFC after:	1 week
Sponsored by:	Orange Business Services

(cherry picked from commit 017e7d0390)
2022-05-14 11:10:19 +02:00
Alan Somers
e4f508d5a2 prometheus_sysctl_exporter: fix metric aliasing
When exporting sysctls to Prometheus, the exporter replaces "." with
"_".  This caused several metrics to alias, confusing the Prometheus
server.  Fix it by:

* Renaming the "tcp_log_bucket" UMA zone to "tcp_log_id_bucket".  Also,
  rename "tcp_log_node" to "tcp_log_id_node" for consistency.

* Not exporting sysctls with "(LEGACY)" in the description.  That is
  used by ZFS sysctls that have been replaced by others, many of which
  alias to the same Prometheus metric name (like "vfs.zfs.arc_max" and
  "vfs.zfs.arc.max").

PR:		259607
Reported by:	delphij
Sponsored by:	Axcient
Reviewed by:	delphij,rew,thj
Differential Revision: https://reviews.freebsd.org/D34952

(cherry picked from commit 8c47d8f538)
2022-05-12 14:40:05 -06:00
Mitchell Horne
d15267582d Remove 11.x ABI compat for kernel dump ioctls
This code was marked gone_in(13), so its time has passed.

The only consumer of this interface is dumpon(8). We do not maintain
strict backwards compatibility for this utility because a) it
can't/shouldn't be used from a jail or chroot and b) it is highly
specific interface unique to FreeBSD. The host's (presumably more
up-to-date) copy of dumpon(8) should be used to configure kernel dump
devices.

Reviewed by:	markj, emaste
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D34913

(cherry picked from commit 9c90bfcd31)
2022-04-18 11:51:40 -03:00
Andrey V. Elsukov
17c9c20490 Fix ipfw fwd that doesn't work in some cases
For IPv4 use dst pointer as destination address in fib4_lookup().
It keeps destination address from IPv4 header and can be changed
when PACKET_TAG_IPFORWARD tag was set by packet filter.

For IPv6 override destination address with address from dst_sa.sin6_addr,
that was set from PACKET_TAG_IPFORWARD tag.

Reviewed by:	eugen
PR:		256828, 261697, 255705
Differential Revision: https://reviews.freebsd.org/D34732

(cherry picked from commit 7d98cc096b)
2022-04-18 11:58:45 +03:00
Mark Johnston
421c2f93a4 net: Fix memory leaks in lltable_calc_llheader() error paths
Also convert raw epoch_call() calls to lltable_free_entry() calls, no
functional change intended.  There's no need to asynchronously free the
LLEs in that case to begin with, but we might as well use the lltable
interfaces consistently.

Noticed by code inspection; I believe lltable_calc_llheader() failures
do not generally happen in practice.

Reviewed by:	bz
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 990a6d18b0)
2022-04-15 10:21:20 -04:00
Gordon Bergling
b7c2ea78e8 tcp_htps: Fix a typo in a source code comment
- s/postion/position/

(cherry picked from commit 1f2aaef29a)
2022-04-14 08:11:37 +02:00
Gordon Bergling
318558f579 tcp_bbr(4): Fix a typo in a source code comment
- s/possiblity/possibility/

(cherry picked from commit 2dd0c2bc7f)
2022-04-14 08:06:07 +02:00
Gordon Bergling
8e8deee0ec tcp_bbr(4): Fix two typos in source code comments
- s/postive/positive/
- s/postion/position/

(cherry picked from commit 665709016d)
2022-04-14 08:04:45 +02:00
Gordon Bergling
d2c483caa3 libalias(3): Fix two typos in source code comments
- s/modfied/modified/

(cherry picked from commit 1cfd924f4e)
2022-04-14 08:04:17 +02:00
Gordon Bergling
2e1670c799 tcp_rack: Fix a typo in a source code comment
- s/possiblity/possibility/

(cherry picked from commit addb2c6585)
2022-04-14 08:01:49 +02:00
Gordon Bergling
abf7997b8b tcp_bbr(4): Fix a typo in a sysctl description and a comment
- s/postive/positive/

(cherry picked from commit 4d6883cbe2)
2022-04-14 07:58:08 +02:00
Gordon Bergling
abe171cc5c tcp_rack: Fix a few typos in sysctl descriptions and comments
- s/postion/position/
- s/postions/positions/
- s/repostion/reposition/

(cherry picked from commit 36814092d4)
2022-04-14 07:57:39 +02:00
Mark Johnston
251aee96ae net: Fix LLE lock leaks
Historically, lltable_try_set_entry_addr() would release the LLE lock
upon failure.  After some refactoring, it no longer does so, but
consumers were not adjusted accordingly.

Also fix a leak that can occur if lltable_calc_llheader() fails in the
ARP code, but I suspect that such a failure can only occur due to a code
bug.

Reviewed by:	bz, melifaro
Reported by:	pho
Fixes:		0b79b007eb ("[lltable] Restructure nd6 code.")
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit dd91d84486)
2022-04-11 09:43:27 -04:00
Gordon Bergling
39ff0036f1 cc_vegas(4): Fix a typo in a source code comment
- s/measurment/measurement/

(cherry picked from commit 17628f1b79)
2022-04-09 08:16:35 +02:00
Gordon Bergling
c33470cbe2 khelp(9): Fix a typo in a source code comment
- s/measurment/measurement/

(cherry picked from commit 8d30ef92d5)
2022-04-09 08:13:16 +02:00
Gordon Bergling
a643b8e17a netinet: Fix a typo in a source code comment
- s/exisitng/existing/

(cherry picked from commit 942e8cab8c)
2022-04-09 08:10:08 +02:00
George V. Neville-Neil
528d5d75e9 Address issue pointed out in CVE-2020-25705
Add jitter to the ICMP bandwidth limit to deny a side-channel port scan.

Reviewed by:	kp, philip, cy, emaste
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D27354

(cherry picked from commit ca4cd20c4a)
2022-04-07 09:35:36 +02:00
Navdeep Parhar
73fc39b1bf Fix typo (interrups -> interrupts) in a sysctl description in tcp_lro.c.
(cherry picked from commit 08c7f1b6d4)
2022-04-06 18:49:50 -07:00
Gordon Bergling
99d226c07f extra_tcp_stacks: Fix two typos in source code comments
- s/recusive/recursive/

(cherry picked from commit 75fdc440c8)
2022-04-02 15:30:44 +02:00
Alexander V. Chernikov
ffcca53561 [lltable] Add per-family lltable getters.
Introduce a new function, lltable_get(), to retrieve lltable pointer
 for the specified interface and family.
Use it to avoid all-iftable list traversal when adding or deleting
 ARP/ND records.

Differential Revision: https://reviews.freebsd.org/D33660
MFC after:	2 weeks

(cherry picked from commit ff3a85d324)
2022-03-28 08:47:38 +00:00
Alexander V. Chernikov
057793e637 tcp: virtualise net.inet.tcp.msl sysctl.
VNET teardown waits 2*MSL (60 seconds by default) before expiring
 tcp PCBs. These PCBs holds references to nexthops, which, in turn,
 reference ifnets. This chain results in VNET interfaces being destroyed
 and moved to default VNET only after 60 seconds.
Allow tcp_msl to be set in jail by virtualising net.inet.tcp.msl sysctl,
 permitting more predictable VNET tests outcomes.

MFC after:	1 week
Reviewed by:	glebius
Differential Revision: https://reviews.freebsd.org/D33270

(cherry picked from commit c2c8e360d8)
2022-03-28 08:46:13 +00:00
Franco Fichtner
d3e338662f netinet: simplify RSS ifdef statements
Approved by:	transport (rrs)
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D31583

(cherry picked from commit 47ded797ce)
2022-03-03 08:56:22 -07:00
Kristof Provost
4bca16a4fb netinet: allow UDP tunnels to be removed
udp_set_kernel_tunneling() rejects new callbacks if one is already set.
Allow callbacks to be cleared. The use case for this is OpenVPN DCO,
where the socket is opened by userspace and then adopted by the kernel
to run the tunnel. If the DCO interface is removed but userspace does
not close the socket (something the kernel cannot prevent) the installed
callbacks could be called with an invalidated context.

Allow new functions to be set, but only if they're NULL (i.e. allow the
callback functions to be cleared).

Reviewed by:	tuexen
MFC after:	3 weeks
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D34288

(cherry picked from commit 995cba5a0c)
2022-02-28 16:38:05 +01:00
Robert Wing
95eea15111 tcp_twrespond: send signed segment when connection is TCP-MD5
When a connection is established to use TCP-MD5, tcp_twrespond() doesn't
respond with a signed segment. This results in the host performing the
active close to remain in a TIME_WAIT state and the other host in the
LAST_ACK state. Fix this by sending a signed segment when the connection
is established to use TCP-MD5.

Reviewed by:	glebius
Differential Revision:	https://reviews.freebsd.org/D33490

(cherry picked from commit 2a28b045ca)
2022-02-23 09:19:59 -09:00
Robert Wing
bcc9518b98 Fix dtrace SDT probe tcp:::debug-input
The tcp:::debug-input probe is passed an mbuf pointer, use the correct
translator for ipinfo_t when defining tcp:::debug-input.

Fixes:  82988b50a1 ("Add an mbuf to ipinfo_t translator to finish ...")
Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D33066

(cherry picked from commit 08d157a832)
2022-02-23 08:47:40 -09:00
Michael Tuexen
985883fd13 sctp: remove KASSERT() which not always holds
Reported by:	syzbot+c907045aed2043011f3c@syzkaller.appspotmail.com

(cherry picked from commit bdb99f6f5e)
2022-02-23 01:19:41 +01:00
Michael Tuexen
af04a618ed sctp: make sure new locking requirements are satisfied.
Reported by:	syzbot+cd3c1dd64861b8c200bd@syzkaller.appspotmail.com

(cherry picked from commit e255f0c9fb)
2022-02-23 01:19:01 +01:00
Michael Tuexen
73fd476901 sctp: don't hold the assoc create lock longer than needed
Reported by:	syzbot+c738e3df67cf425c49a2@syzkaller.appspotmail.com

(cherry picked from commit 2f0656fb9b)
2022-02-23 01:18:05 +01:00
Michael Tuexen
f37224f026 sctp: cleanup sctp_lower_sosend
This is a preparation for retiring the tcp send lock in the
next step.

(cherry picked from commit a4a31271cc)
2022-02-23 01:17:25 +01:00
Michael Tuexen
153446e530 sctp: improve robustness
(cherry picked from commit fd0d53f85c)
2022-02-23 01:16:36 +01:00
Michael Tuexen
03e166d6ea sctp: cleanup, no functional change intended.
(cherry picked from commit 274a0e4a8d)
2022-02-23 01:15:43 +01:00
Michael Tuexen
5871b7c81a sctp: remove unused parameter
(cherry picked from commit 3ca204c97a)
2022-02-23 01:14:53 +01:00
Michael Tuexen
948608b013 sctp: fix a signed/unsigned mismatch.
(cherry picked from commit 11c4d4b966)
2022-02-23 01:14:07 +01:00
Michael Tuexen
b6e6748b2b sctp: avoid undefined behaviour and cleanup the code.
(cherry picked from commit 76e03cc940)
2022-02-23 01:13:10 +01:00
Michael Tuexen
b20c5963de sctp: improve counting of incoming chunks
(cherry picked from commit 502d5e8500)
2022-02-23 01:07:31 +01:00
Michael Tuexen
30cba4faf1 udp: use appropriate pcbinfo when signalling EHOSTDOWN
Sponsored by:	Netflix, Inc.

(cherry picked from commit 4760956e9a)
2022-02-23 01:00:38 +01:00
Michael Tuexen
f921b952dc sctp: retire sctp_mtu_size_reset()
Thanks to Timo Voelker for making me aware that sctp_mtu_size_reset()
is very similar to sctp_pathmtu_adjustment().

(cherry picked from commit 1adb91e521)
2022-02-23 00:58:56 +01:00
Michael Tuexen
81a1bfac59 sctp: improve sctp_pathmtu_adjustment()
Allow the resending of DATA chunks to be controlled by the caller,
which allows retiring sctp_mtu_size_reset() in a separate commit.
Also improve the computaion of the overhead and use 32-bit integers
consistently.
Thanks to Timo Voelker for pointing me to the code.

(cherry picked from commit 2de2ae331b)
2022-02-23 00:58:06 +01:00
Michael Tuexen
fe06ce5232 sctp: minor improvements in sctp_get_frag_point
(cherry picked from commit a7ba00a438)
2022-02-23 00:57:06 +01:00
Michael Tuexen
0f63c2d187 sctp: check that the computed frag point is a multiple of 4
Reported by:	syzbot+5da189fc1fe80b31f5bd@syzkaller.appspotmail.com

(cherry picked from commit ca0dd19f09)
2022-02-23 00:56:17 +01:00