]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
19 months agogetaddrinfo: distinguish missing addrs from unresolvable names
Mike Karels [Wed, 2 Nov 2022 15:57:59 +0000 (10:57 -0500)]
getaddrinfo: distinguish missing addrs from unresolvable names

Rework getaddrinfo(3) to return different error values for unresolvable
names (same as before, EAI_NONAME) and those without a requested addr
(EAI_ADDRFAMILY) when using DNS.  This is implemented via an added
error in the nsswitch layer, NS_ADDRFAMILY, which is used only by
getaddrinfo().  The error is passed through nsdispatch(3), but that
routine has no changes to handle this error.  The error originates in
the getaddrinfo DNS layer called via nsdispatch(), and is processed
by the search layer that calls nsdispatch().

While here, add a little style to returns near those that were
modified.

Reviewed in https://reviews.freebsd.org/D37139 with related changes.

Reviewed by:    bz
MFC after:      1 month

19 months agogai_strerror.[c3]: re-enable EAI_ADDRFAMILY, EAI_NODATA
Mike Karels [Wed, 2 Nov 2022 15:55:32 +0000 (10:55 -0500)]
gai_strerror.[c3]: re-enable EAI_ADDRFAMILY, EAI_NODATA

gai_strerror.c still has messages for EAI_ADDRFAMILY and EAI_NODATA,
but not the man page.  Re-add to the man page, and update comments
in the source.  Document the errors that are not in RFC 3493 or
POSIX.

Reviewed in https://reviews.freebsd.org/D37139 with related changes.

Reviewed by:    bz, pauamma
MFC after:      1 month

19 months agonetdb.h: re-enable EAI_ADDRFAMILY, EAI_NODATA
Mike Karels [Wed, 2 Nov 2022 15:43:04 +0000 (10:43 -0500)]
netdb.h: re-enable EAI_ADDRFAMILY, EAI_NODATA

EAI_ADDRFAMILY and EAI_NODATA are not in RFC 3493, but are available
and used in many other systems.  It is desirable to have at least one
of them in order to distinguish between names that do not resolve and
those that do not have the requested address type.  A change to
getaddrinfo() will use EAI_ADDRFAMILY.  Both were "#if 0"; re-enable,
conditioned on __BSD_VISIBLE, and update comments.  Also add comments
and __BSD_VISIBLE conditional for the last three EAI errors, which
are not in the RFC or POSIX.  Note, all of these are available in
NetBSD and OpenBSD, and EAI_ADDRFAMILY and EAI_NODATA are available
in Linux (glibc).

Reviewed in https://reviews.freebsd.org/D37139 with related changes.

Reviewed by: bz
MFC after: 1 month

19 months agoAdd corvink to the src committers and manu as my mentor
Corvin Köhne [Wed, 2 Nov 2022 15:56:38 +0000 (16:56 +0100)]
Add corvink to the src committers and manu as my mentor

Approved by: manu (mentor)
Differential Revision: https://reviews.freebsd.org/D37237

19 months agolinux64: improve linux_support.s make rules
Ed Maste [Tue, 19 Jul 2022 20:42:27 +0000 (16:42 -0400)]
linux64: improve linux_support.s make rules

Previously we relied on the .s.o rule in share/mk/bsd.suffixes.mk to
tell make that linux_support.o is built from linux_support.s, even
though we do not use the .s.o rule to assemble it.

Reviewed by: sjg
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D35864

19 months agostand: Nuke double-semicolons
Elliott Mitchell [Mon, 16 Aug 2021 22:51:38 +0000 (15:51 -0700)]
stand: Nuke double-semicolons

A distinct number of double-semicolons have ended up in FreeBSD.  Take a
pass at getting rid of many of these harmless typos.

Reviewed by: emaste, imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/609
Differential Revision: https://reviews.freebsd.org/D31717

19 months agosys: Nuke double-semicolons
Elliott Mitchell [Mon, 16 Aug 2021 22:51:38 +0000 (15:51 -0700)]
sys: Nuke double-semicolons

A distinct number of double-semicolons have ended up in FreeBSD.  Take a
pass at getting rid of many of these harmless typos.

Reviewed by: emaste, rrs
Pull Request: https://github.com/freebsd/freebsd-src/pull/609
Differential Revision: https://reviews.freebsd.org/D31716

19 months agovmw_pvscsi: Expand vcpuHint to 16 bit to aliagn with host side change.
Wentao Wang [Wed, 2 Nov 2022 15:14:52 +0000 (09:14 -0600)]
vmw_pvscsi: Expand vcpuHint to 16 bit to aliagn with host side change.

vcpuHint has been expanded to 16 bit on host side to enable
interruptions to be routed to more CPUs. Guest side should align with
the change.

This change has been tested with hosts with 8-bit and 16-bit vcpuHint,
on both platforms host side can get correct value.

This driver is for ESXi product which only supports x86/x64. They are
little-endian. So there is no need to consider big-endian system.

PR: 264840
Reviewed by: imp@, Zhenlei Huang

19 months agopf tests: bridge-to test case
Kristof Provost [Fri, 28 Oct 2022 09:56:43 +0000 (11:56 +0200)]
pf tests: bridge-to test case

Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D37194

19 months agopf: bridge-to
Kristof Provost [Thu, 22 Sep 2022 17:00:11 +0000 (19:00 +0200)]
pf: bridge-to

Allow pf (l2) to be used to redirect ethernet packets to a different
interface.

The intended use case is to send 802.1x challenges out to a side
interface, to enable AT&T links to function with pfSense as a gateway,
rather than the AT&T provided hardware.

Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D37193

19 months agosys: use .S for assembly language files that use the preprocessor
Elliott Mitchell [Sun, 24 Jul 2022 23:14:20 +0000 (16:14 -0700)]
sys: use .S for assembly language files that use the preprocessor

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/609
Differential Revision: https://reviews.freebsd.org/D35908

