]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
13 months agopam_tacplus: Mention nss_tacplus in the manual page.
Dag-Erling Smørgrav [Mon, 22 May 2023 10:00:52 +0000 (10:00 +0000)]
pam_tacplus: Mention nss_tacplus in the manual page.

MFC after: 1 week
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D40135

13 months agoAdd nss_tacplus, a TACACS+ NSS module.
Dag-Erling Smørgrav [Mon, 22 May 2023 10:00:48 +0000 (10:00 +0000)]
Add nss_tacplus, a TACACS+ NSS module.

MFC after: 1 week
Sponsored by: Klara, Inc.
Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D40133

13 months agotaclib: 0 (not set) is a valid auth type in authorization requests.
Dag-Erling Smørgrav [Mon, 22 May 2023 10:00:42 +0000 (10:00 +0000)]
taclib: 0 (not set) is a valid auth type in authorization requests.

MFC after: 1 week
Sponsored by: Klara, Inc.
Reviewed by: rew
Differential Revision: https://reviews.freebsd.org/D40132

13 months agostress2: Added a faster test of fsck_ffs by omitting mount(8) and umount(8)
Peter Holm [Mon, 22 May 2023 08:07:40 +0000 (10:07 +0200)]
stress2: Added a faster test of fsck_ffs by omitting mount(8) and umount(8)

13 months agostress2: Occasionally modify 8 bits
Peter Holm [Mon, 22 May 2023 08:05:34 +0000 (10:05 +0200)]
stress2: Occasionally modify 8 bits

13 months agoLinuxKPI: fix WRITE_ONCE(), remove ACCESS_ONCE()
Bjoern A. Zeeb [Sat, 13 May 2023 15:17:47 +0000 (15:17 +0000)]
LinuxKPI: fix WRITE_ONCE(), remove ACCESS_ONCE()

Fix a gcc warning: "to be safe all intermediate pointers in cast from
'...' to '...' must be 'const' qualified [-Wcast-qual]".
Doing what is essentially a __DECONST() adding the uintptr_t gets
rid of the massive amount of warnings we get in LinuxKPI and lets
us see the actual problems a lot better.
This is a follow-up to 74e908b3c63b28de1d590dc42502fbe959a6da2e which
fixed READ_ONCE().
ACCESS_ONCE() seems to be an obsolete KPI these days in Linux and
FreeBSD does not use it either directly so we can entirely remove
it now.

Sponsored by: The FreeBSD Foundation
Suggested by: jhb
Reviewed by: hselasky
MFC after: 10 days
Differential Revision: https://reviews.freebsd.org/D40084

13 months agomlx4: Move DEFINE_MUTEX() outside function body.
Hans Petter Selasky [Sun, 21 May 2023 11:25:28 +0000 (13:25 +0200)]
mlx4: Move DEFINE_MUTEX() outside function body.

Move static mutex declaration outside function body, to avoid global
variables being declared on the stack, when using SYSINITs.

MFC after: 1 week
Sponsored by: NVIDIA Networking

13 months agoifconfig: simplify ifconfig() by factoring out ifa add/del logic
Alexander V. Chernikov [Sat, 20 May 2023 11:23:04 +0000 (11:23 +0000)]
ifconfig: simplify ifconfig() by factoring out ifa add/del logic

Reviewed by: kp
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D40180

13 months agoifconfig: split argument parsing
Alexander V. Chernikov [Sat, 20 May 2023 11:14:39 +0000 (11:14 +0000)]
ifconfig: split argument parsing

Simplify main() by factoring out argument parsing code.

Reviewed by: kp
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D40179

13 months agoext2fs: Add large sectorsize disks support
Fedor Uporov [Mon, 8 May 2023 16:14:02 +0000 (19:14 +0300)]
ext2fs: Add large sectorsize disks support

The ext2fs does not support disks with sectorsize more 512 bytes.
The main issue is in reading/writing superblock, which is not aligned
with 4k value. Reimplement the superblock reading logic to make it
indifferent to disk logical sector size. The logical sector size
more then page size is not supported, like it is doing on Linux side.

PR:             271105
Reported by:    k(at)vodka.home.kg
Reviewed by:    pfg
MFC after:      2 week
Differential Revision:  https://reviews.freebsd.org/D40047

13 months agoLinuxKPI: implement pci_rescan_bus()
Bjoern A. Zeeb [Tue, 16 May 2023 20:59:30 +0000 (20:59 +0000)]
LinuxKPI: implement pci_rescan_bus()

Try to implement pci_rescan_bus().  pci_rescan_method() is already
doing most of the job.  We only have to do the count for the return
value again ourselves.

Sponsored by: The FreeBSD Foundation
MFC after: 10 days
Reviewed by: jhb
Differential Revision: https://reviews.freebsd.org/D40122

13 months agoRevert "Require the OpenSSL 1.1 APIs when compiling ldns"
Enji Cooper [Sat, 20 May 2023 19:00:34 +0000 (12:00 -0700)]
Revert "Require the OpenSSL 1.1 APIs when compiling ldns"

This particular change appears to have broken the build; the change
needs some massaging to work with OpenSSL 1.1.

This reverts commit c6750ddec9177b67bb4883717933e87ac24a3a44.

13 months agoRequire the OpenSSL 1.1 APIs when compiling ldns
Enji Cooper [Sat, 13 May 2023 02:38:18 +0000 (19:38 -0700)]
Require the OpenSSL 1.1 APIs when compiling ldns

