Commit graph

267384 commits

Author SHA1 Message Date
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
Cy Schubert
fdf2f69042 ipfilter: Avoid more null if-then-else blocks
As in 73db3b64f1, when WITHOUT_INET6 is selected, null if-then-else
blocks are generated because #if statements are incorrectly placed.
Moving the #if statements reduces unnecessary runtime comparisons or
compiler optimizations.

(cherry picked from commit 130df64793)
2021-12-09 10:50:22 -08:00
Cy Schubert
2d120650d3 ipfilter: Correct a comment and add notation
Correct a comment to accurately reflect what is being done. While
we're at it document the next step in the process.

(cherry picked from commit 1ca73c39a5)
2021-12-09 10:50:22 -08:00
Cy Schubert
7e63bbe7d6 ipfilter: Correct function description
As of 874b1a3548, ip_proxy_check() return codes have been simplified.
The original comment was also incorrect in the first place.

(cherry picked from commit 06b96a4bd6)
2021-12-09 10:50:22 -08:00
Cy Schubert
bc942a227a ipfilter: Add DTrace SDT probe
Add an SDT probe, using the newly created DT5 macro, in similar vein
to DEBUG_PARSE printf for when FTP junk is anticipated and ok. This
will assist in debugging port (active) FTP proxy issues.

(cherry picked from commit 106f42596e)
2021-12-09 10:50:22 -08:00
Cy Schubert
a0ff553e01 ipfilter: New DT5 DTrace macro
Define a new DT5 DTrace macro used to call DTRACE_PROBE5, for use with
SDT probes with five arguments.

(cherry picked from commit ca8bf28e1e)
2021-12-09 10:50:22 -08:00
Cy Schubert
cf9dd263f8 ipfilter: Whitespace cleanup
Clean up whitespace from compaction of DTn macro definitions.

(cherry picked from commit fca9c3871d)
2021-12-09 10:50:22 -08:00
Cy Schubert
b993b91b05 ipfilter: Compat and simplify DTrace macro definitions
Use a compound #if to simplify and compact DTn DTRACE_PROBEn macros
used by ipfilter.

(cherry picked from commit 2d74fed5be)
2021-12-09 10:50:21 -08:00
Cy Schubert
d6110110bb ipfilter: Save a word of stack space
Rather than save the return code into an intermediate variable, which BTW
is optimized out anyway, explicitly remove the return code from the stack.

(cherry picked from commit b7f127b6e5)
2021-12-09 10:50:21 -08:00
Mateusz Piotrowski
e99e7f1738 inetd.8: Lint the file
Remove Tn macros and fix other style warnings.

MFC after:	3 days

(cherry picked from commit aab6fe0c2c)
2021-12-09 10:17:55 +01:00
Mateusz Piotrowski
b834c56a18 inetd.8: Sort options
While here:

- Cluster flags without arguments together.
- Simplify the synopsis of the -a flag. There is no need to distinguish
  between address and hostname there.
- Add a missing argument to the -a flag in the description section.
- Fix some typos.

MFC after:	3 days

(cherry picked from commit 593ad024e4)
2021-12-09 10:17:55 +01:00
Ed Maste
dbb2f1cdb8 src.conf.5: regen after WITH_/WITHOUT_CXX description update
Sponsored by:	The FreeBSD Foundation
2021-12-08 20:52:33 -05:00
Ed Maste
4a713d6501 WITH_/WITHOUT_CXX: update description
Contrary to the previous description WITHOUT_CXX does not disable
/usr/bin/c++, which is just a link to Clang.  We also no longer have
gperf.

MFC after:	1 week
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 145a574fa1)
2021-12-08 20:44:29 -05:00
Alexander Motin
f8aedfec5d ig4: Add PCI IDs for Intel Alder Lake I2C controller.
Submitted by:	Dmitry Luhtionov <dmitryluhtionov@gmail.com>
MFC after:	2 weeks

(cherry picked from commit e8e8d2290e)
2021-12-08 20:37:28 -05:00
Alexander Motin
447d2569d6 APEI: Fix Generic Error Data Entry revision 3.0 handling.
Since revision 3.0 this structure grown another field, breaking access
to the following data structures.  This change fixes the PCIe errors
decoding on newer systems.

MFC after:	2 weeks

(cherry picked from commit ba83762a62)
2021-12-08 20:35:21 -05:00
Konstantin Belousov
ed43c7ac0a procstat_getfiles_sysctl: do not require non-null ki_fd
PR:	260174

(cherry picked from commit 7a9423d6f3)
2021-12-09 02:23:29 +02:00
Konstantin Belousov
0ab5452ca3 Style
(cherry picked from commit 0ea3e4a27b)
2021-12-09 02:23:28 +02:00