19 months agoipsec tests: add test case for chacha20_poly1305
Kristof Provost [Tue, 18 Oct 2022 16:34:00 +0000 (18:34 +0200)]
ipsec tests: add test case for chacha20_poly1305

Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D37181

19 months agoipsec: add support for CHACHA20POLY1305
Kristof Provost [Tue, 18 Oct 2022 16:31:02 +0000 (18:31 +0200)]
ipsec: add support for CHACHA20POLY1305

Based on a patch by ae@.

Reviewed by: gbe (man page), pauamma (man page)
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D37180

19 months agobridge tests: re-enable span test
Kristof Provost [Wed, 2 Nov 2022 10:58:04 +0000 (11:58 +0100)]
bridge tests: re-enable span test

The root cause of the intermittent span test failures has been
identified as a race between sending the packet and starting the bpf
capture.
This is now resolved, so the test can be re-enabled.

PR: 260461
MFC after: 1 week
Sponsored by: Rubicon Communications, LLC ("Netgate")

19 months agotests: make sniffer more robust
Kristof Provost [Wed, 2 Nov 2022 10:55:39 +0000 (11:55 +0100)]
tests: make sniffer more robust

The Sniffer class is often used by test tools such as pft_ping to verify
that packets actually get sent where they're expected.

It starts a background thread to capture packets, but this thread needs
some time to start, leading to intermittent test failures when the
capture doesn't start before the relevant packet is sent.

Add a semaphore to ensure the Sniffer constructor doesn't return until
the capture is actually running.

PR: 260461
MFC after: 1 week
Sponsored by: Rubicon Communications, LLC ("Netgate")

19 months agoAdd myself (zlei) as a src committer and kp / melifaro as my mentors
Zhenlei Huang [Wed, 2 Nov 2022 03:53:24 +0000 (11:53 +0800)]
Add myself (zlei) as a src committer and kp / melifaro as my mentors

Follow step 7.1.5 in the Committer's Guide.

Reviewed by: kp
Approved by: kp (mentor)
Differential Revision: https://reviews.freebsd.org/D37233

19 months agoOpenSSL: Regen manual pages for OpenSSL 1.1.1s
Jung-uk Kim [Tue, 1 Nov 2022 23:38:40 +0000 (19:38 -0400)]
OpenSSL: Regen manual pages for OpenSSL 1.1.1s

19 months agoOpenSSL: Regen assembly file for OpenSSSL 1.1.1s
Jung-uk Kim [Tue, 1 Nov 2022 23:12:09 +0000 (19:12 -0400)]
OpenSSL: Regen assembly file for OpenSSSL 1.1.1s

19 months agoOpenSSL: Merge OpenSSL 1.1.1s
Jung-uk Kim [Tue, 1 Nov 2022 22:58:59 +0000 (18:58 -0400)]
OpenSSL: Merge OpenSSL 1.1.1s

Merge commit 'b6b67f23b82101d4c04c89f81d726b902ab77106'

19 months agotools/build/make.py: fix cross build on Fedora Linux
Alfredo Dal'Ava Junior [Tue, 1 Nov 2022 23:59:58 +0000 (20:59 -0300)]
tools/build/make.py: fix cross build on Fedora Linux

Fedora defines shell functions for some commands used by FreeBSD build
scripts. Unortunatelly it makes them behave incorrectly for our purposes.

For instance 'which which' returns something like:

which ()
{
    ( alias;
    eval ${which_declare} ) | /usr/bin/which --tty-only --read-alias ...
}

instead of

/usr/bin/which

This patch unsets those functions to restore original/expected behavior

Reviewed by: emaste, imp
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D36900

19 months agoImport OpenSSL 1.1.1s
Jung-uk Kim [Tue, 1 Nov 2022 22:43:36 +0000 (18:43 -0400)]
Import OpenSSL 1.1.1s

19 months agovmm: do not leak halted_cpus bit after suspension
Konstantin Belousov [Mon, 31 Oct 2022 23:30:55 +0000 (01:30 +0200)]
vmm: do not leak halted_cpus bit after suspension

Reported by: bz
PR: 267468
Reviewed by: markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D37227

19 months agogrep: correct argument name in man page
Elvin Aslanov [Tue, 1 Nov 2022 14:07:56 +0000 (18:07 +0400)]
grep: correct argument name in man page

MFC after: 1 week
Fixes: 4dc88ebedf94 ("Add BSD grep to the base system...")
Pull Request: https://github.com/freebsd/freebsd-src/pull/622

19 months agong_hci: handle NG_HCI_M_PULLUP failure in le_advertizing_report
Ed Maste [Tue, 1 Nov 2022 13:55:22 +0000 (09:55 -0400)]
ng_hci: handle NG_HCI_M_PULLUP failure in le_advertizing_report

PR: 267396
Reported by: Robert Morris <rtm@lcs.mit.edu>
Reviewed by: takawata
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D37228

19 months agoipmi: use a queue for kcs driver requests when possible
Chuck Silvers [Tue, 1 Nov 2022 17:55:14 +0000 (10:55 -0700)]
ipmi: use a queue for kcs driver requests when possible