Moving the APIs from OpenSSL 1.1 supporting APIs to 3.x supporting APIs
is a non-trivial effort. Require 1.1 API compatibility to unblock
updating OpenSSL in base to 3.x.

This mirrors what upstream has done in their configure.ac file.

Submitted by: Pierre Pronchery <pierre@freebsdfoundation.org>
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D40082

13 months agocxgbe: Move ethofld_transmit under #ifdef INET || INET.
John Baldwin [Sat, 20 May 2023 16:27:40 +0000 (09:27 -0700)]
cxgbe: Move ethofld_transmit under #ifdef INET || INET.

This fixes a -Wunused-function warning when building LINT-NOIP.

Reported by: rpokala

13 months agonetlink: Move an INET-only variable under #if.
John Baldwin [Sat, 20 May 2023 16:26:46 +0000 (09:26 -0700)]
netlink: Move an INET-only variable under #if.

This fixes the LINT-NOIP build.

13 months agotd: line up with other clean up in thread_reap_domain
Mateusz Guzik [Fri, 19 Aug 2022 19:51:53 +0000 (19:51 +0000)]
td: line up with other clean up in thread_reap_domain

NFC

13 months agorlimit: line up with other clean up in thread_reap_domain
Mateusz Guzik [Fri, 19 Aug 2022 19:37:33 +0000 (19:37 +0000)]
rlimit: line up with other clean up in thread_reap_domain

NFC

13 months agofwget: remove logging redirects
Bjoern A. Zeeb [Fri, 12 May 2023 11:47:49 +0000 (11:47 +0000)]
fwget: remove logging redirects

After adding addpkg() in 10aa369afd9946da18ae51b07aeadc3314fba56d
the redirects are no longer needed.  We can now log directly so
simplify the code.

Reported by: manu
Reviewed by: manu
Differential Revision: https://reviews.freebsd.org/D40077

13 months agofwget: add support for various WiFi NICs
Bjoern A. Zeeb [Thu, 11 May 2023 20:41:40 +0000 (20:41 +0000)]
fwget: add support for various WiFi NICs

Add support for Realtek, QCA, and Mediatek WiFi NIC cards.
We group the matching entries by driver in sub-functions in order
to semi-automatically create the lists for now.

Reviewed by: manu
Differential Revision: https://reviews.freebsd.org/D40073

13 months agofwget: improve the pci base script
Bjoern A. Zeeb [Thu, 11 May 2023 20:36:50 +0000 (20:36 +0000)]
fwget: improve the pci base script

When matching "class" only match the class byte and not subclass and
programming interface.
Extend the list of supported classes by network, old, and misc (for no
better names on the latter two).
Extend the list of known vendors for various WiFi NICs.
Add a "pci_fixup_class" as some wireless cards have unexpected PCI
classes set.  In case we cannot find a matching file for the original
try to see if a "fixed up" version exists.  This allows us to avoid
duplicate matching files for the same vendor/driver but different
chipsets.

Reviewed by: manu
Differential Revision: https://reviews.freebsd.org/D40072

13 months agofwget: simplify adding firmware images to pkg to install
Bjoern A. Zeeb [Thu, 11 May 2023 20:30:44 +0000 (20:30 +0000)]
fwget: simplify adding firmware images to pkg to install

Rather than using echo to return the firmware package name, call a
new function (addpkg) which will also deal with (i) no leading space
and (ii) remove duplicates (as some devices have dual-wifi-cards).
In addition we won't have a line break when having multiple packages.

While here also do not call pkg(8) anymore if there is no package to
install and use the correct variable to install all and not just the
last found package.

Reviewed by: manu, bapt
Differential Revision: https://reviews.freebsd.org/D40071

13 months agoLinuxKPI: add put_unaligned_le16() and get_unaligned_be64()
Bjoern A. Zeeb [Sat, 20 May 2023 00:52:27 +0000 (00:52 +0000)]
LinuxKPI: add put_unaligned_le16() and get_unaligned_be64()

Add the two new functions needed by wireless drivers by the same
implementation pattern we did for different sizes.

Sponsored by: The FreeBSD Foundation
MFC after: 10 days
Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D40174

13 months agonetlink: automatically generate broadcast for IPv4 ifa if not set.
Alexander V. Chernikov [Sat, 20 May 2023 10:42:08 +0000 (10:42 +0000)]
netlink: automatically generate broadcast for IPv4 ifa if not set.

MFC after: 2 weeks

13 months agoifconfig: simplify carp vhid setup.
Alexander V. Chernikov [Fri, 19 May 2023 10:18:43 +0000 (10:18 +0000)]
ifconfig: simplify carp vhid setup.

Currently carp implementation peeks into the opaque 'afp->af_addreq'
 buffer, assumes it knows the af-specific layout and assigns vhid
 directly.
Simplify the code and remove abstraction leak by introducing per-afp
 callback for setting vhid.
This change is a pre-requisite to set addresses via Netlink,
 as Netlink implementiation uses different structure layout.

Reviewed by: kp
Differential Revision: https://reviews.freebsd.org/D40160
MFC after: 2 weeks

13 months agoLinuxKPI: add further dummy header files
Bjoern A. Zeeb [Sat, 20 May 2023 00:41:45 +0000 (00:41 +0000)]
LinuxKPI: add further dummy header files

Wireless drivers try to include these files.  Add them empty for no
better reason yet.

Sponsored by: The FreeBSD Foundation
MFC after: 10 days

