Commit graph

267400 commits

Author SHA1 Message Date
Kristof Provost
74156bb47c net tests: fix if_stf:6to4
This test needs to have the loopback interface enabled, or route lookups
for our own IP addresses will fail.

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

(cherry picked from commit 67573b7a39)
2021-12-11 10:39:15 +01:00
Kristof Provost
80c2f5fc0a if_pflog: fix packet length
There were two issues with the new pflog packet length.
The first is that the length is expected to be a multiple of
sizeof(long), but we'd assumed it had to be a multiple of
sizeof(uint32_t).

The second is that there's some broken software out there (such as
Wireshark) that makes incorrect assumptions about the amount of padding.
That is, Wireshark assumes there's always three bytes of padding, rather
than however much is needed to get to a multiple of sizeof(long).

Fix this by adding extra padding, and a fake field to maintain
Wireshark's assumption.

Reported by:	Ozkan KIRIK <ozkan.kirik@gmail.com>
Tested by:	Ozkan KIRIK <ozkan.kirik@gmail.com>
MFC after:	1 week
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D33236

(cherry picked from commit 6d4baa0d01)
2021-12-11 10:38:50 +01:00
Zhenlei Huang
5346a9a2e0 if_epair: Also mark the flag of pair b with IFF_KNOWSEPOCH
Reviewed by:	kp
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D33210

(cherry picked from commit 73d41cc730)
2021-12-11 10:38:17 +01:00
Alexander Motin
155748c1e7 xhci: Add PCI IDs from recent Intel CPUs.
MFC after:	2 weeks

(cherry picked from commit 83d7b2f335)
2021-12-11 00:17:16 -05:00
Rick Macklem
3e8081ac88 nfscl: Sanity check the Sequence slotid in reply
The slotid in the Sequence reply must be the same as
in the request.  Check that it is the same and log
a console message if it is not, plus set it to the
correct value.

PR:	260071

(cherry picked from commit 1c15c8c0e9)
2021-12-10 18:28:14 -08:00
Rick Macklem
5b76a6b862 nfsd: Sanity check the len argument for ListXattr
The check for the original len being >= retlen needs to
be done before the "if (nd->nd_repstat == 0)" code, so
that it can be reported as too small.

PR:	260046

(cherry picked from commit 5b430a1323)
2021-12-10 18:26:22 -08:00
Colin Percival
efb381caf1 EC2: Turn off IPv6 DAD
Disable Duplicate Address Detection in EC2 instances.  The networking
configuration in EC2, with IPv6 addresses assigned by DHCPv6 and
host egress filtering, makes "duplicate addresses" impossible.

This speeds up the boot process in EC2 by 2 seconds.

Sponsored by:	https://www.patreon.com/cperciva
Differential Revision:	https://reviews.freebsd.org/D33091

(cherry picked from commit 81075203a0)
2021-12-10 17:34:23 -08:00
Ed Maste
0421d8bdef Move _p.a profiling archives under MK_INSTALLLIB
_p.a are just a special case of .a archives, and should not be installed
if WITHOUT_INSTALLLIB is set.

MFC after:	1 week
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit fc073e6743)
2021-12-10 20:28:57 -05:00
Mateusz Piotrowski
8316f09046 style.mdoc: Prefer Ql to Dq Li for literal display
The Li macros has been deprecated by mdoc some time ago. Recommend the
use of Ql instead.

Reviewed by:	debdrup
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D33232

(cherry picked from commit 5e077e08ef)
2021-12-10 23:16:08 +01:00
Dimitry Andric
e4bde9c969 Apply fix for clang crashing on invalid -Wa,-march= values
Merge commit df08b2fe8b35 from llvm git (by Dimitry Andric):

  [AArch64] Avoid crashing on invalid -Wa,-march= values

  As reported in https://bugs.freebsd.org/260078, the gnutls Makefiles
  pass -Wa,-march=all to compile a number of assembly files. Clang does
  not support this -march value, but because of a mistake in handling
  the arguments, an unitialized Arg pointer is dereferenced, which can
  cause a segfault.

  Work around this by adding a check if the local WaMArch variable is
  initialized, and if so, using its value in the diagnostic message.

  Reviewed By: tschuett

  Differential Revision: https://reviews.llvm.org/D114677

PR:		260078
Reported by:	bz
MFC after:	3 days

(cherry picked from commit a9cd5c30d6)
2021-12-10 22:28:56 +01:00
Mitchell Horne
71746ff01d Remove references to sio(4) from NOTES
Also zs(4) and sab(4), which have similarly been removed.