The ipmi watchdog pretimeout action can trigger unintentionally in
certain rare, complicated situations.  What we have seen at Netflix
is that the BMC can sometimes be sent a continuous stream of
writes to port 0x80, and due to what is a bug or misconfiguration
in the BMC software, this results in the BMC running out of memory,
becoming very slow to respond to KCS requests, and eventually being
rebooted by its own internal watchdog.  While that is going on in
the BMC, back in the host OS, a number of requests are pending in
the ipmi request queue, and the kcs_loop thread is working on
processing these requests.  All of the KCS accesses to process
those requests are timing out and eventually failing because the
BMC is responding very slowly or not at all, and the kcs_loop thread
is holding the IPMI_IO_LOCK the whole time that is going on.
Meanwhile the watchdogd process in the host is trying to pat the
BMC watchdog, and this process is sleeping waiting to get the
IPMI_IO_LOCK.  It's not entirely clear why the watchdogd process
is sleeping for this lock, because the intention is that a thread
holding the IPMI_IO_LOCK should not sleep and thus any thread
that wants the lock should just spin to wait for it.  My best guess
is that the kcs_loop thread is spinning waiting for the BMC to
respond for so long that it is eventually preempted, and during
the brief interval when the kcs_loop thread is not running,
the watchdogd thread notices that the lock holder is not running
and sleeps.  When the kcs_loop thread eventually finishes processing
one request, it drops the IPMI_IO_LOCK and then immediately takes the
lock again so it can process the next request in the queue.
Because the watchdogd thread is sleeping at this point, the kcs_loop
always wins the race to acquire the IPMI_IO_LOCK, thus starving
the watchdogd thread.  The callout for the watchdog pretimeout
would be reset by the watchdogd thread after its request to the BMC
watchdog completes, but since that request never processed, the
pretimeout callout eventually fires, even though there is nothing
actually wrong with the host.

To prevent this saga from unfolding:

 - when kcs_driver_request() is called in a context where it can sleep,
   queue the request and let the worker thread process it rather than
   trying to process in the original thread.
 - add a new high-priority queue for driver requests, so that the
   watchdog patting requests will be processed as quickly as possible
   even if lots of application requests have already been queued.

With these two changes, the watchdog pretimeout action does not trigger
even if the BMC is completely out to lunch for long periods of time
(as long as the watchdogd check command does not also get stuck).

Sponsored by: Netflix
Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D36555

19 months agopf tests: make killstate tests more robust
Kristof Provost [Tue, 1 Nov 2022 17:03:50 +0000 (18:03 +0100)]
pf tests: make killstate tests more robust

Rather than using a Scapy-based Python script only check if the state
still exists. Scapy tends to be slow to start, it appears because it
lists all interfaces and gets their (IPv6) addresses a couple of times
at startup. This can be sufficient for the ICMP state to time out and
the test to fail.

We now only check if the state exists or is removed as expected, which
makes things faster, and should mean the test is more robust on slower
machines (such as CI VMs).

Sponsored by: Rubicon Communications, LLC ("Netgate")

19 months agoFix a panic on boot introduced by 555a861d6826
Andrew Gallatin [Tue, 1 Nov 2022 17:44:39 +0000 (13:44 -0400)]
Fix a panic on boot introduced by 555a861d6826

First, an sbuf_new() in device_get_path() shadows the sb
passed in by dev_wired_cache_add(), leaving its sb in an
unfinished state, leading to a failed KASSERT().  Fixing this
is as simple as removing the sbuf_new() from device_get_path()

Second, we cannot simply take a pointer to the sbuf memory and
store it in the device location cache, because that sbuf
is freed immediately after we add data to the cache, leading
to a use-after-free and eventually a double-free.  Fixing this
requires allocating memory for the path.

After a discussion with jhb, we decided that one malloc was
better than two in dev_wired_cache_add, which is why it changed
so much.

Reviewed by: jhb
Sponsored by: Netflix
MFC after: 14 days

19 months agonetlink: add netlink user documentation.
Alexander V. Chernikov [Tue, 1 Nov 2022 12:20:13 +0000 (12:20 +0000)]
netlink: add netlink user documentation.

Add netlink(4) as a "frontend" manpage describing netlink in general.
Add rtnelink(4) describing supported commands and attributes in
NETLINK_ROUTE family.
Add genetlink(4) describing generic netlink API.

Reviewed by: pauamma
Differential Revision: https://reviews.freebsd.org/D37011

19 months agoREADME.md: link to the list of supported platforms
Mitchell Horne [Tue, 1 Nov 2022 15:20:01 +0000 (12:20 -0300)]
README.md: link to the list of supported platforms

It answers a question that someone might have when faced with the source
tree for the first time, and improves discoverability of the platforms
page.

Reviewed by: emaste
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D37179

19 months agodevelopment(7): redirect users from hier(7)
Mitchell Horne [Tue, 1 Nov 2022 15:18:53 +0000 (12:18 -0300)]
development(7): redirect users from hier(7)

The layout of the source tree is now only described in README.md. Retain
the cross-reference to hier(7) in SEE ALSO; it is still useful to
readers.

Reviewed by: imp, emaste
MFC after: 1 month
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D37136

19 months agohier(7): remove text describing /usr/src layout
Mitchell Horne [Tue, 1 Nov 2022 15:15:18 +0000 (12:15 -0300)]
hier(7): remove text describing /usr/src layout

It poses a maintenance burden, since much of the information is
duplicated in the src tree's README.md file. Readers who are interested
enough in learning about the structure of the src tree can download it,
or browse the README online. Have hier(7) just point them there instead.

PR: 261349
Discussed with: freebsd-arch@, freebsd-doc@ lists
Reviewed by: imp, emaste
MFC after: 1 month
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D37135

19 months agoREADME.md: shift description of kernel config files
Mitchell Horne [Tue, 1 Nov 2022 15:14:41 +0000 (12:14 -0300)]
README.md: shift description of kernel config files

Document it in sys/README.md instead. Describe the purpose of LINT
config files as well.

Reviewed by: imp
MFC after: 1 month
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D37134

19 months agosys/README.md: source roadmap improvements
Mitchell Horne [Tue, 1 Nov 2022 15:13:31 +0000 (12:13 -0300)]
sys/README.md: source roadmap improvements

Tweak the existing descriptions slightly. Add entries for several
directories which are not yet documented, but not exhaustively.

