]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
22 months agotcp: fix build without INVARIANTS and VIMAGE
Gleb Smirnoff [Tue, 8 Nov 2022 20:34:45 +0000 (12:34 -0800)]
tcp: fix build without INVARIANTS and VIMAGE

Lines from upcoming changes crept in and broke certain builds.

Fixes: 9eb0e8326d0fe73ae947959c1df327238d3b2d53

22 months agocxgbe tom: Fix jobtotid() compilation.
John Baldwin [Tue, 8 Nov 2022 19:25:58 +0000 (11:25 -0800)]
cxgbe tom: Fix jobtotid() compilation.

The previous commit lost an implicit struct socket * cast.  Use an
inline function instead as the macro is already rather long.

Fixes: e1401f75790f cxgbe: use standard sototcpcb() accessor macro to get socket's tcpcb
Sponsored by: Chelsio Communications

22 months agotcp: forward declare struct tcpcb in the TCP logging header
Gleb Smirnoff [Tue, 8 Nov 2022 18:32:29 +0000 (10:32 -0800)]
tcp: forward declare struct tcpcb in the TCP logging header

This allows to include tcp_log_buf.h without including tcp_var.h.

22 months agoinpcb: remove TCP includes, all TCP specific code was moved
Gleb Smirnoff [Tue, 8 Nov 2022 18:24:40 +0000 (10:24 -0800)]
inpcb: remove TCP includes, all TCP specific code was moved

22 months agotcp: don't store VNET in every tcpcb, take it from the inpcbinfo
Gleb Smirnoff [Tue, 8 Nov 2022 18:24:40 +0000 (10:24 -0800)]
tcp: don't store VNET in every tcpcb, take it from the inpcbinfo

Reviewed by: rscheff
Differential revision: https://reviews.freebsd.org/D37125

22 months agohpts: move inp initialization from the generic inpcb code to TCP
Gleb Smirnoff [Tue, 8 Nov 2022 18:24:40 +0000 (10:24 -0800)]
hpts: move inp initialization from the generic inpcb code to TCP

Differential revision: https://reviews.freebsd.org/D37124

22 months agotcp: provide macros to access inpcb and socket from a tcpcb
Gleb Smirnoff [Tue, 8 Nov 2022 18:24:40 +0000 (10:24 -0800)]
tcp: provide macros to access inpcb and socket from a tcpcb

There should be no functional changes with this commit.

Reviewed by: rscheff
Differential revision: https://reviews.freebsd.org/D37123

22 months agotcp: inp_socket is valid through the lifetime of a TCP inpcb
Gleb Smirnoff [Tue, 8 Nov 2022 18:24:39 +0000 (10:24 -0800)]
tcp: inp_socket is valid through the lifetime of a TCP inpcb

The inp_socket is cleared only in in_pcbdetach(), which for TCP is
always accompanied with inp_pcbfree().  An inpcb that went through
in_pcbfree() shall never be returned by any kind of pcb lookup.

Reviewed by: tuexen
Differential revision: https://reviews.freebsd.org/D37062

22 months agotcp: remove INP_DROPPED check from notify functions
Gleb Smirnoff [Tue, 8 Nov 2022 18:24:39 +0000 (10:24 -0800)]
tcp: remove INP_DROPPED check from notify functions

These functions tcp_notify(), tcp_drop_syn_sent() and tcp_mtudisc()
are called from tcp*_ctlinput*() right after successfull
in_pcblookup*().  They shall never get a pcb that is dropped.

22 months agoinpcb: don't return INP_DROPPED entries from pcb lookups
Gleb Smirnoff [Tue, 8 Nov 2022 18:24:39 +0000 (10:24 -0800)]
inpcb: don't return INP_DROPPED entries from pcb lookups

The in_pcbdrop() KPI, which is used solely by TCP, allows to remove a
pcb from hash list and mark it as dropped.  The comment suggests that
such pcb won't be returned by lookups.  Indeed, every call to
in_pcblookup*() is accompanied by a check for INP_DROPPED.  Do what
comment suggests: never return such pcbs and remove unnecessary checks.

Reviewed by: tuexen
Differential revision: https://reviews.freebsd.org/D37061

22 months agoLinuxKPI: add virt_to_phys()
Bjoern A. Zeeb [Mon, 7 Nov 2022 13:31:39 +0000 (13:31 +0000)]
LinuxKPI: add virt_to_phys()

Add virt_to_phys() as a define to vtophys().
This is used by a wireless driver for dma related work; sigh.

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

22 months agoLinuxKPI: tasklet add (*callback) support
Bjoern A. Zeeb [Sun, 30 Oct 2022 17:20:11 +0000 (17:20 +0000)]
LinuxKPI: tasklet add (*callback) support

In addition to (*func) tasklet also seems to have a (*callback) with
a different argument.  Add support for this and add tasklet_setup()
as well for support in more drivers.

The from_tasklet() definition is duplicated in the tree; hide it there
under #ifndef to avoid a re-definition.  People should generally add
LinuxKPI bits to linuxkpi rather than private files if they also rely
on other LinuxKPI bits.

X-MFC: DO NOT MFC, space allocated by drivers not us.
Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D37216

22 months agoLinuxKPI: implement cpumask_of()
Bjoern A. Zeeb [Mon, 31 Oct 2022 14:33:58 +0000 (14:33 +0000)]
LinuxKPI: implement cpumask_of()

Add a static set of cpumasks for all (possible) cpus with only the one
indexed cpu enabled in each set.
This is needed for cpumask_of(_cpuid) which returns a cpumask (cpuset)
with only cpu _cpuid enabled and is used by one wireless driver at least.

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

