]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
14 months agoFFS/UFS snapshots: improve documentation for removal (deletion) and unlinking.
Kirk McKusick [Wed, 8 Mar 2023 06:02:07 +0000 (22:02 -0800)]
FFS/UFS snapshots: improve documentation for removal (deletion) and unlinking.

Clarification of the size of the snapshot file.

Suggested by: Matteo Riondato
PR:           266358
MFC after:    2 weeks
Differential Revision: https://reviews.freebsd.org/D38817

14 months agoacpica: do not print warning for missing _ADR
Yuri [Tue, 7 Mar 2023 23:22:58 +0000 (16:22 -0700)]
acpica: do not print warning for missing _ADR

Started seeing the following after updating to VMware ESXi 8.0:

pcib2: <ACPI Host-PCI bridge> on acpi0
pcib2: could not evaluate _ADR - AE_NOT_FOUND
pci2: <ACPI PCI bus> on pcib2
vmx0: <VMware VMXNET3 Ethernet Adapter> ...

The virtual NIC works fine, and the code comment suggests that
missing _ADR is not something fatal, skip printing the message
if status is AE_NOT_FOUND.

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/682

14 months agoCorrect several bugs in fsck_ffs(8) triggered by corrupted filesystems.
Kirk McKusick [Tue, 7 Mar 2023 23:12:37 +0000 (15:12 -0800)]
Correct several bugs in fsck_ffs(8) triggered by corrupted filesystems.

If a directory entry has an illegal inode number (less than zero
or greater than the last inode in the filesystem) the entry is removed.
If a directory '.' or '..' entry had an illegal inode number they
were being removed. Since fsck_ffs knows what the correct value is
for these two entries fix them rather deleting them.

Add much more extensive cylinder group checks and use them to be
more careful about rebuilding a cylinder group.

Check for out-of-range block numbers before trying to free them.

When a directory is deleted also remove its cache entry created
in pass1 so that later passes do not try to operate on a deleted
directory.

Check for ctime(3) returning NULL before trying to use its return.

When freeing a  directory inode, do not try to interpret it as a
directory.

Reserve space in the inostatlist to have room to allocate a
lost+found directory.

If an invalid block number is found past the end of an inode simply
remove it rather than clearing and removing the inode.

Modernize the inoinfo structure to use queue(3) LIST rather than a
handrolled linked list implementation.

Reported by:  Bob Prohaska, John-Mark Gurney, and Mark Millard
Tested by:    Peter Holm
Reviewed by:  Peter Holm
MFC after:    2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D38668

14 months agoRevert "Fix cross-build support for Ubuntu 16.04"
Jose Luis Duran [Thu, 2 Mar 2023 15:31:31 +0000 (08:31 -0700)]
Revert "Fix cross-build support for Ubuntu 16.04"

This reverts commit d6327ae8c11b73765f100981baca49166b558b70.

Before version 2.25, glibc's unistd.h would define the POSIX subset of
getopt.h by defining __need_getopt, including getopt.h (which would
disable the header guard) and then undefining it so later including
getopt.h explicitly would define the extensions. However, we wrap
getopt, and so the wrapper's #pragma once breaks that. Thus getopt.h was
included before the real unistd.h to ensure we get all the extensions.

However, with clang 12 that causes problems where we get a function
mismatch (since getopt can throw exceptions). If we include it after
unistd.h, it will get the full definitions since glibc no longer does
the subsetting thing. This will result in matching definitions and fix
clang 12.