Reviewed by: imp (previous version), emaste
MFC after: 1 month
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D37133

19 months agoCreate sys/README.md
Mitchell Horne [Tue, 1 Nov 2022 15:12:14 +0000 (12:12 -0300)]
Create sys/README.md

Add this primarily to document the sys/ subdirectories of the source tree.

This is a straight copy from the contents of hier(7). Improvements will
follow in other changes.

Reviewed by: imp, emaste
MFC after: 1 month
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D37132

19 months agoarm64: Hyper-V: fixing hung issue during Hyper-V initialization
Souradeep Chakrabarti [Tue, 1 Nov 2022 14:06:01 +0000 (14:06 +0000)]
arm64: Hyper-V: fixing hung issue during Hyper-V initialization

In non-Hyper-V systems during Hyper-V initialization, system
initialization was getting hung, as hyperv_identify(),
was returning successful irrespective of the type of the platform.

Reviewed by: andrew, whu
Fixes: 9729f076e4d
Sponsored by: Microsoft
Differential Revision: https://reviews.freebsd.org/D37219

19 months agolibc_nonshared: Move to clibs package
Doug Rabson [Tue, 1 Nov 2022 10:14:29 +0000 (10:14 +0000)]
libc_nonshared: Move to clibs package

Its needed by libc.a which lives in clibs.

PR: 254173

19 months agobsd.sanitizer.mk: Fix a typo in a comment
Gordon Bergling [Tue, 1 Nov 2022 08:18:34 +0000 (09:18 +0100)]
bsd.sanitizer.mk: Fix a typo in a comment

- s/santizers/sanitizers/

MFC after: 3 days

19 months agoisci(4): Fix common typos in source code comments
Gordon Bergling [Tue, 1 Nov 2022 07:34:11 +0000 (08:34 +0100)]
isci(4): Fix common typos in source code comments

- s/assinged/assigned/

MFC after: 3 days

19 months agoxilinx: Fix a typo in a source code comment
Gordon Bergling [Tue, 1 Nov 2022 07:00:53 +0000 (08:00 +0100)]
xilinx: Fix a typo in a source code comment

- s/interrut/interrupt/

MFC after: 3 days

19 months agoisci(4): Fix a typo in a source code comment
Gordon Bergling [Tue, 1 Nov 2022 06:58:26 +0000 (07:58 +0100)]
isci(4): Fix a typo in a source code comment

- s/interrutp/interrupt/

MFC after:3 days

19 months agobxe(4): Fix a typo in a source code comment
Gordon Bergling [Tue, 1 Nov 2022 06:55:55 +0000 (07:55 +0100)]
bxe(4): Fix a typo in a source code comment

- s/interrutps/interrupts/

MFC after: 3 days

19 months agodtrace: Fix the i386 FBT build
Mark Johnston [Tue, 1 Nov 2022 04:14:30 +0000 (00:14 -0400)]
dtrace: Fix the i386 FBT build

Reported by: Jenkins
Fixes: 0e69c959150c ("dtrace: Fix up %rip for invop probes on x86")

19 months agoLinuxKPI: 802.11: pass internal variable to lkpi_80211_mo_sta_state()
Bjoern A. Zeeb [Mon, 31 Oct 2022 23:53:26 +0000 (23:53 +0000)]
LinuxKPI: 802.11: pass internal variable to lkpi_80211_mo_sta_state()

With mac80211 operations (MO) tracing on we have seen some ill-ordered
executions of MO functions.  In order to limit visibility of the mac80211
sta, pass the internal version into lkpi_80211_mo_sta_state() and only
there convert to the argument needed.  This mostly eases tracing and
debugging.

Sposnored by: The FreeBSD Foundation
MFC after: 3 days

19 months agodtrace: Fix up %rip for invop probes on x86
Mark Johnston [Mon, 31 Oct 2022 23:11:36 +0000 (19:11 -0400)]
dtrace: Fix up %rip for invop probes on x86

When a breakpoint exception is raised, the saved value of %rip points to
the instruction following the breakpoint.  However, when fetching the
value of %rip using regs[], it's more natural to provide the address of
the breakpoint itself, so modify the kinst and fbt providers accordingly.

Reported by: khng
Reviewed by: christos, khng
MFC after: 2 months
Differential Revision: https://reviews.freebsd.org/D37218

19 months agoLinuxKPI: 802.11: update struct member types
Bjoern A. Zeeb [Mon, 31 Oct 2022 22:24:08 +0000 (22:24 +0000)]
LinuxKPI: 802.11: update struct member types

Update struct member types for ongoing work towards HT support.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days

19 months agoLinuxKPI: 802.11 update header files
Bjoern A. Zeeb [Mon, 31 Oct 2022 22:09:25 +0000 (22:09 +0000)]
LinuxKPI: 802.11 update header files

Adjust struct members, add more (for HE dummy) defines, add more
(wrapper) functions in order to acoomodate another driver.

MFC after: 3 days

19 months agomount_unionfs: remove jokey cautions from man page
Ed Maste [Mon, 31 Oct 2022 20:38:46 +0000 (16:38 -0400)]
mount_unionfs: remove jokey cautions from man page

There are known issues with unionfs, and the mount_unionfs man page has
a cautionary statement about its use.  The caution had additional
"humourous" statements like "BEWARE OF DOG" but they served only to
confuse the situation.  Remove them.

MFC after: 1 week
Sponsored by: The FreeBSD Foundation

19 months agopf tests: verify syncookie status report
Kristof Provost [Mon, 31 Oct 2022 11:15:58 +0000 (12:15 +0100)]
pf tests: verify syncookie status report

Verify that pfctl -si -v correctly shows syncookies to be
active/inactive.

Sponsored by: Rubicon Communications, LLC ("Netgate")