Reviewed by:	imp, jhb, emaste
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D33279

(cherry picked from commit 339ef82773)
2021-12-10 14:31:21 -04:00
Mitchell Horne
06dc4eab74 ucom: s/sio/ucom/
Seems like a copy-paste error, or at least this made more sense when the
sio(4) driver still existed. This modifies the debug port name displayed
at boot, but otherwise has no functional change.

Reviewed by:	hselasky
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D33278

(cherry picked from commit e43d081f35)
2021-12-10 14:31:20 -04:00
Mitchell Horne
8e0b699730 x86: remove unused T_USER flag
It stopped being used in 3c256f5395, when trap() was reorganized to
have separate switch statements for user and kernel traps. Remove the
two leftover references and the flag itself.

Reviewed by:	kib
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D33253

(cherry picked from commit 03b3d7bbec)
2021-12-10 14:31:20 -04:00
Mike Karels
c25b0c36dd kernel: partially revert e9efb1125a15, default inet mask
When no mask is supplied to the ioctl adding an Internet interface
address, revert to using the historical class mask rather than a
single default.  Similarly for the NFS bootp code.

(cherry picked from commit 2f35e7d9fa)
2021-12-10 10:28:06 -06:00
Mike Karels
c7444d9cb3 systat: clean up code assuming network classes
Similar to netstat, clean up code that uses inet_lnaof() to check for
binding to "host 0" (lowest host on network) as a "network" bind.
Such things don't happen, and current networks are seldom if ever
found in /etc/networks.

(cherry picked from commit a2e7dfca86)
2021-12-10 10:27:44 -06:00
Mike Karels
5abf4c8aa7 sockstat: change check for wildcard sockets to avoid historical classes
sockstat was checking whether a bound address was "host 0", the lowest
host on a network, using inet_lnaof().  This only works for class A/B/C.
However, it isn't useful to bind such an address unless it is really
the unspecified address INADDR_ANY.  Change the check to to use that.

(cherry picked from commit 64acb29b7d)
2021-12-10 10:27:24 -06:00
Mike Karels
2cd55edbb2 netstat: reduce use of historical Internet classes
When attempting to characterize bound addresses, netstat was checking
for host 0 on a (historical) net using inet_lnaof().  Such addresses
are not normally bound, as they would not work, with the exception
of the unspecified address, INADDR_ANY.  Check for that explicitly.
Similarly, don't check bound addresses for a match to a network name.

(cherry picked from commit bd27c71c45)
2021-12-10 10:27:02 -06:00
Mike Karels
e5d4e532a0 mountd: deprecate exports to a network without mask
The exports file format allows export to a network using an explicit
mask or prefix length (CIDR).  It also allows a network with just
a dotted address, in which case the historical mask was used.
Deprecate this usage, and warn when it is used.  Document that this
is deprecated.

(cherry picked from commit 92aebdeaff)
2021-12-10 10:26:37 -06:00
Mike Karels
1ab4b70db5 res_init: remove unused inet_makeaddr with IN_LOOPBACKNET
Remove code that is ifdefed out on USELOOPBACK, which uses historical
class.  No functional change intended.

(cherry picked from commit 0bf7f99b2a)
2021-12-10 10:26:14 -06:00
Mike Karels
d98a0edb26 man pages: deprecate Internet Class A/B/C
Mark functions inet_netof(), inet_lnaof(), and inet_makeaddr() as
deprecated, as they assume Class A/B/C.  inet_makeaddr() mostly works
when networks are a multiple of 8 bits, but warn for anything other
than historical classes.  Reduce other mentions of network classes.

(cherry picked from commit 12bd931d8c)
2021-12-10 10:25:45 -06:00
Mike Karels
4dbba5ab60 ifconfig: warn if setting an Internet address without mask
Add a postproc function for af_inet, and add interface flags as a
parameter.  Check there if setting an address without a mask unless
the interface is loopback or point-to-point, where mask is not really
meaningful; warn if so.  This will hopefully be an error in the future.

(cherry picked from commit d8237b9555)
2021-12-10 10:24:51 -06:00
Mike Karels
cdae3f501d kernel: deprecate Internet Class A/B/C
Hide historical Class A/B/C macros unless IN_HISTORICAL_NETS is defined;
define it for user level.  Define IN_MULTICAST separately from IN_CLASSD,
and use it in pf instead of IN_CLASSD.  Stop using class for setting
default masks when not specified; instead, define new default mask
(24 bits).  Warn when an Internet address is set without a mask.