22 months agotcp: allow packets to be marked as ECT1 instead of ECT0
Richard Scheffenegger [Tue, 8 Nov 2022 17:35:58 +0000 (18:35 +0100)]
tcp: allow packets to be marked as ECT1 instead of ECT0

This adds the capability for a modular congestion control
to select which variant of ECN-capable-transport it wants to use
when sending out elegible segments. As an initial CC to utilize
this, DCTCP was selected.

Event: IETF 115 Hackathon
Reviewed By: tuexen, #transport
Sponsored by: NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D24869

22 months agotests: retire now-unused MIPS case
Ed Maste [Mon, 17 Oct 2022 18:19:59 +0000 (14:19 -0400)]
tests: retire now-unused MIPS case

22 months agotcp_bbr(4): Fix a typo in a source code comment
Gordon Bergling [Tue, 8 Nov 2022 13:59:56 +0000 (14:59 +0100)]
tcp_bbr(4): Fix a typo in a source code comment

- s/retranmitted/retransmitted/

MFC after: 3 days

22 months agonfs: Fix common typos in source code comments
Gordon Bergling [Tue, 8 Nov 2022 13:58:32 +0000 (14:58 +0100)]
nfs: Fix common typos in source code comments

- s/attrbute/attribute/

MFC after: 3 days

22 months agopnfs.4: Fix a typo
Gordon Bergling [Tue, 8 Nov 2022 13:57:06 +0000 (14:57 +0100)]
pnfs.4: Fix a typo

- s/attrbute/attribute/

MFC after:3 days

22 months agosendmail: document that sendmail_enable can be set to NONE
Baptiste Daroussin [Tue, 8 Nov 2022 13:37:41 +0000 (14:37 +0100)]
sendmail: document that sendmail_enable can be set to NONE

setting sendmail_enable to NONE (which is now the default)
turns all the sendmail_*_enable variables to NO

Reported by: many

22 months agogpio: Fix typo causing GPIO configuration mismatch
Jakub Kołodziej [Tue, 8 Nov 2022 12:02:54 +0000 (13:02 +0100)]
gpio: Fix typo causing GPIO configuration mismatch

Polarity inversion register was mistekanly filled with the value of
the direction configuration register.
Correct that.

Reviewed by: kd
Obtained from: Semihalf
Differential Revision: https://reviews.freebsd.org/D37262

22 months agonetlink: unregister groups along with family
Baptiste Daroussin [Tue, 8 Nov 2022 08:02:43 +0000 (09:02 +0100)]
netlink: unregister groups along with family

Differential Revision: https://reviews.freebsd.org/D37308
Reviewed by: melifaro

22 months agoTree-wide replacement of VOP_UNLOCK + vrele combo with vput
Mateusz Guzik [Mon, 7 Nov 2022 23:33:15 +0000 (23:33 +0000)]
Tree-wide replacement of VOP_UNLOCK + vrele combo with vput

No functional changes.

22 months agogit-arc: Accept message via -m when updating reviews.
John Baldwin [Mon, 7 Nov 2022 22:43:49 +0000 (14:43 -0800)]
git-arc: Accept message via -m when updating reviews.

If a -m argument is given to update, it is passed through to arc diff
when updating each review.  Note that if an empty message is specified
via -m, arc diff will update the review without adding a note.

If an -m argument is not given, then the user's editor is invoked by
arc to supply a message for each review matching the previous
behavior.

This can be used to simplify the process for updating a set of
reviews, e.g.:

  git checkout foo
  git rebase main
  git arc update -m "Rebase" main..

This will rebase the 'foo' branch and update the reviews for all
commits on the branch without invoking the user's editor separately
for each review.

Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D37260

22 months agoClean up error output for extended attributes in fsck_ffs(8).
Kirk McKusick [Mon, 7 Nov 2022 22:31:59 +0000 (14:31 -0800)]
Clean up error output for extended attributes in fsck_ffs(8).

MFC after:    1 week
Sponsored by: The FreeBSD Foundation

22 months agopciconf(8): Decode ACS extended capability.
Navdeep Parhar [Fri, 4 Nov 2022 19:30:09 +0000 (12:30 -0700)]
pciconf(8): Decode ACS extended capability.

MFC after: 1 week
Sponsored by: Chelsio Communications
Reviewed by: kib@
Differential Revision: https://reviews.freebsd.org/D37271

22 months agopcireg.h: Add values for ACS PCIe Extended capability.
Navdeep Parhar [Fri, 4 Nov 2022 19:22:11 +0000 (12:22 -0700)]
pcireg.h: Add values for ACS PCIe Extended capability.

These values come from section 7.7.11 ("ACS Extended Capability") of the
PCI Express Base Specification Revision 6.0, dated 16 Dec 2021.

MFC after: 1 week
Sponsored by: Chelsio Communications
Reviewed by: kib@
Differential Revision: https://reviews.freebsd.org/D37270

22 months agoksan: Build sanitizer runtimes without stack-smashing protection
Mark Johnston [Mon, 7 Nov 2022 21:07:26 +0000 (16:07 -0500)]
ksan: Build sanitizer runtimes without stack-smashing protection

On arm64 with per-thread stack canaries enabled (the PERTHREAD_SSP
option), the compiler may load curthread->td_md.md_canary in function
prologues.  This is not safe in data_abort(); see commit 2c10be9e06d4.
Thus, sanitizer runtimes must also avoid accessing the current thread's
canary.

Since SSP has limited utility in sanitizer runtimes, simply disable it
unconditionally to avoid unpleasant surprises in the future.