13 months agoLinuxKPI: skbuff: add skb_get_hash()
Bjoern A. Zeeb [Sat, 20 May 2023 00:47:05 +0000 (00:47 +0000)]
LinuxKPI: skbuff: add skb_get_hash()

Add a dummy implementation of skb_get_hash() until we'll hit and
implement it.  It'll help to keep an upcoming wireless driver to
compile.

MFC after: 10 days

13 months agoLinuxKPI: qcom: update qmi and mhi
Bjoern A. Zeeb [Sat, 20 May 2023 00:50:10 +0000 (00:50 +0000)]
LinuxKPI: qcom: update qmi and mhi

Update qcom QMI and MHI bits in order to keep an upcoming driver
compiling.

MFC after: 10 days

13 months agoLinuxKPI: netdevice: add dev_set_threaded()
Bjoern A. Zeeb [Sat, 20 May 2023 00:51:01 +0000 (00:51 +0000)]
LinuxKPI: netdevice: add dev_set_threaded()

Add dev_set_threaded() to the dummy functions of netdevice.h in order
to keep an upcoming wireless driver compiling.
While here also update the name of a function argument for consistency.

MFC after: 10 days

13 months agonet80211: Radiotap: update for defines
Bjoern A. Zeeb [Sat, 20 May 2023 00:39:08 +0000 (00:39 +0000)]
net80211: Radiotap: update for defines

ath1xk drivers require further HE defines.  Some of those we had
already predicted as comments in the past.

Sponsored by: The FreeBSD Foundation
MFC after: 10 days

13 months agoAdd a comment to the new tcp_get_srtt method to clarify that ticks
Randall Stewart [Fri, 19 May 2023 19:53:26 +0000 (15:53 -0400)]
Add a comment to the new tcp_get_srtt method to clarify that ticks
are kept in a shifted form and need to be un-shifted before use.

Suggested by: rpokala@

13 months agodate: add -z output_zone option
Baptiste Daroussin [Fri, 19 May 2023 09:08:11 +0000 (11:08 +0200)]
date: add -z output_zone option

Inpired by OpenBSD date(1), this option allows to do timezone conversion
via the date(1) command.

For example, to determine when the BSDCan livestream begins for me:

$ env -i TZ=EST5EDT date -z Europe/Paris -j 0900

MFC After: 1 week
Reviewed by: kib, bcr (manpage)
Differential Revision: https://reviews.freebsd.org/D40159

13 months agoThere are congestion control algorithms will that pull in srtt, and this can cause...
Randall Stewart [Fri, 19 May 2023 15:16:28 +0000 (11:16 -0400)]
There are congestion control algorithms will that pull in srtt, and this can cause issues with rack.

When using rack, cubic and htcp will grab the srtt, but they think it is in ticks. For rack
it is in micro-seconds (which we should probably move all stacks to actually). This causes
issues so instead lets make a new interface so that any CC module can pull the srtt in
whatever granularity they want.

Reviewed by: tuexen
Sponsored by: Netflix Inc
Differential Revision:https://reviews.freebsd.org/D40146

13 months agoCirrus-CI: switch to -lite LLVM package for native run
Ed Maste [Wed, 17 May 2023 18:16:06 +0000 (14:16 -0400)]
Cirrus-CI: switch to -lite LLVM package for native run

This reduces CI cycle time (a small amount).

Suggested by: brooks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D40136

13 months agomi_startup: Instrument the bubblesort with TSLOG
Colin Percival [Fri, 19 May 2023 13:46:42 +0000 (06:46 -0700)]
mi_startup: Instrument the bubblesort with TSLOG

The bubblesort of SYSINITs is currently responsible for 7% of the
kernel boot time when booting a 1 CPU / 128 MB VM under Firecracker.

It needs to be replaced with a faster sort, but until that happens
at least instrumenting it with TSLOG makes it show up in flamecharts.

13 months agoif_bridge: fix potential panic
Kristof Provost [Thu, 18 May 2023 18:04:45 +0000 (20:04 +0200)]
if_bridge: fix potential panic

When a new bridge_rtnode is added it is added with a NULL brt_dst. The
brt_dst is set after the entry is added. This means there's a small
window where another core could also attempt to add this node, leading
to the code attempting to log that the MAC addresses moved to a new
interface.
Aside from that being a spurious log entry it also panics, because
obif is NULL (and we attempt to dereference it).

Avoid this by settings brt_dst before we insert the bridge_rtnode.
Assert that obif is non-NULL, as an extra precaution.

Reported by: olivier@
Reviewed by: zlei@
Differential Revision: https://reviews.freebsd.org/D40147

13 months agonetlink: add IPv4/IPv6 attribute writers using in[6]_addr instead of
Alexander V. Chernikov [Fri, 19 May 2023 09:44:21 +0000 (09:44 +0000)]
netlink: add IPv4/IPv6 attribute writers using in[6]_addr instead of
sockaddrs.

MFC after: 2 weeks

13 months agocarp test: improve jail names for unicast_ll_v6 test
Kristof Provost [Thu, 18 May 2023 20:06:37 +0000 (22:06 +0200)]
carp test: improve jail names for unicast_ll_v6 test

Rename the jails used in the unicast_ll_v6 test, to ensure the jail
names are unique to this test.
That is one of the requirements for running these tests in parallel.

13 months agopfsync tests: check for the correct IP address
Kristof Provost [Thu, 18 May 2023 19:37:48 +0000 (21:37 +0200)]
pfsync tests: check for the correct IP address