19 months agopf: expose syncookie active/inactive status
Kristof Provost [Sat, 24 Sep 2022 12:47:17 +0000 (14:47 +0200)]
pf: expose syncookie active/inactive status

When syncookies are in adaptive mode they may be active or inactive.
Expose this status to users.

Suggested by: Guido van Rooij
Sponsored by: Rubicon Communications, LLC ("Netgate")

19 months agonetlink: fix CTRL_CMD_GETFAMILY lookup/dumps.
Alexander V. Chernikov [Mon, 31 Oct 2022 17:11:53 +0000 (17:11 +0000)]
netlink: fix CTRL_CMD_GETFAMILY lookup/dumps.

Reported by: bapt

19 months agotcp.4: undocument compressed TIME_WAIT
Gleb Smirnoff [Mon, 31 Oct 2022 16:02:33 +0000 (09:02 -0700)]
tcp.4: undocument compressed TIME_WAIT

19 months agotcp: make tcp_handle_wakeup() static and robust
Gleb Smirnoff [Mon, 31 Oct 2022 15:57:15 +0000 (08:57 -0700)]
tcp: make tcp_handle_wakeup() static and robust

It is called only from tcp_input() and always has valid parameter.

Reviewed by: rscheff, tuexen
Differential revision: https://reviews.freebsd.org/D37115

19 months agoinpcb: retire suppresion of randomization of ephemeral ports
Gleb Smirnoff [Mon, 31 Oct 2022 15:57:11 +0000 (08:57 -0700)]
inpcb: retire suppresion of randomization of ephemeral ports

The suppresion was added in 5f311da2ccb with no explanation in the
commit message of the exact problem that was fixed. In the BSDCan
2006 talk [1], slides 12 to 14, we can find that it seems that there
was some problem with the TIME_WAIT state not properly being handled
on the remote side (also FreeBSD!), and this switching off the
suppression had hidden the problem.  The rationale of the change was
that other stacks may also be buggy wrt the TIME_WAIT.

I did not find the actual problem in TIME_WAIT that the suppression
has hidden, neither a commit that would fix it.  However, since that
time we started to handle SYNs with RFC5961 instead of RFC793, see
3220a2121cc.  We also now have the tcp-testsuite [2], that has full
coverage of all possible scenarios of receiving SYN in TIME_WAIT.

This effectively reverts 5f311da2ccb6c216b79049172be840af4778129a
and 6ee79c59d2c081f837a11cc78908be54a6dbe09d.

[1] https://www.bsdcan.org/2006/papers/ImprovingTCPIP.pdf
[2] https://github.com/freebsd-net/tcp-testsuite

Reviewed by: rscheff
Discussed with: rscheff, rrs, tuexen
Differential revision: https://reviews.freebsd.org/D37042

19 months agoicmp: doesn't need tcp_var.h
Gleb Smirnoff [Mon, 31 Oct 2022 15:44:55 +0000 (08:44 -0700)]
icmp: doesn't need tcp_var.h

19 months agorack/bbr: put back assertion that connection is not in TIME-WAIT
Gleb Smirnoff [Mon, 31 Oct 2022 15:30:59 +0000 (08:30 -0700)]
rack/bbr: put back assertion that connection is not in TIME-WAIT

The assertion was incorrectly removed in 0d7445193ab.  The leak of
a TIME-WAIT state into tfb_do_segment_nounlock method was fixed in
31bc602ff81.  The TIME-WAIT connections are processed by the main
tcp_input() always.

19 months agonetlink: fix genetlink CTRL_ATTR_MCAST_GRP_MAX define.
Alexander V. Chernikov [Mon, 31 Oct 2022 15:03:27 +0000 (15:03 +0000)]
netlink: fix genetlink CTRL_ATTR_MCAST_GRP_MAX define.

Reported by: harti

19 months agonetlink: fix NLMSG_SPACE() macro.
Alexander V. Chernikov [Mon, 31 Oct 2022 15:02:12 +0000 (15:02 +0000)]
netlink: fix NLMSG_SPACE() macro.

Reported by: bapt

19 months agonetlink: fix generic netlink privilege check.
Alexander V. Chernikov [Mon, 31 Oct 2022 13:40:25 +0000 (13:40 +0000)]
netlink: fix generic netlink privilege check.

Reported by: bapt

19 months agoRemove wg.4 from ObsoleteFiles.inc
Gordon Bergling [Mon, 31 Oct 2022 09:38:38 +0000 (10:38 +0100)]
Remove wg.4 from ObsoleteFiles.inc

wg.4 is still included which is obsolete
since 744bfb213144. So remove the entry.

PR: 267455
Reported by: Larry Rosenman <ler at FreeBSD dot org>

19 months agonetgraph/ng_bridge: add missing array terminator
Kristof Provost [Mon, 31 Oct 2022 08:47:01 +0000 (09:47 +0100)]
netgraph/ng_bridge: add missing array terminator

PR: 267457
Reported by: Robert Morris <rtm@lcs.mit.edu>
MFC after: 1 week

19 months agomktemp: add -p/--tmpdir argument
Kyle Evans [Mon, 31 Oct 2022 03:55:46 +0000 (22:55 -0500)]
mktemp: add -p/--tmpdir argument

This matches other mktemp implementations, including OpenBSD and GNU.
The -p option can be used to provide a tmpdir prefix for specified
templates.  Precedence works out like so:

-t flag:
- $TMPDIR
- -p directory
- /tmp

Implied -t flag (no arguments or only -d flag):
- -p directory
- $TMPDIR
- /tmp

Some tests have been added for mktemp(1) in the process.

Reviewed by: imp (earlier version), wosch
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D37121

19 months agomktemp: add some GNU-compatible long options
Kyle Evans [Mon, 31 Oct 2022 03:55:46 +0000 (22:55 -0500)]
mktemp: add some GNU-compatible long options