Reviewed by: imp, jrtc27 (OK'd on irc)
Pull Request: https://github.com/freebsd/freebsd-src/pull/668

14 months agoUpdates to UFS/FFS superblock integrity checks when reading a superblock.
Kirk McKusick [Tue, 7 Mar 2023 22:59:56 +0000 (14:59 -0800)]
Updates to UFS/FFS superblock integrity checks when reading a superblock.

Have to add a check that the computed cylinder group size does not
exceed the block size of the filesystem.

It is also necessary to validate additional parameters when a
superblock is going to be used in read-only mode if its supplementary
information is going to be read in to ensure that the size and
location of the supplementary information is valid. Also when a
warning is raised let it be accepted, but bound the flagged field
to the value checked by the warning.

No legitimate superblocks should fail as a result of these changes.

Reported by:  Bob Prohaska, John-Mark Gurney, and Mark Millard
Tested by:    Peter Holm
Reviewed by:  Peter Holm
MFC after:    2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D38668

14 months agosrc.opts.mk: Remove long-unused NDIS option
Ed Maste [Tue, 7 Mar 2023 19:03:27 +0000 (14:03 -0500)]
src.opts.mk: Remove long-unused NDIS option

NDIS was removed a couple of years ago, but the src.conf knob was left
behind.

Fixes: bfc99943b04b ("ndis(4): remove as previous announced")
Sponsored by: The FreeBSD Foundation

14 months agoMechanically convert cxgb(4) and cxgbe(4) to IfAPI
Justin Hibbits [Mon, 30 May 2022 19:39:59 +0000 (14:39 -0500)]
Mechanically convert cxgb(4) and cxgbe(4) to IfAPI

Reviewed by: np
Sponsored by: Juniper Networks, Inc.
Differential Revision: https://reviews.freebsd.org/D38597

14 months agoMechanically convert qlxgbe(4) to IfAPI
Justin Hibbits [Wed, 17 Aug 2022 20:27:58 +0000 (16:27 -0400)]
Mechanically convert qlxgbe(4) to IfAPI

Reviewed by: zlei
Sponsored by: Juniper Networks, Inc.
Differential Revision: https://reviews.freebsd.org/D37821

14 months agoMechanically convert qlxgb(4) to IfAPI
Justin Hibbits [Wed, 17 Aug 2022 20:27:29 +0000 (16:27 -0400)]
Mechanically convert qlxgb(4) to IfAPI

Reviewed by: zlei
Sponsored by: Juniper Networks, Inc.
Differential Revision: https://reviews.freebsd.org/D37820

14 months agoMechanically convert qlxge(4) to IfAPI
Justin Hibbits [Wed, 17 Aug 2022 20:26:49 +0000 (16:26 -0400)]
Mechanically convert qlxge(4) to IfAPI

Reviewed by: zlei
Sponsored by: Juniper Networks, Inc.
Differential Revision: https://reviews.freebsd.org/D37819

14 months agosrc.opts.mk: sync FDT and OFED options with kern.opts.mk
Ed Maste [Tue, 7 Mar 2023 16:39:46 +0000 (11:39 -0500)]
src.opts.mk: sync FDT and OFED options with kern.opts.mk

Where options exist in both src.opts.mk and kern.opts.mk they should be
kept in sync.

It may be that the option should be flipped the other way (e.g.,
enabling OFED in the kernel on arm64); if so that will be done as a
subsequent commit after further testing.

PR: 269994
Reviewed by: imp
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D38952

14 months agonetlink: cleanup netlink_writer code
Alexander V. Chernikov [Tue, 7 Mar 2023 17:42:27 +0000 (17:42 +0000)]
netlink: cleanup netlink_writer code

* Remove unused nlattr_add_nla() - that's a duplicate of nlattr_add_raw().
* Calculate alignment only once in nlmsg_reserve_data_raw()

MFC after: 2 weeks

14 months agoarm64: fix the LINT-ACPI build
Kyle Evans [Tue, 7 Mar 2023 17:37:31 +0000 (11:37 -0600)]
arm64: fix the LINT-ACPI build

This file uses VM_MEMATTR_DEVICE_NP, which it gets through header
pollution somewhere with FDT enabled.  Pull in vm/vm.h to make it
explicit.

14 months agotests: add more netlink tests for neighbors/routes
Alexander V. Chernikov [Tue, 7 Mar 2023 17:30:35 +0000 (17:30 +0000)]
tests: add more netlink tests for neighbors/routes

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

14 months agolibc: Remove prototype and documentation for tzsetwall().
Dag-Erling Smørgrav [Tue, 7 Mar 2023 16:04:29 +0000 (16:04 +0000)]
libc: Remove prototype and documentation for tzsetwall().

PR: 269445
Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D38481

14 months agobyacc: Disable backtracking extension.
Dag-Erling Smørgrav [Tue, 7 Mar 2023 16:04:24 +0000 (16:04 +0000)]
byacc: Disable backtracking extension.

When updating byacc to 20230201, I enabled the backtracking extension as it seemed useful and harmless.  With a little more experience, it appears to have more impact than I initially thought and I'm no longer sure how useful it really is, so turn it back off.

PR: 244149, 269425
Sponsored by: Klara, Inc.
Reviewed by: imp, jkim
Differential Revision: https://reviews.freebsd.org/D38931

14 months agotarfs: Set mountedfrom correctly.
Dag-Erling Smørgrav [Tue, 7 Mar 2023 16:04:18 +0000 (16:04 +0000)]
tarfs: Set mountedfrom correctly.

Sponsored by: Juniper Networks, Inc.
Sponsored by: Klara, Inc.
Reviewed by: sjg, kib
Differential Revision: https://reviews.freebsd.org/D38930

14 months agoaltera: Fix build from 068f2c0e10
Justin Hibbits [Tue, 7 Mar 2023 16:42:09 +0000 (11:42 -0500)]
altera: Fix build from 068f2c0e10

Missed the altera dwc driver in the conversion.

Fixes: 068f2c0e10
Sponsored by: Juniper Networks, Inc.

14 months agobhyve: Move libcasper dependecy to lib9p
Vitaliy Gusev [Tue, 7 Mar 2023 16:09:22 +0000 (11:09 -0500)]
bhyve: Move libcasper dependecy to lib9p

libcasper(3) is not used in bhyve. So move dependency to the appropriate
place.

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

14 months ago.gitignore: Ignore LSP generated .cache
Jake Freeland [Tue, 7 Mar 2023 15:04:18 +0000 (10:04 -0500)]
.gitignore: Ignore LSP generated .cache

Language servers like clangd generate a .cache directory to store
compilation cache. Tell Git to ignore this directory when staging files.

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

14 months agoMechanically convert dwc(4) to IfAPI
Justin Hibbits [Sat, 20 Aug 2022 02:04:32 +0000 (22:04 -0400)]
Mechanically convert dwc(4) to IfAPI

Reviewed by: manu (older)
Sponsored by: Juniper Networks, Inc.
Differential Revision: https://reviews.freebsd.org/D37846

14 months agocpsw(4): Finish conversion to IfAPI
Justin Hibbits [Mon, 6 Mar 2023 21:27:27 +0000 (16:27 -0500)]
cpsw(4): Finish conversion to IfAPI

Two ifnet accesses were missed in 2c7bc0f55.

Sponsored by: Juniper Networks, Inc.

14 months agolinux: Use the if_name() accessor to get loopback name
Justin Hibbits [Mon, 6 Mar 2023 16:36:31 +0000 (11:36 -0500)]
linux: Use the if_name() accessor to get loopback name

Avoid directly accessing the if_xname ifnet member. and use the
designated accessor function instead.

Sponsored by: Juniper Networks, Inc.

14 months agoktls: Use IfAPI accessors to get capabilities
Justin Hibbits [Mon, 6 Mar 2023 18:28:26 +0000 (13:28 -0500)]
ktls: Use IfAPI accessors to get capabilities

Summary:
Avoid referencing the ifnet struct directly, and use the IfAPI accessors
instead.

Reviewed by: gallatin
Sponsored by: Juniper Networks, Inc.
Differential Revision: https://reviews.freebsd.org/D38932

14 months agoiflib: Further convert to use IfAPI accessors
Justin Hibbits [Mon, 6 Mar 2023 16:38:05 +0000 (11:38 -0500)]
iflib: Further convert to use IfAPI accessors

Summary:
When iflib was first converted some IfAPI APIs were not yet present, so
were tagged with "XXX" comments.  Finish the conversion by using these
new APIs.

Reviewed by: gallatin, erj
Sponsored by: Juniper Networks, Inc
Differential Revision: https://reviews.freebsd.org/D38928

14 months agocarp tests: ensure exactly one jail is master
Kristof Provost [Mon, 6 Mar 2023 12:33:50 +0000 (13:33 +0100)]
carp tests: ensure exactly one jail is master

Verify that we only have one master, not two.

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

14 months agoarm64: ofw: respect the nonposted-mmio prop in OF_decode_addr()
Kyle Evans [Tue, 7 Mar 2023 06:15:32 +0000 (00:15 -0600)]
arm64: ofw: respect the nonposted-mmio prop in OF_decode_addr()

This is the only mapping remaining which needs to respect nonposted-mmio
to avoid breaking the boot on Apple silicon.

Reviewed by: andrew
Differential Revision: https://reviews.freebsd.org/D38920

14 months agoFFS/UFS snapshots: improve documentation for removal (deletion) and unlinking.
Kirk McKusick [Tue, 7 Mar 2023 05:43:32 +0000 (21:43 -0800)]
FFS/UFS snapshots: improve documentation for removal (deletion) and unlinking.

Minor clarification.

14 months agosrc.opts.mk: mark ZFS broken on powerpc, matching kern.opts.mk
Ed Maste [Mon, 6 Mar 2023 21:47:36 +0000 (16:47 -0500)]
src.opts.mk: mark ZFS broken on powerpc, matching kern.opts.mk

Where options exist in both src.opts.mk and kern.opts.mk they should be
kept in sync.

PR: 269994
Reviewed by: imp
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D38935

14 months agoATM: Remove /usr/include/netnatm when disbled
Herbert J. Skuhra [Mon, 6 Mar 2023 21:45:39 +0000 (21:45 +0000)]
ATM: Remove /usr/include/netnatm when disbled

14 months agosrc.conf: regen after d7a491dd3037
Ed Maste [Mon, 6 Mar 2023 21:07:38 +0000 (16:07 -0500)]
src.conf: regen after d7a491dd3037

Machine-dependent kernel options are now detected correctly.

PR: 269994
Sponsored by: The FreeBSD Foundation

14 months agomake showconfig: set MACHINE and MACHINE_ARCH
Ed Maste [Mon, 6 Mar 2023 15:56:13 +0000 (10:56 -0500)]
make showconfig: set MACHINE and MACHINE_ARCH

Previously these were not set for the showconfig target, so took the
host's value rather than the target.  As a result some machine-dependent
kernel options were not reported with correct defaults in the src.conf
manpage.

PR: 269994
Reviewed by: imp
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D38926

14 months agonetinet: Tighten checks for unspecified source addresses
Mark Johnston [Mon, 6 Mar 2023 20:06:00 +0000 (15:06 -0500)]
netinet: Tighten checks for unspecified source addresses

The assertions added in commit b0ccf53f2455 ("inpcb: Assert against
wildcard addrs in in_pcblookup_hash_locked()") revealed that protocol
layers may pass the unspecified address to in_pcblookup().

Add some checks to filter out such packets before we attempt an inpcb
lookup:
- Disallow the use of an unspecified source address in in_pcbladdr() and
  in6_pcbladdr().
- Disallow IP packets with an unspecified destination address.
- Disallow TCP packets with an unspecified source address, and add an
  assertion to verify the comment claiming that the case of an
  unspecified destination address is handled by the IP layer.

Reported by: syzbot+9ca890fb84e984e82df2@syzkaller.appspotmail.com
Reported by: syzbot+ae873c71d3c71d5f41cb@syzkaller.appspotmail.com
Reported by: syzbot+e3e689aba1d442905067@syzkaller.appspotmail.com
Reviewed by: glebius, melifaro
MFC after: 2 weeks
Sponsored by: Klara, Inc.
Sponsored by: Modirum MDPay
Differential Revision: https://reviews.freebsd.org/D38570

14 months agopfctl: remove set but unused variable
Kristof Provost [Mon, 6 Mar 2023 07:10:27 +0000 (08:10 +0100)]
pfctl: remove set but unused variable

In pfctl_show_ifaces() `i` is set, but never used. Remove it.

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

14 months agopfctl: fix superblock printf format mismatch
Kajetan Staszkiewicz [Mon, 6 Mar 2023 07:08:41 +0000 (08:08 +0100)]
pfctl: fix superblock printf format mismatch

It is impossible to compile pfctl with OPT_DEBUG due to integer width mismatch:

/usr/home/kajetan.staszkiewicz/freebsd.git/sbin/pfctl/pfctl_optimize.c:1479:9: error: format specifies type 'unsigned int' but the argument has type 'unsigned long' [-Werror,-Wformat]
    i - pf_rule_desc[closest].prf_off--- pfctl_optimize.o ---
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/home/kajetan.staszkiewicz/freebsd.git/sbin/pfctl/pfctl_optimize.c:52:44: note: expanded from macro 'DEBUG'
printf("%s: " str "\n", __FUNCTION__ , ## v)
      ~~~                         ^
1 error generated.

Reviewed by: kp
Obtained from: OpenBSD (pfctl_optimize.c 1.15)
Differential Revision: https://reviews.freebsd.org/D38918

14 months agoreadelf: fix -wR option, memory leaks, and -wf minor bug
Christos Margiolis [Mon, 6 Mar 2023 17:50:13 +0000 (12:50 -0500)]
readelf: fix -wR option, memory leaks, and -wf minor bug

Reviewed by: markj
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D38419

14 months agoepair: Simplify the transmit path and address lost wakeups
Mark Johnston [Wed, 1 Mar 2023 20:21:30 +0000 (15:21 -0500)]
epair: Simplify the transmit path and address lost wakeups

epairs currently shuttle all transmitted packets through a single global
taskqueue thread.  To hand packets over to the taskqueue thread, each
epair maintains a pair of ring buffers and a lockless scheme for
notifying the thread of pending work.  The implementation can lead to
lost wakeups, causing to-be-transmitted packets to end up stuck in the
queue.

Rather than extending the existing scheme, simply replace it with a
linked list protected by a mutex, and use the mutex to synchronize
wakeups of the taskqueue thread.  This appears to give equivalent or
better throughput with >= 16 producer threads and eliminates the lost
wakeups.

Reviewed by: kp
MFC after: 1 week
Sponsored by: Klara, Inc.
Sponsored by: Modirum MDPay
Differential Revision: https://reviews.freebsd.org/D38843

14 months agoepair: Avoid loading m_flags into a short
Mark Johnston [Mon, 6 Mar 2023 14:39:17 +0000 (09:39 -0500)]
epair: Avoid loading m_flags into a short

The m_flags field of struct mbuf is 24 bits wide and so gets truncated
in a couple of places in the epair code.  Instead of preserving the
entire flag set, just remember whether M_BCAST or M_MCAST is set.

MFC after: 1 week
Sponsored by: Klara, Inc.

14 months agonetmap: pkt-gen: init all slots of every tx ring
Vincenzo Maffione [Mon, 6 Mar 2023 17:22:09 +0000 (17:22 +0000)]
netmap: pkt-gen: init all slots of every tx ring

sender_body() uses OPT_COPY to copy the frame into the destination slot
for the first 100,000 packets. Then it removes OPT_COPY to improve
performance. The function always starts with the first tx ring.

If multiple tx rings are in use, it is possible that the initial 100k
packets will only use the first ring. After OPT_COPY is removed, there
may come a time when the first ring is full and sender_body() will move
to the next ring which was never initialized. As a result it will send
all zero packets. (This was discovered when the receiving NIC reported
rx errors.)

Before any transmissions, step through every tx ring and set
NS_BUF_CHANGED on every slot. That will force send_packets() to
initialize the slot when first used. Since it only copies when
necessary, it performs better than always setting OPT_COPY. With this
change, there is no reason for the "drop copy" code.

Submitted by: Brian Poole <brian90013@gmail.com>
MFC after: 7 days

14 months agoMechanically convert usb ethernet drivers to DrvAPI
Justin Hibbits [Tue, 7 Feb 2023 16:10:10 +0000 (11:10 -0500)]
Mechanically convert usb ethernet drivers to DrvAPI

Reviewed by: zlei
Sponsored by: Juniper Networks, Inc.
Differential Revision: https://reviews.freebsd.org/D37812

14 months agomlx5: Enter network epoch when using if_foreach()
Justin Hibbits [Tue, 21 Feb 2023 19:43:53 +0000 (14:43 -0500)]
mlx5: Enter network epoch when using if_foreach()

Summary: IFNET_RLOCK() is not sufficient, the epoch needs entered.

Reviewed by: hselasky
Sponsored by: Juniper Networks, Inc.
Differential Revision: https://reviews.freebsd.org/D38711

14 months agonetstat: fix IPv6 link-locals & custom multipath printing.
Alexander V. Chernikov [Mon, 6 Mar 2023 15:06:04 +0000 (15:06 +0000)]
netstat: fix IPv6 link-locals & custom multipath printing.

14 months agodhclient: do not add 0.0.0.0 interface alias.
Alexander V. Chernikov [Sat, 4 Mar 2023 15:18:26 +0000 (15:18 +0000)]
dhclient: do not add 0.0.0.0 interface alias.

Subscribers: imp

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

14 months agonetlink: use newly-added if_foreach_sleep() to iterate over the interface list.
Alexander V. Chernikov [Sat, 4 Mar 2023 15:15:56 +0000 (15:15 +0000)]
netlink: use newly-added if_foreach_sleep() to iterate over the interface list.

Summary: MFC after: 2 weeks

Subscribers: imp, glebius

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

14 months agoifnet: add if_foreach_sleep() to allow ifnet iterations with sleep.
Alexander V. Chernikov [Sat, 4 Mar 2023 10:09:09 +0000 (10:09 +0000)]
ifnet: add if_foreach_sleep() to allow ifnet iterations with sleep.

Subscribers: imp, ae, glebius

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

14 months agonet: unify mtu update code
Alexander V. Chernikov [Fri, 3 Mar 2023 16:30:15 +0000 (16:30 +0000)]
net: unify mtu update code

Subscribers: imp, ae, glebius

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

14 months agobhyvectl: don't permit using --suspend and --checkpoint at same time
Vitaliy Gusev [Mon, 6 Mar 2023 12:42:15 +0000 (13:42 +0100)]
bhyvectl: don't permit using --suspend and --checkpoint at same time

When using the --suspend and --checkpoint parameter, bhyvectl will
produce two checkpoint images and the exits. This is slightly ambiguous.
So, permit only one of theses parameters at the same time.

Reviewed by: corvink, markj
MFC after: 1 week
Sponsored by: vStack
Differential Revision: https://reviews.freebsd.org/D38887

14 months agobhyve: init checkput before caph_enter
Vitaliy Gusev [Mon, 6 Mar 2023 12:35:21 +0000 (13:35 +0100)]
bhyve: init checkput before caph_enter

init_checkpoint_thread binds to a socket. Bhyve isn't allowed to do that
after caph_enter.

Reviewed by: corvink, markj
MFC after: 1 week
Sponsored by: vStack
Differential Revision: https://reviews.freebsd.org/D38857

14 months agobhyve: exit with EX_OSERR if init checkpoint or restore time failed
Vitaliy Gusev [Mon, 6 Mar 2023 12:30:54 +0000 (13:30 +0100)]
bhyve: exit with EX_OSERR if init checkpoint or restore time failed

Reviewed by: corvink, markj
MFC after: 1 week
Sponsored by: vStack
Differential Revision: https://reviews.freebsd.org/D38872

14 months agobhyve: add cap limits for ipc socket
Vitaliy Gusev [Mon, 6 Mar 2023 11:36:40 +0000 (12:36 +0100)]
bhyve: add cap limits for ipc socket

Reviewed by: corvink, markj
MFC after: 1 week
Sponsored by: vStack
Differential Revision: https://reviews.freebsd.org/D38856

14 months agobhyve: don't flush readonly device at blockif_pause
Vitaliy Gusev [Mon, 6 Mar 2023 11:35:17 +0000 (12:35 +0100)]
bhyve: don't flush readonly device at blockif_pause

Reviewed by: corvink, markj
MFC after: 1 week
Sponsored by: vStack
Differential Revision: https://reviews.freebsd.org/D38855

14 months agolibvmm: add missing ioctl's to vm_ioctl_cmds
Vitaliy Gusev [Mon, 6 Mar 2023 11:33:58 +0000 (12:33 +0100)]
libvmm: add missing ioctl's to vm_ioctl_cmds

Reviewed by: corvink, markj
MFC after: 1 week
Sponsored by: vStack
Differential Revision: https://reviews.freebsd.org/D38866

14 months agobhyvectl: don't leak nvlist in send_message
Vitaliy Gusev [Mon, 6 Mar 2023 11:32:17 +0000 (12:32 +0100)]
bhyvectl: don't leak nvlist in send_message

Reviewed by: corvink, markj
MFC after: 1 week
Sponsored by: vStack
Differential Revision: https://reviews.freebsd.org/D38900

14 months agobhyvectl: correct socket_fd closing in send_message
Vitaliy Gusev [Mon, 6 Mar 2023 11:30:44 +0000 (12:30 +0100)]
bhyvectl: correct socket_fd closing in send_message

Reviewed by: corvink, markj
MFC after: 1 week
Sponsored by: vStack
Differential Revision: https://reviews.freebsd.org/D38889

14 months agobhyvectl: do not return garbage from send_message
Vitaliy Gusev [Mon, 6 Mar 2023 11:27:10 +0000 (12:27 +0100)]
bhyvectl: do not return garbage from send_message

err is used uninitialized in some cases.

Reviewed by: corvink, markj
MFC after: 1 week
Sponsored by: vStack
Differential Revision: https://reviews.freebsd.org/D38886

14 months agostress2: Fix a off-by-one error. Added check for argument file type
Peter Holm [Mon, 6 Mar 2023 09:03:43 +0000 (10:03 +0100)]
stress2: Fix a off-by-one error.  Added check for argument file type

14 months agoRemove a #error that sneaked in
Andrew Turner [Mon, 6 Mar 2023 08:06:43 +0000 (08:06 +0000)]
Remove a #error that sneaked in

14 months agouuidgen(1): fix another typo
Baptiste Daroussin [Mon, 6 Mar 2023 08:03:32 +0000 (09:03 +0100)]
uuidgen(1): fix another typo

14 months agoFFS/UFS snapshots: improve documentation.
Kirk McKusick [Mon, 6 Mar 2023 05:37:23 +0000 (21:37 -0800)]
FFS/UFS snapshots: improve documentation.

This update provides a more detailed description of FFS/UFS snapshots
and adds links to useful man pages.

Requested by: Graham Perrin
Submitted by: darius-dons.net.au
Reviewed by:  Ravi Pokala
PR:           266358
MFC after:    2 weeks
Differential Revision: https://reviews.freebsd.org/D38817

14 months agonetstat: fix pfsync stats spelling
Kajetan Staszkiewicz [Tue, 7 Feb 2023 21:50:09 +0000 (22:50 +0100)]
netstat: fix pfsync stats spelling

Reviewed by: mjg

14 months agoSupport non-posted MMIO on arm64 with FDT
Andrew Turner [Sun, 5 Mar 2023 12:35:40 +0000 (12:35 +0000)]
Support non-posted MMIO on arm64 with FDT

To allow hardware to work around a broken memory bus where we need to
support the nonposted-mmio flag.

Reviewed by: kevans
Differential Revision: https://reviews.freebsd.org/D34333

14 months agoMap arm64 pci config memory as non-posted
Andrew Turner [Sun, 5 Mar 2023 12:34:35 +0000 (12:34 +0000)]
Map arm64 pci config memory as non-posted

On arm64 PCI config memory is expected to be mapped with a non-posted
device type. To handle this use the new bus_map_resource support in
arm64 to map memory with the new VM_MEMATTR_DEVICE_NP attribute. This
memory has already been allocated and activated, it just needs to be
mapped.

Reviewed by: kevans, mmel
Differential Revision: https://reviews.freebsd.org/D30079

14 months agolinux_80211: Don't dequeue lsta if not queued
Colin Percival [Sun, 5 Mar 2023 20:10:57 +0000 (12:10 -0800)]
linux_80211: Don't dequeue lsta if not queued

This fixes an instapanic when restarting wpa_supplicant on my laptop's
iwlwifi device.  After this change, iwlwifi enters a nonfunctional
state if wpa_supplicant is restarted, but "service netif restart wlan0"
is enough to get it working again.

releng/13.2 candidate.

Reviewed by: bz
MFC after: 3 days

14 months agoxz: Improve compatibility with systems without capability mode support
Xin LI [Sun, 5 Mar 2023 09:40:13 +0000 (01:40 -0800)]
xz: Improve compatibility with systems without capability mode support

When the kernel is built without capability mode support, or when
using an emulator like qemu-user-static that does not translate
system calls, these calls will return a negative number and set
the errno to ENOSYS. However, this error does not indicate a
real programming or runtime error and is generally ignored by
base system applications built with capability mode sandboxing.

Match this behavior by making xz(1) to ignore ENOSYS errors
when calling capability mode system calls too.

PR: 269185
Reported by: Dan Kotowski
MFC after: 2 days

14 months agonetlink: Fix "version introduced" documentation
Tom Hukins [Sat, 4 Mar 2023 15:59:02 +0000 (08:59 -0700)]
netlink: Fix "version introduced" documentation

netlink(4) and associated features will exist in FreeBSD 14.0 but they
will also exist in 13.2, an older version, from commits such as 02b958b1
and b309249b.

This commit needs merging to stable/13 and releng/13.2.

MFC after: 2days (needs to be in RC2)
Reviewed by: imp,melifaro
Pull Request: https://github.com/freebsd/freebsd-src/pull/651

14 months agonetpfil tests: Add functions for testing routing scenarios
Kristof Provost [Sat, 4 Mar 2023 13:35:24 +0000 (14:35 +0100)]
netpfil tests: Add functions for testing routing scenarios

Many pf tests use identical setup where one jail is a router and
optionally another jail is a server. Add functions to create such jails
for IPv6 and IPv4 and functions to perform tests on such setup.

Add tests using those functions: scrub actions, routing table, tcp
sequence number modulation.

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

14 months agoifconfig: remove unused variable
Kristof Provost [Thu, 2 Mar 2023 09:30:57 +0000 (10:30 +0100)]
ifconfig: remove unused variable

In printgroup() 'cnt' is set, but never read. Remove it.

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

14 months agolinux(4): Fixup 5c32488de0 mis-merge
Dmitry Chagin [Sat, 4 Mar 2023 09:42:04 +0000 (12:42 +0300)]
linux(4): Fixup 5c32488de0 mis-merge

14 months agolinux(4): Add a counterpart to linux_ifflags
Dmitry Chagin [Sat, 4 Mar 2023 09:26:48 +0000 (12:26 +0300)]
linux(4): Add a counterpart to linux_ifflags

For further use in linux_ioctl_socket add bsd_to_linux_ifflags() which
accepts FreeBSD interface flags and translate it to Linux if flags.

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

14 months agolinux(4): Assert that the FreeBSD size of struct sockaddr is equal to Linux
Dmitry Chagin [Sat, 4 Mar 2023 09:11:39 +0000 (12:11 +0300)]
linux(4): Assert that the FreeBSD size of struct sockaddr is equal to Linux

Our code depends on the fact that the size of struct sockaddr and
the size of sa_data is equal between FreeBSD and Linux.

14 months agolinux(4): Drop excess assert that Linux IFNAMSIZ is equal to FreeBSD
Dmitry Chagin [Sat, 4 Mar 2023 09:11:39 +0000 (12:11 +0300)]
linux(4): Drop excess assert that Linux IFNAMSIZ is equal to FreeBSD

While here use _Static_assert() instead of the older CTASSERT().

14 months agolinux(4): Improve linux_ifconf readability
Dmitry Chagin [Sat, 4 Mar 2023 09:11:39 +0000 (12:11 +0300)]
linux(4): Improve linux_ifconf readability

Initialize max_len and full variables in a code block where
they are used.

14 months agolinux(4): Fixup of the pointer cast when comparing to an integer
Dmitry Chagin [Sat, 4 Mar 2023 09:11:39 +0000 (12:11 +0300)]
linux(4): Fixup of the pointer cast when comparing to an integer

14 months agolinux(4): Add net epoch assert to the linux_ifhwaddr, linux_ifflags
Dmitry Chagin [Sat, 4 Mar 2023 09:11:38 +0000 (12:11 +0300)]
linux(4): Add net epoch assert to the linux_ifhwaddr, linux_ifflags

Now this functions are intended to use in the net epoch.

Reviewed by: emaste, melifaro
Differential Revision: https://reviews.freebsd.org/D38795

14 months agolinux(4): Refactor socket ioctl path to avoid referencing an unstable interfaces
Dmitry Chagin [Sat, 4 Mar 2023 09:11:38 +0000 (12:11 +0300)]
linux(4): Refactor socket ioctl path to avoid referencing an unstable interfaces

Split the linux_ioctl_socket() function on two counterparts, where
the linux_ioctl_socket_ifreq() intended to use in a code path which
requires the struct ifreq manipulation, i.e., translating in/out
values of the struct, while the linux_ioctl_socket() function is left
as is, it calls sys_ioctl() without touching in/out values.

Due to structures ifreq, sockaddr difference between FreeBSD and Linux
the linux_ioctl_socket_ifreq() calls kern_ioctl() directly, converting
in and out values to FreeBSD and to Linux accordingly.

Finally, modify the ifname_linux_to_bsd() to return error code, not
an unstable reference to the interface.

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

14 months agolinux(4): Drop unncessary struct l_ifconf declaration from amd64/linux
Dmitry Chagin [Sat, 4 Mar 2023 09:11:38 +0000 (12:11 +0300)]
linux(4): Drop unncessary struct l_ifconf declaration from amd64/linux

Its needed only for amd64/linux32 Linuxulator.

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

14 months agolinux(4): Rename struct l_ifreq members names to avoid conflicts with FreeBSD
Dmitry Chagin [Sat, 4 Mar 2023 09:11:38 +0000 (12:11 +0300)]
linux(4): Rename struct l_ifreq members names to avoid conflicts with FreeBSD

For now we are using mixed names to access struct ifreq members, some
of Linux (ifr_name, ifr_ifindex), others of FreeBSD. To avoid conflicts
switch to use FreeBSD names.

Reviewed by: jhibbits
Differential Revision: https://reviews.freebsd.org/D38792

14 months agolinux(4): Reduce code duplication between MD files
Dmitry Chagin [Sat, 4 Mar 2023 09:11:38 +0000 (12:11 +0300)]
linux(4): Reduce code duplication between MD files

Move struct ifnet definitions under compat/linux.

Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D38791

14 months agolinsysfs(4): Refactor to avoid referencing an unstable interfaces
Dmitry Chagin [Sat, 4 Mar 2023 09:11:38 +0000 (12:11 +0300)]
linsysfs(4): Refactor to avoid referencing an unstable interfaces

Enter the net epoch when traversing a list of interfaces. For that
split the ifname_linux_to_bsd() function on two counterparts, where
the ifname_linux_to_ifp() intended to use in epoch, while the
ifname_linux_to_bsd() intended to be a self-contained.
Until the linux_ioctl_coket() function is refactored, the
ifname_linux_to_bsd() temporarily returns interface outside
of the net epoch.

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

14 months agolinux(4): Make linux_ifflags return a value
Dmitry Chagin [Sat, 4 Mar 2023 09:11:38 +0000 (12:11 +0300)]
linux(4): Make linux_ifflags return a value

To simplify the use of the function in the printf-like statements.

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

14 months agolinux(4): Migrate to IfAPI
Dmitry Chagin [Sat, 4 Mar 2023 09:11:38 +0000 (12:11 +0300)]
linux(4): Migrate to IfAPI

Migrate linux and linprocfs to use the IfAPI interfaces instead of
direct ifnet accesses.
The code initially writed by jhibbits@, and adapted by me to 3ab3c9c2.

Reviewed by: jhibbits
Differential Revision:  https://reviews.freebsd.org/D38735

14 months agoin_mcat.c: change multicast not member condition
Fidaullah Noonari [Tue, 28 Feb 2023 16:44:12 +0000 (09:44 -0700)]
in_mcat.c: change multicast not member condition

If there is no source filter entry => block if that's SSM ("exclude"
mode per RFC 3678 clause 3).  If there is an entry => check its action &
block if the action is "exclude".

It would be nice if the test case in this PR were converted into an ATF
test case, but not blocking on that.

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

14 months agoipfw: garbage collect ip_fw_chk_ptr
Gleb Smirnoff [Fri, 3 Mar 2023 18:29:44 +0000 (10:29 -0800)]
ipfw: garbage collect ip_fw_chk_ptr

It is a relict left from the old times when ipfw(4) was hooked
into IP stack directly, without pfil(9).

14 months agoarm64: disable the physical timer for now if HCR_EL2.E2H is set
Kyle Evans [Fri, 3 Mar 2023 17:02:19 +0000 (11:02 -0600)]
arm64: disable the physical timer for now if HCR_EL2.E2H is set

On some hardware, we can't clear HCR_EL2.E2H so accesses to the physical
timer hopelessly trap to EL2.  Stash off the value of HCR_EL2 and use it
in has_hyp() to avoid this.

Reviewed by: andrew
Differential Revision: https://reviews.freebsd.org/D38884

14 months agopkgbase: Put termcap.small in the same package as termcap
Mark Johnston [Fri, 3 Mar 2023 17:00:14 +0000 (12:00 -0500)]
pkgbase: Put termcap.small in the same package as termcap

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

14 months agong_atmllc: deprecate
Brooks Davis [Fri, 3 Mar 2023 16:20:29 +0000 (16:20 +0000)]
ng_atmllc: deprecate

With the deprecation of NgATM, ng_atmllc is the last vestage of ATM
support so deprecate it too.

MFC after: 3 days
Relnotes: yes

Reviewed by: manu, emaste
Differential Revision: https://reviews.freebsd.org/D38878

14 months agoNgATM: deprecate
Brooks Davis [Fri, 3 Mar 2023 16:20:18 +0000 (16:20 +0000)]
NgATM: deprecate

Support for ATM NICs was removed prior to FreeBSD 12.  At the time it
was unclear if this code was still useful without it.  Now the time has
come to finish removing support.

Add DREPRECATION NOTICEs to the manpages and gone_in(14, ...) warnings
in the constructors (or module init for ngatmbase).

MFC after: 3 days
Relnotes: yes

Reviewed by: manu, emaste
Differential Revision: https://reviews.freebsd.org/D38877

14 months agonanobsd: remove comment about keeping C++ enabled
Brooks Davis [Fri, 3 Mar 2023 16:13:44 +0000 (16:13 +0000)]
nanobsd: remove comment about keeping C++ enabled

It's no longer possible to disable C++ so there's no need to comment
on it.

Reviewed by: imp, emaste
Differential Revision: https://reviews.freebsd.org/D38883

14 months agoposixshm tests: Correct page size index checks
Mark Johnston [Fri, 3 Mar 2023 16:16:21 +0000 (11:16 -0500)]
posixshm tests: Correct page size index checks

MFC after: 1 week
Sponsored by: Klara, Inc.
Sponsored by: Juniper Networks, Inc.

14 months agodeadlkres: Make parameters settable with tunables
Mark Johnston [Fri, 3 Mar 2023 16:16:16 +0000 (11:16 -0500)]
deadlkres: Make parameters settable with tunables

MFC after: 1 week
Sponsored by: Klara, Inc.
Sponsored by: Juniper Networks, Inc.

14 months agobhyveload: Address compiler warnings and bump WARNS
Mark Johnston [Fri, 3 Mar 2023 14:52:17 +0000 (09:52 -0500)]
bhyveload: Address compiler warnings and bump WARNS

Mostly sprinkle __unused.  Also duplicate strings passed to addenv() so
that constant string literals can be passed.  No functional change
intended.

Reviewed by: corvink, rew, jhb
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D38840

14 months agobhyvectl: Address compiler warnings and bump WARNS
Mark Johnston [Fri, 3 Mar 2023 14:32:48 +0000 (09:32 -0500)]
bhyvectl: Address compiler warnings and bump WARNS

Avoid unaligned accesses in cpu_vendor_intel() and address a few other
nits.  No functional change intended.

Reviewed by: corvink, rew, jhb
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D38839

14 months agonetlink: fix vlan interface creation
Alexander V. Chernikov [Fri, 3 Mar 2023 16:01:34 +0000 (16:01 +0000)]
netlink: fix vlan interface creation

MFC after: 2 weeks

14 months agonetlink: add u8/u64 attribute fetcher accessors to snl(3).
Alexander V. Chernikov [Fri, 3 Mar 2023 14:05:40 +0000 (14:05 +0000)]
netlink: add u8/u64 attribute fetcher accessors to snl(3).

MFC after: 2 weeks

14 months agobsnmp: Remove "All Rights Reserved" from FreeBSD Foundation copyrights
Ed Maste [Fri, 3 Mar 2023 13:10:44 +0000 (08:10 -0500)]
bsnmp: Remove "All Rights Reserved" from FreeBSD Foundation copyrights

14 months agodtrace_proc.4: Fix the description of pr_sname
Mateusz Piotrowski [Fri, 3 Mar 2023 10:14:41 +0000 (11:14 +0100)]
dtrace_proc.4: Fix the description of pr_sname

MFC after: 2 weeks
Sponsored by: Klara Inc.
Sponsored by: ELW – Entsorgungsbetriebe der Landeshauptstadt Wiesbaden

14 months agonote that some arch independent code can live in dev (e.g. SMBios)
John-Mark Gurney [Fri, 3 Mar 2023 09:54:07 +0000 (01:54 -0800)]
note that some arch independent code can live in dev (e.g. SMBios)

14 months agosrc.conf.5: Regen after switching to WITHOUT_ATM
Emmanuel Vadot [Fri, 3 Mar 2023 07:50:15 +0000 (08:50 +0100)]
src.conf.5: Regen after switching to WITHOUT_ATM

Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D38846

14 months agoAdd description for WITH_ATM
Emmanuel Vadot [Thu, 2 Mar 2023 07:26:38 +0000 (08:26 +0100)]
Add description for WITH_ATM

Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D38845

14 months agoDisable ATM programs by default
Emmanuel Vadot [Thu, 2 Mar 2023 07:21:34 +0000 (08:21 +0100)]
Disable ATM programs by default

ATM is an old technology, remove build of related programs by default

Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D38844
Reviewed by: brooks, imp, emaste