When checking if the state synced over we should look for
198.51.100.254, not 198.51.100.2. The test worked because the incorrect
address is a substring of the correct one, but we should fix it anyway.

Reported by: Naman Sood <naman@freebsdfoundation.org>
MFC after: 1 week

13 months agoproc: s/short/int lock-related counters
Mateusz Guzik [Thu, 18 May 2023 19:45:33 +0000 (19:45 +0000)]
proc: s/short/int lock-related counters

short is small enough that it can overflow in practice for certain cases
and then trigger wrong asserts.

One known example is vfs namecache resize which grabs all locks at once.

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

13 months agoproc: s/short/u_char for td_stopsched
Mateusz Guzik [Thu, 18 May 2023 19:44:29 +0000 (19:44 +0000)]
proc: s/short/u_char for td_stopsched

bool is not used because of massive header mess

While here move it into a gap.

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

13 months agoUnder RSS, assign a TCP flow's inp_flowid anyway.
Cheng Cui [Thu, 11 May 2023 09:06:04 +0000 (05:06 -0400)]
Under RSS, assign a TCP flow's inp_flowid anyway.

Summary:
This brings some benefit of a tcp flow identification for some kernel
modules, such as siftr.

Reviewers: rrs, rscheff, tuexen, #transport!
Approved by: tuexen (mentor), rrs
Subscribers: imp, melifaro, glebius
Differential Revision: https://reviews.freebsd.org/D40061

13 months agolibc: Update copyright text to match current templates.
Peter Wemm [Thu, 18 May 2023 18:30:10 +0000 (11:30 -0700)]
libc: Update copyright text to match current templates.

13 months agotraceroute.8: Document TOS as DiffServ and ECN
Jesse Rosenstock [Thu, 18 May 2023 17:10:13 +0000 (11:10 -0600)]
traceroute.8: Document TOS as DiffServ and ECN

Reviewed by: imp,karels
Pull Request: https://github.com/freebsd/freebsd-src/pull/744

13 months agolinux(4): Implement ptrace_pokeusr for x86_64
Dmitry Chagin [Thu, 18 May 2023 17:02:35 +0000 (20:02 +0300)]
linux(4): Implement ptrace_pokeusr for x86_64

Differential Revision: https://reviews.freebsd.org/D40097
MFC after: 1 week

13 months agolinux(4): Make ptrace_pokeusr machine dependent
Dmitry Chagin [Thu, 18 May 2023 17:01:12 +0000 (20:01 +0300)]
linux(4): Make ptrace_pokeusr machine dependent

Differential Revision: https://reviews.freebsd.org/D40096
MFC after: 1 week

13 months agolinux(4): Make ptrace_peekusr machine dependend
Dmitry Chagin [Thu, 18 May 2023 17:00:12 +0000 (20:00 +0300)]
linux(4): Make ptrace_peekusr machine dependend

And partially implement it for x86_64.

Differential Revision: https://reviews.freebsd.org/D40095
MFC after: 1 week

13 months agolinux(4): Move linux_debug decalration to linux_util.h
Dmitry Chagin [Thu, 18 May 2023 16:58:23 +0000 (19:58 +0300)]
linux(4): Move linux_debug decalration to linux_util.h

To avoid inclusion of linux_mib.h with linux_util.h in cases where
we need rate limiting macro.

MFC after: 1 week

13 months agocarp tests: test unicast carp via link-local addresses
Kristof Provost [Thu, 18 May 2023 14:43:46 +0000 (16:43 +0200)]
carp tests: test unicast carp via link-local addresses

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

13 months agocarp: fix unicast link-local
Kristof Provost [Thu, 18 May 2023 15:30:39 +0000 (17:30 +0200)]
carp: fix unicast link-local

If the peer6 address is a link-local address we have to embed the
scopeid, much like we have to for IPv6 multicast as well.

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

13 months agoifconfig: improve error checking for carp peer6
Kristof Provost [Wed, 17 May 2023 19:39:42 +0000 (21:39 +0200)]
ifconfig: improve error checking for carp peer6

getaddrinfo() returns 0 if it succeeded, but it's not guaranteed to
return 1 on error. Check for success rather than for one specific error.

Without this fix commands such as `ifconfig bnxt1 inet6 add vhid 1 peer6
2001:db8::1/64` would segfault ifconfig.

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

13 months agoifconfig: improve trimming off interface number at end
Bjoern A. Zeeb [Wed, 17 May 2023 20:40:47 +0000 (20:40 +0000)]
ifconfig: improve trimming off interface number at end

When trying to auto-load a module, we trim the interface number off
the end.  Currently we stop at the first digit.  For interfaces which
have numbers in the driver name this does not work well.
In the current example ifconfig ath10k0 would load ath(4) instead of
ath10k(4).  For module/interface names like rtw88[0] we never guess
correctly.
To improve for the case we can, start trimming off digits from the
end rather than the front.

Sponsored by: The FreeBSD Foundation
Reported by: thierry
MFC after: 20 days
Reviewed by: melifaro, thierry
Differential Revision: https://reviews.freebsd.org/D40137

13 months agorc.d/netif: Don't DAD if lo0 is the only IPv6 IF
Colin Percival [Thu, 18 May 2023 03:17:24 +0000 (20:17 -0700)]
rc.d/netif: Don't DAD if lo0 is the only IPv6 IF