GNU maketemp has long options for -d, -q, and -u, so let's add these
now for compatibility.

Reviewed by: emaste, imp, wosch
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D37120

19 months agols(1): add a -v flag to sort naturally
Aymeric Wibo [Sun, 23 Oct 2022 07:46:27 +0000 (09:46 +0200)]
ls(1): add a -v flag to sort naturally

Add a -v flag for ls which sorts entries following a natural ordering
using strverscmp(3) (e.g. "bloem1 bloem9 bloem10" as opposed to
"bloem1 bloem10 bloem9").

Update the manual page and add a test case.

Reviewed by: pauamma, bcr
Tested by: pstef
Differential Revision: https://reviews.freebsd.org/D36407

19 months agoAdditional diagnostic output when running fsck_ffs with debugging flag (-d)
Kirk McKusick [Sun, 30 Oct 2022 21:59:44 +0000 (14:59 -0700)]
Additional diagnostic output when running fsck_ffs with debugging flag (-d)

MFC after:    1 week
Sponsored by: The FreeBSD Foundation

19 months agodtrace: Load fasttrap on powerpc with dtraceall
Justin Hibbits [Sun, 30 Oct 2022 19:56:12 +0000 (15:56 -0400)]
dtrace: Load fasttrap on powerpc with dtraceall

This was missing from the original port of DTrace to powerpc 10 years
ago.

MFC after: 3 weeks

19 months agodtrace: Add pid provider to the build for powerpc
Justin Hibbits [Sun, 30 Oct 2022 19:40:05 +0000 (15:40 -0400)]
dtrace: Add pid provider to the build for powerpc

The fasttrap pid provider has been in place for a long time, but stopped
getting built by efe88d92da in preparation for 64-bit atomics.  32-bit
emulation of 64-bit atomics was added in 9aafc7c05.

MFC after: 3 weeks

19 months agodtrace: Make pid provider work on trivial tests
Justin Hibbits [Sun, 30 Oct 2022 19:33:06 +0000 (15:33 -0400)]
dtrace: Make pid provider work on trivial tests

'newpc' needs set in the "common" case.  With this, the trivial test

 $ dtrace -n 'pid$target:libc:strlen:entry { trace(timestamp); }' -p
 <pid>

now works.

MFC after: 3 weeks

19 months agoofed: allow using IPv6 address in rc_pingpong server
Piotr Kubaj [Fri, 28 Oct 2022 09:59:05 +0000 (11:59 +0200)]
ofed: allow using IPv6 address in rc_pingpong server

Summary:
The current OFED code allows binding server to IPv6 address. It was added back in https://github.com/linux-rdma/rdma-core/commit/91fc39561d04903cd5b1665d9215a184baa66ba9

Sponsored by: Intel Corporation
MFC after: 3 days

Reviewers: hselasky

Subscribers: imp

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

19 months agowg.4: Update the SPDX License Identifier
Gordon Bergling [Sun, 30 Oct 2022 18:05:30 +0000 (19:05 +0100)]
wg.4: Update the SPDX License Identifier

The following License Identifier
'BSD-2-Clause-FreeBSD' is not allowed
for new code so use the correct on.

Reported by: imp

19 months agoLinuxKPI: add timekeeping.h, another dummy (empty) header file
Bjoern A. Zeeb [Sun, 30 Oct 2022 17:21:26 +0000 (17:21 +0000)]
LinuxKPI: add timekeeping.h, another dummy (empty) header file

The file is included by a driver but it seems we don't need to implement
anything here.

MFC after: 3 days

19 months agointr_event(9): document intr_event_handle()
Mitchell Horne [Sun, 30 Oct 2022 14:02:20 +0000 (11:02 -0300)]
intr_event(9): document intr_event_handle()

Reviewed by: pauamma
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D36934

19 months agowg.4: Add some enhancements
Gordon Bergling [Sun, 30 Oct 2022 12:59:37 +0000 (13:59 +0100)]
wg.4: Add some enhancements

- add a SPDX-License-Identifier
- rename the title of the man page
- use better grammar in some places
- reword 'IPs' to 'IP addresses'
- add a missing word in the AUTHORS section
- use '.An -nosplit' in the AUTHORS section
- Xr ipsec and ovpn

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

19 months agotee.1: Add a HISTORY section
Gordon Bergling [Sun, 30 Oct 2022 10:29:59 +0000 (11:29 +0100)]
tee.1: Add a HISTORY section

The most accurate information I have found is that
tee(1) first appeared in Version 7 AT&T UNIX.

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

20 months agostrfmon: Remove XXX marks
Jose Luis Duran [Fri, 28 Oct 2022 09:20:33 +0000 (06:20 -0300)]
strfmon: Remove XXX marks

phantom@'s HDD crashed with the final version of strfmon.c, as explained
in 9d430a5991d3f64a75fee951a1efab3593207832.

Now there are tests in place that cover these code paths.

Reviewed by: kib
PR: 267410
Github PR: #620
MFC after: 1 week

20 months agostrfmon_l: Use specified locale for number formatting
Jose Luis Duran [Fri, 28 Oct 2022 01:24:48 +0000 (22:24 -0300)]
strfmon_l: Use specified locale for number formatting

strfmon_l does not take fully into consideration the explicitly passed
locale to perform the formatting.

Parallel universe bug report: https://sourceware.org/bugzilla/show_bug.cgi?id=19633

Obtained from: Darwin
Reviewed by: kib
PR: 267410
Github PR: #620
MFC after: 1 week

20 months agostrfmon_test: Add a test for strfmon_l
Jose Luis Duran [Fri, 28 Oct 2022 02:53:43 +0000 (23:53 -0300)]
strfmon_test: Add a test for strfmon_l

Attempt to test the correctness of strfmon_l(3).