(cherry picked from commit 20d5940396)
2021-12-10 10:24:15 -06:00
Andriy Gapon
5f24d2a82c iflib_stop: drain rx tasks to prevent any data races
iflib_stop modifies iflib data structures that are used by _task_fn_rx,
most prominently the free lists.  So, iflib_stop has to ensure that the
rx task threads are not active.

This should help to fix a crash seen when iflib_if_ioctl (e.g.,
SIOCSIFCAP) is called while there is already traffic flowing.

The crash has been seen on VMWare guests with vmxnet3 driver.

My guess is that on physical hardware the couple of 1ms delays that
iflib_stop has after disabling interrupts are enough for the queued work
to be completed before any iflib state is touched.

But on busy hypervisors the guests might not get enough CPU time to
complete the work, thus there can be a race between the taskqueue
threads and the work done to handle an ioctl, specifically in iflib_stop
and iflib_init_locked.

PR:		259458

(cherry picked from commit 1bfdb812c7)
2021-12-10 14:32:37 +02:00
Andriy Gapon
0f048f199e twsi: unify error handling, explicitly handle more conditions
twsi_error() is a new function that stops the current transfer and sets
up softc when an error condition is detected.
TWSI_STATUS_DATA_WR_NACK, TWSI_STATUS_BUS_ERROR and
TWSI_STATUS_ARBITRATION_LOST are now handled explicitly rather than
via the catch-all unknown status.

Also, twsi_intr() now calls wakeup() in a single place when the
transfer is finished.

(cherry picked from commit a4fe892208)
2021-12-10 14:30:12 +02:00
Andriy Gapon
22989451b4 twsi: improve a handful of debug messages
- use 0x prefix for hex values
- print indexes and counts as decimals
- break too long lines

(cherry picked from commit 578707ed4e)
2021-12-10 14:30:12 +02:00
Andriy Gapon
5efa75707b twsi: do not attempt transfer if bus is not idle
(cherry picked from commit cb167e1ae9)
2021-12-10 14:30:12 +02:00
Andriy Gapon
bb8fac1ee1 twsi: remove redundant enabling of the controller
(cherry picked from commit bc02583c4d)
2021-12-10 14:30:12 +02:00
Andriy Gapon
109000c32d twsi: protect interaction between twsi_transfer and twsi_intr
All accesses to softc are now done under a mutex to prevent data races
between the open context and the interrupt handler.
Additionally, the wait time in twsi_transfer is bounded now.
Previously we could get stuck there forever if an interrupt got lost.

(cherry picked from commit 69cfa60ddd)
2021-12-10 14:30:12 +02:00
Michael Tuexen
42cb69e147 Hyper-V: hn: Enter network epoch when required
PR:				254695
(cherry picked from commit 26d79d40a7)
2021-12-10 11:50:01 +01:00
Michael Tuexen
30cc621895 tcpdrop: tweak comments
Sponsored by:	Netflix, Inc.

(cherry picked from commit c2b53b107e)
2021-12-10 11:45:33 +01:00
Michael Tuexen
4ab3d3d91f tcpdrop: explicitly choose TCP as the transport protocol
Sponsored by:	Netflix, Inc.

(cherry picked from commit 8ea363c8c6)
2021-12-10 11:45:05 +01:00
Michael Tuexen
cec14fd194 tcpdrop: allow TCP connections to be filtered by cc-algo
In addition to filtering by stack and state, allow filtering
by the congestion control module used.  Choose the command line
options to be consistent with the ones of sockstat.

Sponsored by:	Netflix, Inc.

(cherry picked from commit 31537ea583)
2021-12-10 11:44:23 +01:00
Michael Tuexen
d749a2e870 tcpdrop: update man page, since the fastack stack has been removed
Sponsored by:	Netflix, Inc.

(cherry picked from commit 7ef45bd3cf)
2021-12-10 11:43:52 +01:00
Michael Tuexen
61deed379f tcpdrop: use a better name of a variable.
No functional change intended.

Sponsored by:	Netflix, Inc.

(cherry picked from commit 300914a0ff)
2021-12-10 11:42:34 +01:00
Michael Tuexen
c5f3adcce3 sctp: unbreak NOINET6 builds.
PR:		260119
Reported by:	kostikbel
MFC after:	1 week