The code in rc.d/netif waiting for IPv6 Duplicate Address Detection if
any network interfaces support IPv6.  Unfortunately, since lo0 *always*
has IPv6 enabled, this means unconditionally sleeping, even on systems
which have no external IPv6 interfaces.

Since we presume that there is little risk of a duplicate address being
assigned on lo0, amend the test to wait only if there is an interface
*other than lo0* which supports IPv6.

Reviewed by: bz
Differential Revision: https://reviews.freebsd.org/D40141

13 months agolinux(4): Check fd passed to unlockpt()
Dmitry Chagin [Thu, 18 May 2023 07:55:39 +0000 (10:55 +0300)]
linux(4): Check fd passed to unlockpt()

In our implementation, grantpt() and unlockpt() don't actually have
any use, because PTY's are created on the fly and already have proper
permissions upon creation.
Atleast check that a proper fd passed to unlockpt(). For grantpt()
Glibc calls TIOCGPTN ioctl which would fail if fd is not a master.

Differential Revision: https://reviews.freebsd.org/D40100
MFC after: 1 week

13 months agoktls: don't try to unlock pcb if tcp_drop() already did
Gleb Smirnoff [Wed, 17 May 2023 17:25:28 +0000 (10:25 -0700)]
ktls: don't try to unlock pcb if tcp_drop() already did

Reviewed by: rrs, gallatin

13 months agopf: Standardize rtableid
Kajetan Staszkiewicz [Wed, 17 May 2023 13:57:42 +0000 (15:57 +0200)]
pf: Standardize rtableid

Prepare for rtableid being included in struct pfsync_state where it will
be int32_t. Make variables which will be set to and from it the same
width.

Reviewed by: kp
Sponsored by: InnoGames GmbH
Differential Revision: https://reviews.freebsd.org/D40013

13 months agobhyve: error out if fwcfg user file isn't read completely
Corvin Köhne [Fri, 12 May 2023 05:37:32 +0000 (07:37 +0200)]
bhyve: error out if fwcfg user file isn't read completely

At the moment, fwcfg reads the file once at startup and passes these
data to the guest. Therefore, we should always read the whole file.
Otherwise we should error out.

Additionally, GCC12 complains that the comparison whether
fwcfg_file->size is lower than 0 is always false due to the limited
range of data type.

Reviewed by: markj
Fixes: ca14781c8170f3517ae79e198c0c880dbc3142dd ("bhyve: add cmdline option for user defined fw_cfg items")
MFC after: 1 week
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D40076

13 months agopf: release rules lock before passing the packet to dummynet
Kristof Provost [Thu, 11 May 2023 16:10:33 +0000 (18:10 +0200)]
pf: release rules lock before passing the packet to dummynet

In the Ethernet rules we held the PF_RULES lock while we called
ip_dn_io_ptr() (i.e. dummynet). That meant that we could end up back in
pf while still holding the PF_RULES lock.
That's not immediately fatal, because that lock is recursive, but still
not ideal.

There also appear to be scenarios where this can actually trigger
deadlocks.

We don't need to hold the PF_RULES lock, as long as we make a local copy
of the data we need from the rule (in this case, the action and
bridge_to target). It's safe to keep the struct ifnet pointer around,
because we remain in NET_EPOCH.

See also: https://redmine.pfsense.org/issues/14373
MFC after: 1 week
Reviewed by: mjg
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D40067

13 months agoMove the arm64 sigcode to .rodata
Andrew Turner [Wed, 17 May 2023 11:00:12 +0000 (12:00 +0100)]
Move the arm64 sigcode to .rodata

The kernel doesn't execute this code, it's only ever copied to
userspace. Move it to .rodata as we don't need to modify it.

Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D39399

13 months agoLinuxKPI: add ns_to_timespec64()
Bjoern A. Zeeb [Tue, 16 May 2023 21:00:45 +0000 (21:00 +0000)]
LinuxKPI: add ns_to_timespec64()

Add ns_to_timespec64() which does not seem to require anything from
us given timespec64 is aliases to timespec.

Sponsored by: The FreeBSD Foundation
MFC after: 10 days
Reviewed by: hselasky
Differential Revision: https://reviews.freebsd.org/D40123

13 months agoix(4): correct max MTU
Piotr Kubaj [Wed, 17 May 2023 10:16:22 +0000 (12:16 +0200)]
ix(4): correct max MTU

The max MTU for the ix(4) is 9710.

Differential revision: https://reviews.freebsd.org/D40003
Approved by: erj, bcr

13 months agoem: sync platform detection with Linux
Piotr Kubaj [Wed, 17 May 2023 10:14:02 +0000 (12:14 +0200)]
em: sync platform detection with Linux

Switch 16 and 23 adapters from tgp to adp.

PR: 270929
Differential revision: https://reviews.freebsd.org/D39977
Approved by: erj, kbowling

13 months agorouting: plug mbuf leak for the packets hitting IPv6 blackhole route
Alexander V. Chernikov [Wed, 17 May 2023 09:06:04 +0000 (09:06 +0000)]
routing: plug mbuf leak for the packets hitting IPv6 blackhole route

Reported by: Dmitriy Smirnov <fox@sage.su>
Tested by: Dmitriy Smirnov <fox@sage.su>
MFC after: 1 day

13 months agorouting: fix panic triggered by the 'gr_idx != 0' assert in nhg code
Alexander V. Chernikov [Wed, 17 May 2023 08:24:05 +0000 (08:24 +0000)]
routing: fix panic triggered by the 'gr_idx != 0' assert in nhg code