MFC after: 2 weeks
Sponsored by: Juniper Networks, Inc.
Sponsored by: Klara, Inc.

22 months agoarm64: Disable per-thread stack-smashing protection in data_abort()
Mark Johnston [Mon, 7 Nov 2022 20:53:41 +0000 (15:53 -0500)]
arm64: Disable per-thread stack-smashing protection in data_abort()

With PERTHREAD_SSP configured, the compiler's stack-smashing protection
uses a per-thread canary value instead of a global value.  The value is
stored in td->td_md.md_canary; the sp_el0 register always contains a
pointer to that value, and certain functions selected by the compiler
will store the canary value on the stack as a part of the function
prologue (and will verify the copy as part of the epilogue).  In
particular, the thread structure may be accessed.

This happens to occur in data_abort(), which leads to the same problem
addressed by commit 2c10be9e06d4 ("arm64: Handle translation faults for
thread structures").  This commit fixes that directly, by disabling SSP
in data_abort() and a couple of related functions by using a function
attribute.  It also moves the update of sp_el0 out of C code in case
the compiler decides to start checking the canary in pmap_switch()
someday.

A different solution might be to move the canary value to the PCB, which
currently lives on the kernel stack and isn't subject to the same
problem as thread structures (if only because guard pages inhibit
superpage promotion).  However, there isn't any particular reason the
PCB has to live on the stack today; on amd64 it is embedded in struct
thread, reintroducing the same problem.  Keeping the reference canary
value at the top of the stack is also rather dubious since it could be
clobbered by a sufficiently large stack overflow.

A third solution could be to go back to the approach of commit
5aa5420ff2e8, and modify UMA to use the direct map for thread structures
even if KASAN is enabled.  But, transient promotions and demotions in
the direct map are possible too.

Reviewed by: alc, kib, andrew
MFC after: 1 month
Sponsored by: Juniper Networks, Inc.
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D37255

22 months agosshd: sync tracing disable with upstream
Ed Maste [Mon, 7 Nov 2022 17:17:15 +0000 (12:17 -0500)]
sshd: sync tracing disable with upstream

Old versions of FreeBSD do not support using id 0 to refer to the
current pid for procctl, so pass getpid() explicitly.

Although this is not required in current FreeBSD branches I am merging
it to reduce differences with upstream.

Obtained from: OpenSSH commit 0f7e1eba5525

22 months agonetlink: connect netlink(4), rtnetlink(4), genetlinl(4) to build
Li-Wen Hsu [Mon, 7 Nov 2022 16:50:00 +0000 (00:50 +0800)]
netlink: connect netlink(4), rtnetlink(4), genetlinl(4) to build

MFC after: 2 months
(after 7366c0a49c9a60d3eea7520d7ae4bc2b3ab172f3)

22 months agoLinuxKPI: add linux/leds.h
Bjoern A. Zeeb [Sun, 30 Oct 2022 17:05:52 +0000 (17:05 +0000)]
LinuxKPI: add linux/leds.h

This is just a dummy enum and struct in order to make drivers compile
more happily as some parts are simply not hidden behind #ifdefs and
this avoids a longer-term maintenance problem.

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

22 months agoLinuxKPI: add devm_request_irq()
Bjoern A. Zeeb [Sun, 30 Oct 2022 17:41:53 +0000 (17:41 +0000)]
LinuxKPI: add devm_request_irq()

Add devm_request_irq() needed by a driver.  Turns out all we need
is a wrapper with the right arguments to lkpi_request_irq().

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

22 months agoLinuxKPI: string.h implement memcpy_and_pad()
Bjoern A. Zeeb [Mon, 31 Oct 2022 22:17:00 +0000 (22:17 +0000)]
LinuxKPI: string.h implement memcpy_and_pad()

Add a memcpy variant which takes length of source and destination
buffers and a padding character in case there is free space in the
destination.  This is used by a wireless driver.

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

22 months agoLinuxKPI: 802.11: enable WME support
Bjoern A. Zeeb [Mon, 7 Nov 2022 12:39:46 +0000 (12:39 +0000)]
LinuxKPI: 802.11: enable WME support

Most of the WME code has been there disabled for months.  One of the
reasons was that it lead to crashes early on.  It is now understood
that the crashes are independent event and we can enable WME.
Update the code and deal with the calls from net80211 and adjust the
updates to when mac80211 drivers expect them, coherently put it under
LKPI_80211_WME and enable the define locally.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days

22 months agore.4: Mention vendor driver for if_re(4)
Johannes Totz [Mon, 7 Nov 2022 12:16:52 +0000 (13:16 +0100)]
re.4: Mention vendor driver for if_re(4)

If this if_re(4) is causing problems then an updated driver from
the vendor can be found in the ports tree under net/realtek-re-kmod.

Reviewed by: debdrup, koobs, emaste
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D33677

22 months agoRELNOTES: document the switch from sendmail to dma
Baptiste Daroussin [Mon, 7 Nov 2022 11:52:20 +0000 (12:52 +0100)]
RELNOTES: document the switch from sendmail to dma

22 months agomail: make The Dragonfly Mail Agent (dma) the default mta.
Baptiste Daroussin [Thu, 13 Oct 2022 09:37:21 +0000 (11:37 +0200)]
mail: make The Dragonfly Mail Agent (dma) the default mta.

dma accepts mail from a local Mail User Agent (MUA) and delivers it
locally or to a smarthost for delivery. dma does not accept inbound
mail (i.e., it does not listen on port 25) and is not intended to
provide the same functionality as a full MTA like postfix or sendmail.
It is intended for use cases such as delivering cron(8) mail. which
is the default configuration and usage of sendmail in the default
setup of the base system.

In order to switch the default from sendmail to dma, we teach
mailwrapper to fallback on dma directly if the mailer.conf file cannot
be opened.
We install by default a mailer.conf file which points at dma
We install a mailer.conf file for sendmail in the examples.

Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D37035

22 months agotcp_rack: Add a manual page
Gordon Bergling [Mon, 7 Nov 2022 11:28:39 +0000 (12:28 +0100)]
tcp_rack: Add a manual page

- add a manual page for tcp_rack(4)
- link it in the tcp(4) and tcp_bbr(4) man pages
- hook it up to build in the Makefile

Reviewed by: pauamma
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D37209

22 months agocaroot: Update VCS instructions
Li-Wen Hsu [Mon, 7 Nov 2022 11:24:09 +0000 (19:24 +0800)]
caroot: Update VCS instructions

22 months agoresolver.5: Add an EXAMPLES section
Gordon Bergling [Mon, 7 Nov 2022 11:09:43 +0000 (12:09 +0100)]
resolver.5: Add an EXAMPLES section

In case local-unbound(8) fails for some reason, it could be useful
to have a basic resolv.conf(5) example in the manual page.

Reviewed by: karels, pauamma
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D37183

22 months agoshutdown.8: Add a note about needed priviledges to run the command
Gordon Bergling [Mon, 7 Nov 2022 11:00:11 +0000 (12:00 +0100)]
shutdown.8: Add a note about needed priviledges to run the command

In order to use the shutdown command, the user must
have root privileges or be a member of the operator group.

PR: 266525
Reported by: Zsolt Udvari <uzsolt at uzsolt hu>
Reviewed by: pauamma
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D36688

22 months agointro.3: Document 'libstdthreads' (the ISO C11 '<threads.h>' library).
Gordon Bergling [Mon, 7 Nov 2022 10:34:00 +0000 (11:34 +0100)]
intro.3: Document 'libstdthreads' (the ISO C11 '<threads.h>' library).

It's still relatively uncommon to see C11 '<threads.h>' being used,
but it's worth documenting, especially since FreeBSD requires a
different library for C11 threads  compared to glibc (part of '-lpthread')
or musl libc  (included by default).

PR: 267551
Submitted by: Alois Klink <alois plus freebsd at aloisklink dot com>
Reviewed by: pauamma
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D37284

22 months agoUpdate HISTORY and AUTHORS sections for cut(1) and paste(1)
Gordon Bergling [Mon, 7 Nov 2022 10:23:33 +0000 (11:23 +0100)]
Update HISTORY and AUTHORS sections for cut(1) and paste(1)

In an e-mail Brian Walden wrote that:

"GWRL stands for Gottfried W. R. Luderer, the author of cut(1) and
paste(1), probably around 1978. Those came either from PWB or USG,
as he worked with, or for, Berkley Tague. Thus they made their way
into AT&T commercial UNIX, first into System III and the into System
V, and that's why they are missing from early BSD releases as they
didn't get into Research UNIX until the 8th Edition."

So update the HISTORY and AUTHORS sections for cut(1) and paste(1).

[1] https://minnie.tuhs.org/pipermail/tuhs/2020-January/019955.html

Reviewed by: pauamma, imp
Obtained from: OpenBSD (in partial)
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D36048

22 months agoUnbreak builds having SCTP support compiled in
Michael Tuexen [Mon, 7 Nov 2022 07:50:51 +0000 (08:50 +0100)]
Unbreak builds having SCTP support compiled in

Including sctp_var.h requires INET to be defined if IPv4 support
is needed.

22 months agorc.conf(5): Add mssing definite article
Li-Wen Hsu [Mon, 7 Nov 2022 08:03:50 +0000 (16:03 +0800)]
rc.conf(5): Add mssing definite article

Reported by: rpokala

22 months agorelease(7): Enable zpoolupgrade rc script in ZFS based VM images
Li-Wen Hsu [Mon, 7 Nov 2022 03:47:33 +0000 (11:47 +0800)]
release(7): Enable zpoolupgrade rc script in ZFS based VM images

This will enable VM access to all ZFS feature automatically, only on a
newly installed or provisioned VM or cloud instance.

Reviewed by: markj
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D37283

22 months agorc(8): Add a zpoolupgrade rc.d script
Li-Wen Hsu [Mon, 7 Nov 2022 03:30:09 +0000 (11:30 +0800)]
rc(8): Add a zpoolupgrade rc.d script

If a zpool is created by makefs(8), its version is 5000, i.e., all
feature flags are off.  Introduce an rc script to run `zpool upgrade`
over the assigned zpools on the first boot.  This is useful to the
ZFS based VM images built from release(7).

Reviewed by: imp, markj, mav
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D37282

22 months agosctp: minor changes due to upstreaming of Glebs recent changes
Michael Tuexen [Sun, 6 Nov 2022 22:06:40 +0000 (23:06 +0100)]
sctp: minor changes due to upstreaming of Glebs recent changes

22 months agotcp: make tcp_packets_this_ack() only visible in kernel scope
Richard Scheffenegger [Sun, 6 Nov 2022 12:50:13 +0000 (13:50 +0100)]
tcp: make tcp_packets_this_ack() only visible in kernel scope

22 months agotcp: Move sysctl OIDs related to ECN to tcp_ecn.c
Richard Scheffenegger [Sun, 6 Nov 2022 11:36:55 +0000 (12:36 +0100)]
tcp: Move sysctl OIDs related to ECN to tcp_ecn.c

Keep all ECN related code in (mostly) one place.

No functional change.

Event: IETF 115 Hackathon
Reviewed By: tuexen, #transport
Sponsored by: NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D37285

22 months agotcp: add conservative d.cep accounting algorithm
Richard Scheffenegger [Sun, 6 Nov 2022 10:59:55 +0000 (11:59 +0100)]
tcp: add conservative d.cep accounting algorithm

Accurate ECN asks to conservatively estimate, when the
ACE counter may have wrapped due to a single ACK covering a larger
number of segments. This is described in Annex A.2 of the
accurate-ecn draft.

Event: IETF 115 Hackathon
Reviewed By: tuexen, #transport
Sponsored by: NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D37281

22 months agotcp: add AccECN CE packet counters to tcpinfo
Richard Scheffenegger [Sun, 6 Nov 2022 10:55:52 +0000 (11:55 +0100)]
tcp: add AccECN CE packet counters to tcpinfo

Provide diagnostics information around AccECN into
the tcpinfo struct.

Event: IETF 115 Hackathon
Reviewed By: tuexen, #transport
Sponsored by: NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D37280

22 months agodpaa: Go to cleanup exit point on fman attach error
Justin Hibbits [Sun, 6 Nov 2022 00:01:50 +0000 (20:01 -0400)]
dpaa: Go to cleanup exit point on fman attach error

If fman_init() fails it can leave things in a state where it cannot
attach at all in the future, because it would simply exit without
tearing down everything that was already set up.  Go to the exit point
to clean up on error instead, so that it can try again later.

MFC after: 1 week

22 months agobnxt: Remove from LINT
Warner Losh [Sat, 5 Nov 2022 04:55:18 +0000 (22:55 -0600)]
bnxt: Remove from LINT

Until bnxt is fixed on i386, remove it from its lint. Create a new
section of the config file for things that work everywhere, except i386.

Sponsored by: Netflix

22 months agobnxt: Only filter out i386
Warner Losh [Sat, 5 Nov 2022 04:35:37 +0000 (22:35 -0600)]
bnxt: Only filter out i386

Only i386 is missing bus_read_8. The other 32-bit platforms can be fixed
with a cast to a printf.

Suggested by: kevans
Sponsored by: Netflix

22 months agowg: drop -Wno-cast-qual from CFLAGS
Kyle Evans [Sat, 5 Nov 2022 03:45:36 +0000 (22:45 -0500)]
wg: drop -Wno-cast-qual from CFLAGS

The latest update fixes the warning by applying const to the correct
part of the pointer.

22 months agoMerge commit '93bf91b4012a28610672d2266366dfa0a663b70f' into HEAD
Kyle Evans [Sat, 5 Nov 2022 03:46:21 +0000 (22:46 -0500)]
Merge commit '93bf91b4012a28610672d2266366dfa0a663b70f' into HEAD

This fixes a warning in wireguard-tools, as well as two issues pointed out by
FreeBSD's Coverity instance.

CID: 15004051500421

22 months agoUpdate wireguard-tools to 139aac59a5ab7
Kyle Evans [Sat, 5 Nov 2022 03:42:11 +0000 (22:42 -0500)]
Update wireguard-tools to 139aac59a5ab7

This includes fixes for two issues pointed out by FreeBSD's Coverity,
as well as a -Wcast-qual complaint.

While we're here, ignore build artifacts as well upon import.

22 months agostand: Update comment about devdesc
Warner Losh [Sat, 5 Nov 2022 01:45:27 +0000 (19:45 -0600)]
stand: Update comment about devdesc

How devdesc is used is opaque until much code is read. Give a more
useful description of the theory behind it here.

Sponsored by: Netflix

22 months agoClang: Add Diags for targets pre to i686 for -fcf-protection
Ed Maste [Fri, 4 Nov 2022 15:59:49 +0000 (11:59 -0400)]
Clang: Add Diags for targets pre to i686 for -fcf-protection

Intel Control-flow Enforcement Technology (CET) provides new
instructions `endbr32/64` for the indirect branch control.
They are NOPs on i686 and new targets.  We need to check for that
in case it crashes on older targets.

PR: 264497
Reviewed by: dim
MFC after: 1 week
Obtained from: LLVM commit 52516782972730ff065a34123a9d8876da08c254
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D37268

22 months agobnxt: Only build on 64-bit platforms
Warner Losh [Fri, 4 Nov 2022 22:49:10 +0000 (16:49 -0600)]
bnxt: Only build on 64-bit platforms

The driver uses bus_space_read_8 and friends, which do not exist on
32-bit i386 and break the build.

Sponsored by: Netflix

22 months agoif_bnxt: Added support for mgmt interface for passthrough hwrms
Sumit Saxena [Fri, 4 Nov 2022 22:40:29 +0000 (16:40 -0600)]
if_bnxt: Added support for mgmt interface for passthrough hwrms

Added support for application management interface. There are two types of commands supported:

1. Firmware IOCTLs: These ioctls are meant for firmware
   consumption. Driver acts as a transport for these.
2. Driver only IOCTLs: These ioctls are meant for driver
   consumption. Driver will serve these ioctls without sending them down
   to firmware.

Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D36448

22 months agoif_bnxt: Add support for smaller backing_store_cfg message size
Sumit Saxena [Fri, 4 Nov 2022 22:33:21 +0000 (16:33 -0600)]
if_bnxt: Add support for smaller backing_store_cfg message size

Add compat logic to fallback to the older/smaller backing_store_cfg
message size.

Reviewed by: imp
Differentil Revision: https://reviews.freebsd.org/D36447

22 months agoif_bnxt: Fix the PORT_PHY_CFG HWRM requests while setting Pause
Sumit Saxena [Fri, 4 Nov 2022 22:31:24 +0000 (16:31 -0600)]
if_bnxt: Fix the PORT_PHY_CFG HWRM requests while setting Pause

Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D36446

22 months agoif_bnxt: Fix the issue when kernel invokes _init() again without _stop()
Sumit Saxena [Fri, 4 Nov 2022 22:28:51 +0000 (16:28 -0600)]
if_bnxt: Fix the issue when kernel invokes _init() again without _stop()

Fixed the issue when kernel invokes _init() when it is already in
_init() state by invoking _stop() in such case.

Reviewed by: imp
Differential Revsion: https://reviews.freebsd.org/D36445

22 months agoif_bnxt: Remove sysctl node vlan_only which is not being used
Sumit Saxena [Fri, 4 Nov 2022 22:26:03 +0000 (16:26 -0600)]
if_bnxt: Remove sysctl node vlan_only which is not being used

Removed sysctl node vlan_only which is not being used after migrating
from l2_set_rx_mask to l2_filter_alloc.

Reviewed by: imp
Differential Revsion: https://reviews.freebsd.org/D36444

22 months agoif_bnxt: Add support for VLAN on Thor
Sumit Saxena [Fri, 4 Nov 2022 22:24:32 +0000 (16:24 -0600)]
if_bnxt: Add support for VLAN on Thor

Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D36443

22 months agoif_bnxt: Add support for RSS on Thor
Sumit Saxena [Fri, 4 Nov 2022 22:21:20 +0000 (16:21 -0600)]
if_bnxt: Add support for RSS on Thor

Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D36442

22 months agoif_bnxt: Display firmware version along with SIT package version
Sumit Saxena [Fri, 4 Nov 2022 22:18:38 +0000 (16:18 -0600)]
if_bnxt: Display firmware version along with SIT package version

Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D36441

22 months agoif_bnxt: Add support for async link status update
Sumit Saxena [Fri, 4 Nov 2022 22:14:49 +0000 (16:14 -0600)]
if_bnxt: Add support for async link status update

Reivewed by: imp
Differential Revision: https://reviews.freebsd.org/D36440

22 months agoif_bnxt: Add support for admin down/up and jumbo
Sumit Saxena [Fri, 4 Nov 2022 22:11:10 +0000 (16:11 -0600)]
if_bnxt: Add support for admin down/up and jumbo

Make ifconfig up/down work, as well as adding support for jumbo frames.

Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D36439

22 months agoif_bnxt: add support for Thor controller
Sumit Saxena [Fri, 4 Nov 2022 22:05:57 +0000 (16:05 -0600)]
if_bnxt: add support for Thor controller

Added support for Thor controller.
Below are the supported operations:

1. IPv4 ping (ICMP)
2. iperf / netperf (IPv4 TCP)
3. Promiscuous (tcpdump)
4. Can achieve 20 Gbps on a 25 G link (Uni-Di)
5. Can achieve 60 Gbps on a 100 G link (Uni-Di)
6. Port level and queue level driver stats.

Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D36438

22 months agoif_bnxt: Convert all doorbell writes into function pointers
Sumit Saxena [Fri, 4 Nov 2022 22:01:30 +0000 (16:01 -0600)]
if_bnxt: Convert all doorbell writes into function pointers

This is preparatory patch for making a base for Broadcom's Thor
controller support. It converts all doorbell writes into function
pointers.

Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D36437

22 months agoif_bnxt: update hsi_struct_def.h headers
Sumit Saxena [Fri, 4 Nov 2022 21:56:50 +0000 (15:56 -0600)]
if_bnxt: update hsi_struct_def.h headers

Updates the drivers to Broadcom's latest:
HWRM Version 1.10.2.34 using HSI definition version 1.8.4

Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D36436

22 months agosys/disk.h: Transition period for sys/conf.h over
Warner Losh [Fri, 4 Nov 2022 21:39:05 +0000 (15:39 -0600)]
sys/disk.h: Transition period for sys/conf.h over

There's no need to ever include sys/conf.h here anymore, so remove
it. It was added years ago as a transition and everything has been
updated.

Sponsored by: Netflix

22 months agostand: Remove unused enum
Warner Losh [Fri, 4 Nov 2022 21:28:26 +0000 (15:28 -0600)]
stand: Remove unused enum

enum disk_ioctl is unused.  It's only ever defined. All of the stand
code uses DIOCGSECTORSIZE and DIOCGMEDIASIZE instead, both to query and
to implement ioctl.

Sponsored by: Netflix

22 months agosound(4): Fix memory map of /dev/dsp devices when buffer size is not a multiple of...
Florian Walpen [Fri, 4 Nov 2022 18:04:26 +0000 (19:04 +0100)]
sound(4): Fix memory map of /dev/dsp devices when buffer size is not a multiple of PAGE_SIZE.

By using sndbuf_getallocsize() instead of sndbuf_getsize() in dsp_mmap_single().

PR: 267555
MFC after: 1 week
Sponsored by: NVIDIA Networking

22 months agogetty: Avoid NULL deref if stdin is not a tty.
Dag-Erling Smørgrav [Fri, 4 Nov 2022 14:43:06 +0000 (15:43 +0100)]
getty: Avoid NULL deref if stdin is not a tty.

Sponsored by: Klara, Inc.
Obtained from: Apple OSS Distributions
Differential Revision: https://reviews.freebsd.org/D37265

22 months agogetty: code cleanup, part 2
Dag-Erling Smørgrav [Fri, 4 Nov 2022 14:21:43 +0000 (15:21 +0100)]
getty: code cleanup, part 2

* Clean up whitespace
* Reindent

Sponsored by: Klara, Inc.

22 months agogetty: code cleanup, part 1
Dag-Erling Smørgrav [Fri, 4 Nov 2022 13:23:33 +0000 (14:23 +0100)]
getty: code cleanup, part 1

* Avoid unnecessary use of `unsigned char *`
* Use explicit casts when assigning `unsigned char *` to `char *` or vice versa
* Drop unused global variables (and fix memory leak in `gettable()`)
* Use `snprintf()` instead of `strcpy()` + `strcat()`
* Drop spurious braces in switch

Sponsored by: Klara, Inc.
Obtained from: Apple OSS Distributions (in part)
Differential Revision: https://reviews.freebsd.org/D37263

22 months agogzip: Add support for decompressing zstd files.
Dag-Erling Smørgrav [Wed, 2 Nov 2022 13:41:44 +0000 (14:41 +0100)]
gzip: Add support for decompressing zstd files.

Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D37236

22 months agoarm64: Hyper-V: making INTR MP Safe
Souradeep Chakrabarti [Fri, 4 Nov 2022 10:09:02 +0000 (10:09 +0000)]
arm64: Hyper-V: making INTR MP Safe

Makeing the interrupt MP safe.

Reviewed by: andrew
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D37222

22 months agotcp: reserve tcp_info counters for AccECN
Richard Scheffenegger [Fri, 4 Nov 2022 09:18:41 +0000 (10:18 +0100)]
tcp: reserve tcp_info counters for AccECN

Marking all new fields unused (__xxx).

No functional change.

Reviewed By: tuexen, rrs, #transport
Sponsored by: NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D37016

22 months agobhyve: initial PowerCycles value
Wanpeng Qian [Fri, 4 Nov 2022 07:48:00 +0000 (08:48 +0100)]
bhyve: initial PowerCycles value

Currently PowerCycles field of Log Page is 0 and it is an invalid value.
This patch will initial the PowerCycles data to 1.

MFC after: 1 week
Approved by: manu (mentor)
Reviewed By: grehan (older version), chuck, corvink
Differential Revision: https://reviews.freebsd.org/D32558

22 months agomana(4): Make the code cross-platform
Li-Wen Hsu [Fri, 4 Nov 2022 03:45:35 +0000 (11:45 +0800)]
mana(4): Make the code cross-platform

Discussed with: whu
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D36388

22 months agorelease/azure: Don't use azure-agent deprovision to build image
Li-Wen Hsu [Thu, 3 Nov 2022 19:17:43 +0000 (03:17 +0800)]
release/azure: Don't use azure-agent deprovision to build image

Deprovision feature of waagent is used for preparing to capture a
running VM and turn it into a VM image.  Using it in the process of
building a VM image from scratch will cause some side effects such as
the hostname of the building host getting reset.

Remove calling the deprovision command and use a simpler way to fulfill
the requirements of the Azure VM image.

Sponsored by: The FreeBSD Foundation

22 months agonetlink: allow more than 64 groups per netlink socket.
Alexander V. Chernikov [Thu, 3 Nov 2022 16:44:07 +0000 (16:44 +0000)]
netlink: allow more than 64 groups per netlink socket.

22 months agonetlink: remove private netlink_var.h header from the non-netlink core files.
Alexander V. Chernikov [Thu, 3 Nov 2022 17:03:26 +0000 (17:03 +0000)]
netlink: remove private netlink_var.h header from the non-netlink core files.

22 months agoEnable hyperv in the arm64 NOTES
Andrew Turner [Thu, 3 Nov 2022 15:49:49 +0000 (15:49 +0000)]
Enable hyperv in the arm64 NOTES

It now builds with all arm64 LINT kernels.

Sponsored by: The FreeBSD Foundation

22 months agoHyper-V depends on ACPI, mark as such in files.arm64
Andrew Turner [Thu, 3 Nov 2022 15:11:25 +0000 (15:11 +0000)]
Hyper-V depends on ACPI, mark as such in files.arm64

Sponsored by: The FreeBSD Foundation

22 months agoPlace the hyperv files with other dev files
Andrew Turner [Thu, 3 Nov 2022 15:05:04 +0000 (15:05 +0000)]
Place the hyperv files with other dev files

Move the files enabled by hyperv with others under sys/dev rather than
at the end of the file.

Sponsored by: The FreeBSD Foundation

22 months agoClean up "optional hyperv" indentation in files.arm64
Andrew Turner [Thu, 3 Nov 2022 15:03:27 +0000 (15:03 +0000)]
Clean up "optional hyperv" indentation in files.arm64

Make them all align and use a space after "optional"

Sponsored by: The FreeBSD Foundation

22 months agoRevert "Disable Hyper-V on arm64"
Andrew Turner [Thu, 3 Nov 2022 12:01:36 +0000 (12:01 +0000)]
Revert "Disable Hyper-V on arm64"

This reverts commit fe36346a8904683af64dc5231e106a951d386ca5.

The arm64 Hyper-v code now checks it is running under Hyper-v before
calling into the hypervisor.

Sponsored by: The FreeBSD Foundation

22 months agoping_test: Fix tests ping_46 and ping6_46
Jose Luis Duran [Wed, 2 Nov 2022 11:43:40 +0000 (08:43 -0300)]
ping_test: Fix tests ping_46 and ping6_46

If no IPv4-host, IPv4-mcast-group or IPv6-host is passed, it will
display the usage.  The tests are passing because they are just checking
that the exit code is 1.

Fix the tests by checking the appropriate output message.

While here, change the description to match the output and add the
missing requirements.

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

22 months agoping_test: Code cleanup
Jose Luis Duran [Mon, 31 Oct 2022 08:23:33 +0000 (05:23 -0300)]
ping_test: Code cleanup

Mostly style fixes.

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

22 months agoping: Remove a vestigial notdef
Jose Luis Duran [Tue, 1 Nov 2022 08:01:36 +0000 (05:01 -0300)]
ping: Remove a vestigial notdef

It was once a function on 4.3BSD, pr_type() [1], used to convert an ICMP
"type" field to a printable string.  In 4.4BSD it was superseded by
pr_icmph() [2].

NetBSD [3] and OpenBSD [4] have already removed it.

[1]: https://minnie.tuhs.org/cgi-bin/utree.pl?file=4.3BSD/usr/src/etc/ping.c
[2]: https://minnie.tuhs.org/cgi-bin/utree.pl?file=4.4BSD/usr/src/sbin/ping/ping.c
[3]: https://github.com/NetBSD/src/commit/203dfd34867991fd002f747d74a96f26ae80d41c
[4]: https://github.com/openbsd/src/commit/9bbbbbb75d24e3d166ddd0cb6cb4417b78561309

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

22 months agoping: main.c: Consistent use of white space/tabs
Jose Luis Duran [Tue, 1 Nov 2022 05:19:22 +0000 (02:19 -0300)]
ping: main.c: Consistent use of white space/tabs

If a user has tabs set at a value other than 8, the output of the usage
may not be consistently aligned.

    % tabs -2

Before:
    % ping
    usage:
      ping [-4AaDdfHnoQqRrv] [-C pcp] [-c count] [-G sweepmaxsize]
          [-g sweepminsize] [-h sweepincrsize] [-i wait] [-l preload]
          [-M mask | time] [-m ttl] [-P policy] [-p pattern] [-S src_addr]
          [-s packetsize] [-t timeout] [-W waittime] [-z tos] IPv4-host
      ping [-4AaDdfHLnoQqRrv] [-C pcp] [-c count] [-I iface] [-i wait]
          [-l preload] [-M mask | time] [-m ttl] [-P policy] [-p pattern]
          [-S src_addr] [-s packetsize] [-T ttl] [-t timeout] [-W waittime]
                [-z tos] IPv4-mcast-group
      ping [-6AaDdfHnNoOquvyY] [-b bufsiz] [-c count] [-e gateway]
                [-I interface] [-i wait] [-k addrtype] [-l preload] [-m hoplimit]
                [-p pattern] [-P policy] [-S sourceaddr] [-s packetsize] [-t timeout]
          [-W waittime] [-z tclass] [IPv6-hops ...] IPv6-host

After:
    % ping
    usage:
      ping [-4AaDdfHnoQqRrv] [-C pcp] [-c count] [-G sweepmaxsize]
          [-g sweepminsize] [-h sweepincrsize] [-i wait] [-l preload]
          [-M mask | time] [-m ttl] [-P policy] [-p pattern] [-S src_addr]
          [-s packetsize] [-t timeout] [-W waittime] [-z tos] IPv4-host
      ping [-4AaDdfHLnoQqRrv] [-C pcp] [-c count] [-I iface] [-i wait]
          [-l preload] [-M mask | time] [-m ttl] [-P policy] [-p pattern]
          [-S src_addr] [-s packetsize] [-T ttl] [-t timeout] [-W waittime]
          [-z tos] IPv4-mcast-group
      ping [-6AaDdfHnNoOquvyY] [-b bufsiz] [-c count] [-e gateway]
          [-I interface] [-i wait] [-k addrtype] [-l preload] [-m hoplimit]
          [-p pattern] [-P policy] [-S sourceaddr] [-s packetsize] [-t timeout]
          [-W waittime] [-z tclass] [IPv6-hops ...] IPv6-host

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

22 months agossh: correct parse_cert_times case for hex "to" time
Ed Maste [Thu, 3 Nov 2022 13:44:52 +0000 (09:44 -0400)]
ssh: correct parse_cert_times case for hex "to" time

This appeared to be a copy-paste error from the "from" time case above.

Reported by: Coverity Scan
CID: 1500407
Reviewed by: markj
MFC after: 3 days
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D37252

22 months agoxen/netfront: deal with mbuf data crossing a page boundary
Roger Pau Monné [Thu, 3 Nov 2022 12:29:22 +0000 (13:29 +0100)]
xen/netfront: deal with mbuf data crossing a page boundary

There's been a report recently of mbufs with data that crosses a page
boundary. It seems those mbufs are generated by the iSCSI target
system:

https://lists.xenproject.org/archives/html/xen-devel/2021-12/msg01581.html

In order to handle those mbufs correctly on netfront use the bus_dma
interface and explicitly request that segments must not cross a page
boundary. No other requirements are necessary, so it's expected that
bus_dma won't need to bounce the data and hence it shouldn't
introduce a too big performance penalty.

Using bus_dma requires some changes to netfront, mainly in order to
accommodate for the fact that now ring slots no longer have a 1:1
match with mbufs, as a single mbuf can use two ring slots if the data
buffer crosses a page boundary. Store the first packet of the mbuf
chain in every ring slot that's used, and use a mbuf tag in order to
store the bus_dma related structures and a refcount to keep track of
the pending slots before the mbuf chain can be freed.

Reported by: G.R.
Tested by: G.R.
MFC: 1 week
Differential revision: https://reviews.freebsd.org/D33876

22 months agoAdd more SOC options to the arm64 NOTES file
Andrew Turner [Thu, 3 Nov 2022 09:44:08 +0000 (09:44 +0000)]
Add more SOC options to the arm64 NOTES file

These are found in other config files. Include them in NOTES so they
are used in the LINT configs.