Items marked with XXX represent an invalid output.

Obtained from: https://github.com/NetBSD/src/commit/e7eba0044fe6128291cbb7e5923c7cf7d87318cc

Reviewed by: kib
PR: 267410
Github PR: #620
MFC after: 1 week

20 months agostrfmon_test: Reserve space for the null terminator
Jose Luis Duran [Thu, 27 Oct 2022 10:01:24 +0000 (07:01 -0300)]
strfmon_test: Reserve space for the null terminator

Otherwise strfmon(3) could overflow the buffer.

Here is mostly done for correctness and illustrative purposes, as there
is no chance it could actually happen.

Reviewed by: kib
PR: 267410
Github PR: #620
MFC after: 1 week

20 months agostrfmon_l(3): Add name to the man page
Jose Luis Duran [Fri, 28 Oct 2022 08:29:16 +0000 (05:29 -0300)]
strfmon_l(3): Add name to the man page

Reviewed by: kib
PR: 267410
Github PR: #620
MFC after: 1 week

20 months agoiommu_gas: drop fini cleanup loop
Doug Moore [Sat, 29 Oct 2022 17:56:06 +0000 (12:56 -0500)]
iommu_gas: drop fini cleanup loop

Assertions suggest that the loop in iommu_gas_fini_domain is executed
zero times, so remove it.

Reviewed by: alc, kib
MFC after: 3 weeks
Differential Revision: https://reviews.freebsd.org/D37204

20 months agomodules: Add missing opt_*.h files for stand-alone compile
Warner Losh [Sat, 29 Oct 2022 14:49:20 +0000 (08:49 -0600)]
modules: Add missing opt_*.h files for stand-alone compile

Standalone compile that we at least create these opt_*.h files.

Sponsored by: Netflix

20 months agomodules: Remove duplicate opt_global.h target
Warner Losh [Sat, 29 Oct 2022 14:52:28 +0000 (08:52 -0600)]
modules: Remove duplicate opt_global.h target

The default one does the right thing these days.

Sponsored by: Netflix

20 months agosys/modules: MODULES_OVERRIDE takes precedence over EXTRA_MODULES and WITHOUT_MODULES
Warner Losh [Sat, 29 Oct 2022 14:34:16 +0000 (08:34 -0600)]
sys/modules: MODULES_OVERRIDE takes precedence over EXTRA_MODULES and WITHOUT_MODULES

MODULES_OVERRIDE has traditionally taken precedence over EXTRA_MODULES
and WITHOUT_MODULES as the exact list of modules to build. Over time,
things have been added that has broken this. Move the .endif that makes
this the case to the right place. The so called 'ALL_MODULES' option is
the only thing with higher precedence, but it's not quite all the
options anymore (though it is much more of them, and doesn't quite
work on !x86).

Sponsored by: Netflix

20 months agodtb: Be much less verbose in the building of dtb
Warner Losh [Fri, 28 Oct 2022 21:42:58 +0000 (15:42 -0600)]
dtb: Be much less verbose in the building of dtb

Make the dtb/dtbo files with less noise. Remove echo statements, but add
back the call for the non-meta builds to replace the removed noise.

Suggetions by: jrtc27
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D37073

20 months agomake: Don't print as many ==> and -- xxx -- lines in meta mode
Warner Losh [Fri, 28 Oct 2022 21:42:49 +0000 (15:42 -0600)]
make: Don't print as many ==> and -- xxx -- lines in meta mode

Since metamode just announces what it's doing, the extra -- xxx -- lines
aren't needed for recursive descent, nor are the ==> lines needed. This
speeds up rebuilding kernels a lot...

Sponsored by: Netflix
Reviewed by: sjg, bdrewery
Differential Revision: https://reviews.freebsd.org/D37071

20 months agolinux, linux64: fix module load
Mitchell Horne [Sat, 29 Oct 2022 15:30:32 +0000 (12:30 -0300)]
linux, linux64: fix module load

The previous commit added references to to the syscallnames arrays, but
failed to add the relevant source files to the module build. Thus, the
modules failed to load due to missing symbols.

Reported by: cy
Fixes: 1da65dcb1c57 ("linux: populate sv_syscallnames in each sysentvec")
Sponsored by: The FreeBSD Foundation

20 months agolinux, linux64: improve SRCS formatting
Mitchell Horne [Sat, 29 Oct 2022 15:28:16 +0000 (12:28 -0300)]
linux, linux64: improve SRCS formatting

Sort the entries alphabetically, and list them with one entry per line.
This makes the diffs much cleaner when adding or removing a new entry,
as I will do in the next commit.

MFC after: 1 week
Sponsored by: The FreeBSD Foundation

20 months agoatomic: Intercept atomic_(load|store)_bool for kernel sanitizers
Mark Johnston [Sat, 29 Oct 2022 15:02:02 +0000 (11:02 -0400)]
atomic: Intercept atomic_(load|store)_bool for kernel sanitizers

Fixes: 2bed73739aac ("atomic: Add plain atomic_load/store_bool()")

20 months agogenet: add another case where headers need pullup
Mike Karels [Tue, 25 Oct 2022 19:23:18 +0000 (14:23 -0500)]
genet: add another case where headers need pullup

Wake On LAN packets sent by wake(8) via BPF are lost if txcsum is
enabled.  These fall into the "other protocol" case where gen_parse_tx
did nothing.  Add code to shift up to gen_tx_hdr_min bytes of the
packet along with the Ethernet header in this case.

20 months agovfs_domount(): ensure that v_mountedhere and VIRF_MOUNTPOINT are set under the vnode...
Konstantin Belousov [Thu, 27 Oct 2022 20:22:43 +0000 (23:22 +0300)]
vfs_domount(): ensure that v_mountedhere and VIRF_MOUNTPOINT are set under the vnode lock