Nexthop groups can be referenced by the external code. The reference
 can be released after the VNET destruction. Furthermore, nexthop
 groups use a single per-rib lock, which is destroyed during the
 VNET desctruction. To eliminate use-after-free problem, each nhg
 is marked as "unlinked" during the VNET destruction stage, leaving
 nhg_idx intact. Normally there should not be such nexthops, but if
 there are any, the kernel will panic on 'gr_idx != 0' when the
 last nhg reference is released.

Address this by using the assert checks only when the nexthop group
 is destroyed during "valid" VNET lifetime.

MFC after: 3 days

13 months agonet/if_var.h: consistently use if_t over struct ifnet *
Konstantin Belousov [Wed, 17 May 2023 01:22:36 +0000 (04:22 +0300)]
net/if_var.h: consistently use if_t over struct ifnet *

Reviewed by: jhibbits
Sponsored by: NVidia networking
Differential revision: https://reviews.freebsd.org/D40125

13 months agonet/if.h: fix style of if_t definition
Konstantin Belousov [Wed, 17 May 2023 01:21:57 +0000 (04:21 +0300)]
net/if.h: fix style of if_t definition

Reviewed by: jhibbits
Sponsored by: NVidia networking
Differential revision: https://reviews.freebsd.org/D40125

13 months agopfsync: Remove deletion of states using the full pfsync_state struct
Kajetan Staszkiewicz [Mon, 15 May 2023 19:43:06 +0000 (21:43 +0200)]
pfsync: Remove deletion of states using the full pfsync_state struct

State deletions are sent over pfsync using struct pfsync_del_c.

Remove the code for receiving state deletions using struct pfsync_state
as such deletions are never sent. Rename functions and constants so that
only the "compressed" versions remain.

Reviewed by: kp
Sponsored by: InnoGames GmbH
Differential Revision: https://reviews.freebsd.org/D40004

13 months agoLinuxKPI: skbuff.h: add skb_hwtstamps(), implement *mac_header()
Bjoern A. Zeeb [Tue, 16 May 2023 21:22:34 +0000 (21:22 +0000)]
LinuxKPI: skbuff.h: add skb_hwtstamps(), implement *mac_header()

Add a dummy skb_hwtstamps() function for now, and implement
skb_mac_header(), skb_reset_mac_header(), and skb_set_mac_header().

Sponsored by: The FreeBSD Foundation
MFC after: 10 days

13 months agoLinuxKPI: add ptp_clock_kernel.h
Bjoern A. Zeeb [Tue, 16 May 2023 21:24:08 +0000 (21:24 +0000)]
LinuxKPI: add ptp_clock_kernel.h

Add the new ptp_clock_kernel.h with structs and dummy functions for
kernel ptp support.  This is needed for the next iwlwifi update.

Sponsored by: The FreeBSD Foundation
MFC after: 10 days

13 months agoktrace: Simplify ae6ac587, drop the sa var declaration
Dmitry Chagin [Tue, 16 May 2023 19:46:26 +0000 (22:46 +0300)]
ktrace: Simplify ae6ac587, drop the sa var declaration

Suggested by: kib
MFC after: 5 days

13 months agoifconfig: make interface and address listing use Netlink as transport
Alexander V. Chernikov [Wed, 10 May 2023 13:58:21 +0000 (13:58 +0000)]
ifconfig: make interface and address listing use Netlink as transport

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

13 months agonetlink: add support for adding/deleting interface addresses
Alexander V. Chernikov [Mon, 15 May 2023 11:59:39 +0000 (11:59 +0000)]
netlink: add support for adding/deleting interface addresses

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

13 months agonet80211: Radiotap: update for newer standards (add EHT, U-SIG)
Bjoern A. Zeeb [Tue, 16 May 2023 16:03:17 +0000 (16:03 +0000)]
net80211: Radiotap: update for newer standards (add EHT, U-SIG)

iwlwifi already uses suggested EHT and U-SIG bits as well as some
more TLV bits.  Update radiotap to know of those even if they might
get updated again in the future in order to get newer versions of
the driver to compile.

Sponsored by: The FreeBSD Foundation
MFC after: 10 days

13 months agotesting: improve vnet support in pytest
Alexander V. Chernikov [Tue, 16 May 2023 15:00:45 +0000 (15:00 +0000)]
testing: improve vnet support in pytest
* Allow vnet object to be directly referenced
 (self.vnet1 vs self.vnet_map["vnet1"])
* Allow iface object to be directly reference
 (vnet.bridge vs vnet.iface_alias_map["bridge"])
* Allow arbitrary interface alias names insted of ifX
* Add wait_objects_any() method for waiting object from
 multiple vnets
* Add wait() method for indefinite sleep on vnet handlers

MFC after: 2 weeks

13 months agopasswd.5: Update man page after e0155c6989049da43c5499f7129002aa17d1ca79
Jose Luis Duran [Tue, 16 May 2023 11:17:16 +0000 (11:17 +0000)]
passwd.5: Update man page after e0155c6989049da43c5499f7129002aa17d1ca79

MFC After: 3 days

13 months agopasswd.5: Remove .Tn (Trade Name) macros
Jose Luis Duran [Tue, 16 May 2023 11:18:53 +0000 (11:18 +0000)]
passwd.5: Remove .Tn (Trade Name) macros

To appease mandoc -T lint, remove .Tn macros.

MFC After: 3 days