(cherry picked from commit 54912d47b6)
2021-12-10 11:41:44 +01:00
Michael Tuexen
89bbc84988 sctp: inherit IP level socket options from listening socket
Ensure that TTL and TOS values set on a listener get inheritet
to the accepted sockets.

PR:		260119
MFC after:	1 week

(cherry picked from commit d79676fb13)
2021-12-10 11:40:59 +01:00
Michael Tuexen
7a49fc8439 sctp: use the correct traffic class when sending SCTP/IPv6 packets
When sending packets the stcb was used to access the inp and then
access the endpoint specific IPv6 level options. This fails when
there exists an inp, but no stcb yet. This is the case for sending
an INIT-ACK in response to an INIT when no association already
exists. Fix this by just providing the inp instead of the stcb.

PR:		260120
MFC after:	1 week

(cherry picked from commit f32357be53)
2021-12-10 11:39:44 +01:00
Michael Tuexen
4bf3c8ea0d libc sctp: improve conformance of sctp_getpaddrs()
When there is no association, don't return -1 and indicate ENOENT,
but return 0 instead. This is specified in RFC 6458.

PR:		260117
MFC after:	1 week

(cherry picked from commit 83a103ec42)
2021-12-10 11:39:15 +01:00
Michael Tuexen
6a5487e34b libc sctp: fix sctp_getladdrs() when reporting no addresses
Section 9.5 of RFC 6458 (SCTP Socket API) requires that
sctp_getladdrs() returns 0 in case the socket is unbound. This
is the cause of reporting 0 addresses. So don't indicate an
error, just report this case as required.

PR:		260117
MFC after:	1 week

(cherry picked from commit 071966e874)
2021-12-10 11:38:31 +01:00
Michael Tuexen
70d91ea04c sctp: improve handling of assoc ids in socket options
For socket options related to local and remote addresses providing
generic association ids does not make sense. Report EINVAL in this
case.

MFC after:	1 week

(cherry picked from commit 13c196a41e)
2021-12-10 11:29:43 +01:00
Michael Tuexen
4749d55fb3 libc sctp: improve error reporting of sctp_getladdrs()
Do not hide errno from getsockopt() called internally.

MFC after:	1 week

(cherry picked from commit 6e9309bd3b)
2021-12-10 11:26:31 +01:00
Michael Tuexen
30e6da1149 libc sctp: fix sctp_getladdrs() for 64-bit BE platforms
When calling getsockopt() with SCTP_GET_LOCAL_ADDR_SIZE, use a
pointer to a 32-bit variable, since this is what the kernel
expects.
While there, do some cleanups.

MFC after:	1 week

(cherry picked from commit dabd8bf914)
2021-12-10 11:25:21 +01:00
Michael Tuexen
6f7ab8ac9e sctp: cleanup, no functional change intended.
MFC after:	1 week

(cherry picked from commit a01b8859cb)
2021-12-10 11:23:42 +01:00
Konstantin Belousov
dea036bd15 swap_pager.c: Remove MPSAFE and ARGSUSED annotations
(cherry picked from commit 6df359449f)
2021-12-10 04:32:18 +02:00
Konstantin Belousov
9e75c46527 imgact_aout.c: some style
(cherry picked from commit 290e05dde0)
2021-12-10 04:32:18 +02:00
Konstantin Belousov
aa1d548128 imgact_aout.c: We do not expect the aout support to be ported
(cherry picked from commit 9da5257e1c)
2021-12-10 04:32:18 +02:00
Rick Macklem
8e74cc2b4e nfsd: Add checks for layout errors in LayoutReturn
For a LayoutReturn when using the Flexible File Layout,
error reports may be provided in the request.
Sanity check the size of these error reports and
check that they exist before calling nfsrv_flexlayouterr().

PR:	260012

(cherry picked from commit bdd57cbb1b)
2021-12-09 16:55:47 -08:00
Rick Macklem
815a7affac nfscl: Sanity check irdcnt in nfsrpc_createsession
PR:	259996

(cherry picked from commit 22f7bcb523)
2021-12-09 16:54:18 -08:00
Cy Schubert
19109e76d1 unbount: Vendor import 1.14.0rc1
This vendor import was requested by glebius@ as it should fix unbound
crashes.

Reported by:	glebius

(cherry picked from commit 24e3652200)
2021-12-09 10:50:23 -08:00
Cy Schubert
5542dcf8dc unbound: Vendor import 1.13.2
Merge commit '625f1c1312fb7defbd148c8ba121a0cf058707ef'

(cherry picked from commit 5469a99530)
2021-12-09 10:50:23 -08:00