Fixes: f7833196bd6ba9bfc060a41b353422b15d6aa95b
Reported and tested by: pho
Reviewed by: jah, markj (previous version)
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D37198

20 months agoiommu_gas: start space search from 1st free space
Doug Moore [Sat, 29 Oct 2022 05:50:44 +0000 (00:50 -0500)]
iommu_gas: start space search from 1st free space

Maintain a pointer to an element in the domain map that is left of any
sufficiently large free gap in the tree and start the search for free
space there, rather than at the root of the tree. On find_space, move
that pointer to the leftmost leaf in the subtree of nodes with
free_down greater than or equal to the minimum allocation size before
starting the search for space from that pointer. On removal of a node
with address less than that pointer, update that pointer to point to
the predecessor or successor of the removed node.

In experiments with netperf streaming, this reduces by about 40% the
number of map entries examined in first-fit allocation.

Reviewed by: alc, kib
MFC after: 3 weeks
Differential Revision: https://reviews.freebsd.org/D36624

20 months agousr.bin: hook wg(8) up to the build
Kyle Evans [Sat, 29 Oct 2022 03:04:56 +0000 (22:04 -0500)]
usr.bin: hook wg(8) up to the build

wg(8) is used to manage WireGuard interfaces; see wg(4) and wg(8) both
for more details and usage examples.

20 months agoAdd 'contrib/wireguard-tools/' from commit '7e00bf8773b93a2a3ee28dba2710d2ae443989f1'
Kyle Evans [Sat, 29 Oct 2022 03:05:14 +0000 (22:05 -0500)]
Add 'contrib/wireguard-tools/' from commit '7e00bf8773b93a2a3ee28dba2710d2ae443989f1'

git-subtree-dir: contrib/wireguard-tools
git-subtree-mainline: 9142a2a37b2fe65d46ace08a098ad26b8ff81541
git-subtree-split: 7e00bf8773b93a2a3ee28dba2710d2ae443989f1

20 months agoImport wireguard-tools for wg(8)
Kyle Evans [Sat, 29 Oct 2022 02:41:58 +0000 (21:41 -0500)]
Import wireguard-tools for wg(8)

744bfb213144 ("Import the WireGuard driver from zx2c4.com") re-imported
the WireGuard driver with the intention that wg(8) will be used to
manage WireGuard interfaces, as on other platforms, now that wg(8) has
been dual-licensed MIT specifically to allow our use in base (thanks!).

This is a copy of wireguard-tools/src, with files that we don't need
.gitignore'd out to make it more clear that we're only building files
that are either MIT or dual-licensed MIT.  We may go with a different
structure later (e.g., if we end up needing to include outside of src/),
but an upstream restructure seems unlikely in the foreseeable future.

20 months agocontrib/tzdata: import tzdata 2022f
Philip Paeps [Sat, 29 Oct 2022 02:38:01 +0000 (10:38 +0800)]
contrib/tzdata: import tzdata 2022f

Changes: https://github.com/eggert/tz/blob/2022f/NEWS

MFC after: 3 days

20 months agoImport tzdata 2022f
Philip Paeps [Sat, 29 Oct 2022 02:33:53 +0000 (10:33 +0800)]
Import tzdata 2022f

20 months agoddb: print the actual syscall name
Mitchell Horne [Fri, 28 Oct 2022 21:20:05 +0000 (18:20 -0300)]
ddb: print the actual syscall name

Some architectures will pretty-print a system call trap in the
backtrace. Rather than printing the symbol, use the syscallname()
function to pull the string from the sv_syscallnames array corresponding
to the process. This simplifies the function somewhat.

Mostly, this will result in dropping the "sys" prefix, e.g. "sys_exit"
will now be printed simply as "exit".

Make two minor tweaks to the function signature: use a u_int for the
syscall number since this is a more correct type (see the 'code' member
of struct syscall_args), and make the thread pointer the first argument.
The latter is more natural and conventional.

Suggested by:   jrtc27
Reviewed by: jrtc27, markj, jhb
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D37200

20 months agolinux: populate sv_syscallnames in each sysentvec
Mitchell Horne [Fri, 28 Oct 2022 21:19:39 +0000 (18:19 -0300)]
linux: populate sv_syscallnames in each sysentvec

This allows the syscallname() function to give a usable result for Linux
ABIs.

Reported by: jrtc27
Reviewed by: jrtc27, markj, jhb
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D37199

20 months agoDisable Hyper-V on arm64
Andrew Turner [Fri, 28 Oct 2022 21:15:18 +0000 (22:15 +0100)]
Disable Hyper-V on arm64

It unconditionally calls into the Hyper-V firmware. As most arm64
boards don't have said firmware disable it for now.

20 months agoRemove the hyperv option from std.dev
Andrew Turner [Fri, 28 Oct 2022 21:14:33 +0000 (22:14 +0100)]
Remove the hyperv option from std.dev

It's already in std.hyperv and we don't need to repeat it here.

20 months agorelease: Add support for creating ZFS-based VM images
Mark Johnston [Fri, 28 Oct 2022 20:53:36 +0000 (16:53 -0400)]
release: Add support for creating ZFS-based VM images

The change extends vmimage.subr to handle a new parameter, VMFS, which
should be equal to either "ufs" or "zfs".  When it is set to ZFS, we use
makefs to create a bootable pool populated using the same dataset layout
as bsdinstall and "poudriere image" use.  The pool can be grown using
the growfs rc.d script, just as in UFS images.

This will make it easy to provide VM and cloud images with ZFS as the
root filesystem.  So far I did not do extensive testing of cloud images;
I merely verified that creation of ZFS-based AWS AMIs works and allows
me to create amd64 and arm64 EC2 instances with ZFS as the root
filesystem.

Reviewed by: emaste, gjb
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D34426