13 months agopw: The pw_checkname function has added ';' checking.
pbuff [Tue, 16 May 2023 03:05:30 +0000 (11:05 +0800)]
pw: The pw_checkname function has added ';' checking.

The pw_checkname function forgot to include a ';'
when checking usernames, causing shell commands
to be executed when a username with a ';' is deleted.

PR: 271427
MFC After: 3 days

13 months agotests: Don't recurse into sys/compat32
Jessica Clarke [Tue, 16 May 2023 01:06:34 +0000 (02:06 +0100)]
tests: Don't recurse into sys/compat32

Stubbing out the whole file means it has no targets, so recursive makes
fail with "don't know how to make X". We could fix that, but because the
level above is adding it to TESTS_SUBDIRS it'll generate an include line
for the subdirectory in its Kyuafile, which won't work (the problem that
was previously seen on non-aarch64 in CI). Thus we really need to not
even add it to TESTS_SUBDIRS in the first place.

Reported by: Dan Mack <mack@macktronics.com>
Fixes: 28f66935d400 ("tests: Disable sys/compat32 and sys/compat32/aarch64 tests")

13 months agotests: Disable sys/compat32 and sys/compat32/aarch64 tests
Jessica Clarke [Mon, 15 May 2023 22:16:40 +0000 (23:16 +0100)]
tests: Disable sys/compat32 and sys/compat32/aarch64 tests

The former has build system issues, with missing Kyuafiles, presumably
due to not using TESTS_SUBDIRS and bsd.test.mk (and possibly some issues
on top of that around TESTSDIR and related variables). The latter has
issues with GCC and cut-down LLVM builds.

Requested by: kevans
Fixes: ccb59683b983 ("arm64: add tests for swp/swpb emulation")

13 months agonvmecontrol: Fix power subcommand output.
Alexander Motin [Mon, 15 May 2023 20:48:50 +0000 (16:48 -0400)]
nvmecontrol: Fix power subcommand output.

The returned value consists of two fields.  Report them separately.

MFC after: 2 weeks

13 months agodirdeps.mk allow for TARGET_SPEC_VARS.host
Simon J. Gerraty [Mon, 15 May 2023 20:25:10 +0000 (13:25 -0700)]
dirdeps.mk allow for TARGET_SPEC_VARS.host

While *most* projects need only DEP_MACHINE for host, there is always
an exception.  So we allow for TARGET_SPEC_VARS.host to be a subset of
TARGET_SPEC_VARS.  The default will *just work* for most projects.

We set DEP_TARGET_SPEC_VARS and hence DEP_TARGET_SPEC based on
DEP_MACHINE.  Allow for M_dep_qual_fixes.host to be different too and
take care to apply the right set.

13 months agoFix size differences between architectures of the UFS/FFS CGSIZE macro value.
Kirk McKusick [Mon, 15 May 2023 19:56:27 +0000 (12:56 -0700)]
Fix size differences between architectures of the UFS/FFS CGSIZE macro value.

The cylinder group header structure ended with `u_int8_t cg_space[1]'
representing the beginning of the inode bitmap array. Some architectures
like the i386 rounded this up to a 4-byte boundry while other
architectures like the amd64 rounded it up to an 8-byte boundry.
Thus sizeof(struct cg) was four bytes bigger on an amd64 machine
than on an i386 machine. If a filesystem created on an i386 machine
was moved to an amd64 machine, the size of the cylinder group
calculated by the CGSIZE macro would appear to grow by four bytes.
Filesystems whose cylinder groups were exactly equal to the block
size on an i386 machine would appear to have a cylinder group that
was four bytes too big when moved to an amd64 machine. Note that
although the structure appears to be too big, it in fact is fine.
It is just the calaculation of its size that is in error.

The fix is to remove the cg_space element from the cylinder-group
structure so that the calculated size of the structure is the same
size on all architectures.

Reported by:  Tijl Coosemans
Tested by:    Tijl Coosemans and Peter Holm
MFC after:    1 week
Sponsored by: The FreeBSD Foundation

13 months agoarm64: simplify expression
Kyle Evans [Mon, 15 May 2023 15:54:15 +0000 (10:54 -0500)]
arm64: simplify expression

!a != !b -> a != b; this part was lifted from NetBSD, and I clearly did
not reconsider that these are bools (I'm guessing they were ints in an
earlier iteration of the NetBSD implementation).

while we're here, it should be easy to see that we've covered all of the
cases but let's add in an __assert_unreachable() to make it easier on
the eyes.

Reported by: jrtc27

13 months agoarm64: add tests for swp/swpb emulation
Kyle Evans [Mon, 15 May 2023 15:42:16 +0000 (10:42 -0500)]
arm64: add tests for swp/swpb emulation

One test is suitable to be hooked up to the build, so I've done this
here.  The other test lives in tools/regression because failure is a
bit more subjective -- generally, one runs it for some unbounded amount
of time and observe if it eventually exits because two threads acquired
the same mutex.

Reviewed by: imp, mmel
Sponsored by:   Stormshield
Sponsored by:   Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D39668

13 months agoarm64: emulate swp/swpb instructions
Kyle Evans [Mon, 15 May 2023 15:42:10 +0000 (10:42 -0500)]
arm64: emulate swp/swpb instructions

Add another undefined instruction handler for compat32 and watch out for
SWP/SWPB instructions.

SWP/SWPB were deprecated in ARMv6 and declared obsolete in ARMv7, but
this implementation is motivated by some proprietary software that still
uses SWP/SWPB. Because it's deprecated, emulation is pushed back behind
a sysctl that defaults to OFF in GENERIC so that it doesn't potentially
adversely affect package builds; it's unknown whether software may test
for a functional swp/swpb instruction with the desire of using it later,
so we err on the side of caution to ensure we don't end up with swp/swpb
use in freebsd/arm packages (which are built on aarch64).

The EMUL_SWP config option may be used to enable emulation by default in
environments where emulation is desired and won't really be turned off.

Reviewed by: andrew, mmel (both earlier version)
Sponsored by:   Stormshield
Sponsored by:   Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D39667

13 months agoifconfig: split printing functions into smaller per-type chunks.
Alexander V. Chernikov [Mon, 15 May 2023 12:17:54 +0000 (12:17 +0000)]
ifconfig: split printing functions into smaller per-type chunks.

This change is a prerequisite for netlink conversion.
No functional changes intended.

Reviewed by: kp
Differential Revision: https://reviews.freebsd.org/D40033
MFC after: 2 weeks

13 months agotesting: rename IfattrType to IfaAttrType for consistency
Alexander V. Chernikov [Mon, 15 May 2023 11:47:07 +0000 (11:47 +0000)]
testing: rename IfattrType to IfaAttrType for consistency

All other attribute classes are named as 'type'AttrType and 'type'
 int this case is ifa (interface address).

MFC after: 2 weeks

13 months agonetlink: add an optional post-process hook to the message parsers.
Alexander V. Chernikov [Mon, 15 May 2023 11:33:10 +0000 (11:33 +0000)]
netlink: add an optional post-process hook to the message parsers.

It is primarily used for adding scopeid to the IPv6 link-local
 sockaddrs. Having proper sockaddrs after parsing minimises the
 possibility of human mistake when using the parsing.

MFC after: 2 weeks

13 months agotesting: add public method for requiring module presense in pytest
Alexander V. Chernikov [Mon, 15 May 2023 10:50:55 +0000 (10:50 +0000)]
testing: add public method for requiring module presense in pytest

MFC after: 2 weeks

13 months agotesting: add support for handling Netlink carp messages
Alexander V. Chernikov [Mon, 15 May 2023 10:48:45 +0000 (10:48 +0000)]
testing: add support for handling Netlink carp messages

MFC after: 2 weeks

13 months agotesting: add support for using custom interfaces in pytest framework.
Alexander V. Chernikov [Mon, 15 May 2023 10:44:20 +0000 (10:44 +0000)]
testing: add support for using custom interfaces in pytest framework.

MFC after: 2 weeks

13 months agogeli: fix typo
Mariusz Zaborski [Mon, 15 May 2023 08:44:17 +0000 (10:44 +0200)]
geli: fix typo

PR: 271396
Reported by: Tim Chase <freebsd@tim.thechases.com>
MFC after: 1 week

13 months agoperiodic: Use locale-agnostic (ISO 8601) timestamp format
Michael Osipov [Thu, 4 May 2023 12:35:59 +0000 (14:35 +0200)]
periodic: Use locale-agnostic (ISO 8601) timestamp format

Instead of reyling on locale-sensitive output which can be mangled when e-mailed
use consistently ISO 8601 format which contains the same information as '-T'.

PR: 271240
MFC After: 3 days

13 months agodma: install a simple example for the auth.conf file
Peter Wright [Mon, 15 May 2023 07:18:40 +0000 (09:18 +0200)]
dma: install a simple example for the auth.conf file

PR: 270088
MFC After: 3 days

13 months agopci_vendors: update to 2023-05-15
Baptiste Daroussin [Mon, 15 May 2023 07:09:29 +0000 (09:09 +0200)]
pci_vendors: update to 2023-05-15

MFC After: 3 days

13 months agopw: do not call system()
Baptiste Daroussin [Mon, 15 May 2023 06:55:08 +0000 (08:55 +0200)]
pw: do not call system()

Calling system makes pw(8) spawn a shell, which can then be abused.

MFC After: 3 days

13 months agoremove stale portsinfo script
Wolfram Schneider [Mon, 15 May 2023 06:34:20 +0000 (06:34 +0000)]
remove stale portsinfo script

13 months agoremove stale handbook scripts
Wolfram Schneider [Mon, 15 May 2023 06:30:34 +0000 (06:30 +0000)]
remove stale handbook scripts

13 months agoremove stale message-id scripts
Wolfram Schneider [Mon, 15 May 2023 06:29:39 +0000 (06:29 +0000)]
remove stale message-id scripts

13 months agoremove stale script epfe.pl
Wolfram Schneider [Mon, 15 May 2023 06:22:41 +0000 (06:22 +0000)]
remove stale script epfe.pl

tools/tools/epfe/epfe.pl was a perl script that formerly generated some
printing example files from content in a very old version of the handbook.

Reported by: wblock

13 months agolinux(4): Rework signal trampoline on Aarch64
Dmitry Chagin [Sun, 14 May 2023 21:27:31 +0000 (00:27 +0300)]
linux(4): Rework signal trampoline on Aarch64

To avoid clobbering of any registers by the trampoline code use Linux
way to call signal handlers. I.e., we are out from the kernel right into
the signal handler, put return address from the signal handler into the
link register.
The mysterious NOP is required for some unwinders (e.g. libc++) that
unconditionally subtract one from the result of _Unwind_GetIP() in order
to identify the calling function.

MFC after: 1 week