FreeBSD/src d803854lib/libc/net getaddrinfo.c, lib/libc/tests/net/getaddrinfo getaddrinfo.c

libc/getaddrinfo(2): return EAI_AGAIN on nameserver timeout

A nameserver timeout is a soft failure, future attempts may succeed.
Returning EAI_AGAIN is crucial for API users to tell a soft name
resolution failure from negative resolution result.

Before the change we would return EAI_ADDRFAMILY, which I believe, is a
regression from 144361386696, and before that revision we used to return
EAI_NONAME in most of the cases.

Reviewed by:            kib
Differential Revision:  https://reviews.freebsd.org/D49411
DeltaFile
+43-15lib/libc/net/getaddrinfo.c
+24-29lib/libc/tests/net/getaddrinfo/getaddrinfo.c
+67-442 files

FreeBSD/src 0b773a9lib/libc/tests/net/getaddrinfo no_host_v4v6.exp basics_v4v6.exp

libc/tests: enable getaddrinfo(1) tests from NetBSD

Enable running of contrib/netbsd-tests/lib/libc/net/getaddrinfo without
modifications to the test program itself.  However, create our own version
of expected results files.  They are produced from the NetBSD files, with
the following list of changes:

o AF_INET6 value is different, hence: s/family 24/family 28/.
o SCTP result (socktype 5 protocol 132) needs to be added to many queries
  results.
o NetBSD libc sorts multiple results first by protocol, then by address
  family.  FreeBSD first sorts on address family, then on protocol.  Some
  results need to be reordered.
o Error strings need to be fixed:
  s/hostname nor servname provided, or not known/Name does not resolve/
  s/ai_family not supported/Address family not recognized/
  s/servname not supported for ai_socktype/\
  Service was not recognized for socket type/.


    [2 lines not shown]
DeltaFile
+68-0lib/libc/tests/net/getaddrinfo/no_host_v4v6.exp
+50-0lib/libc/tests/net/getaddrinfo/basics_v4v6.exp
+44-0lib/libc/tests/net/getaddrinfo/no_host_v4.exp
+42-0lib/libc/tests/net/getaddrinfo/basics_v4.exp
+20-0lib/libc/tests/net/getaddrinfo/no_serv_v4v6.exp
+17-0lib/libc/tests/net/getaddrinfo/no_serv_v4.exp
+241-08 files not shown
+294-414 files

FreeBSD/src 5313457lib/libc/tests/net/getaddrinfo getaddrinfo.c Makefile

libc/tests: add getaddrinfo test

A test suite for getaddrinfo(3) written in C.  Unlike NetBSD test, this
one will be mostly focused on what the API should return when something
isn't good with your DNS.  Test emulates bad DNS servers in resolv.conf
intercepting fopen(2) and emulates downed network intercepting send(2).

Initial version covers three main scenarios: all good, server(s) timed
out, network down.  For each scenario we test hostname with trailing dot
and without, since libc resolver uses quite different code paths,
sometimes even yielding with different error codes.  All current error
codes in the test are what our libc returns right now, meaning the test
documents what we have, not what there should be.

Reviewed by:            kib
Differential Revision:  https://reviews.freebsd.org/D49410
DeltaFile
+267-0lib/libc/tests/net/getaddrinfo/getaddrinfo.c
+1-0lib/libc/tests/net/getaddrinfo/Makefile
+268-02 files

FreeBSD/src 5fa093bsbin/mount_nfs mount_nfs.c

mount_nfs: make temporary DNS failure non-fatal with background mode

Typical problem with network mounts is remote equipment not being
available when our host boots up after a power failure.  Even if you
properly configure boot order of all local services and wait for link
coming up on your NIC, you still may boot faster than some intermediate
switch on the network or the DNS server itself.  Let's refer to this as a
"server room boot race".  For NFS mounts with hostname in hosts(5) the
race is addressed by a retry loop on NFS mount timeout.  However, a DNS
resolution timeout is treated differently to NFS mount timeout.  We fail
on the former and keep retrying on the latter.

With feedback received on current@, I see that the problem is so old, that
people got used to it and see it as a desired behavior rather than a
problem.  And for those who is affected by the problem, they suggest
hosts(5) as a solution.  Note that using hosts(5) isn't scalable, and
using bare IP addresses is neither scalable, nor compatible with
Kerberized mounts.


    [7 lines not shown]
DeltaFile
+34-25sbin/mount_nfs/mount_nfs.c
+34-251 files

FreeBSD/src d8482e1tools/tools/ath/athpoke athpoke.c

athpoke: Use a format string with err()

Don't do err(1, ptr); that's a very old security risk turned warning.

Differential Revision:  https://reviews.freebsd.org/D49546
Reviewed by:    thj
DeltaFile
+3-3tools/tools/ath/athpoke/athpoke.c
+3-31 files

FreeBSD/src 3bae830tools/tools/ath/common ctrl.c

ath: fix athtools common code to correctly init state

Check req->s instead of s to know if the state needs to be
cleaned up first.

This error is from a refactor I did years ago.  Oops!

Differential Revision:  https://reviews.freebsd.org/D49545
Reviewed by:    thj
DeltaFile
+1-1tools/tools/ath/common/ctrl.c
+1-11 files

FreeBSD/src 2eab1f6sys/net80211 ieee80211_output.c

net80211: document the 802.11 specification for ieee80211_getcapinfo()

Add a reference to the 802.11 specification for the management frame
capability info field.

Differential Revision:  https://reviews.freebsd.org/D49513
Reviewed by:    thj
DeltaFile
+6-0sys/net80211/ieee80211_output.c
+6-01 files

FreeBSD/src 8b0acd8sys/dev/usb/wlan if_mtw.c

mtw: fix compilation with IEEE80211_SUPPORT_SUPERG enabled

It looks like this was missed during the driver development and
porting.

Differential Revision:  https://reviews.freebsd.org/D49512
Reviewed by:    thj
DeltaFile
+6-3sys/dev/usb/wlan/if_mtw.c
+6-31 files

FreeBSD/src 09f991frelease Makefile.azure

release/azure: Update instruction of publishing to Azure Marketplace

Using Compute Gallery as the source is the preferred method now.

Reviewed by:    brooks, emaste
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D49528
DeltaFile
+6-14release/Makefile.azure
+6-141 files

FreeBSD/src 50296dcshare/man/man7 hier.7

hier.7: Storage partitions are not filesystems

I recommended the incorrect text to the submitter.

MFC after:              3 days
Fixes:                  f47cbb29e1c2 (Add /dev/gpt)
Reported by:            Mark Millard <marklmi at yahoo.com>
Reviewed by:            imp, mhorne
Approved by:            mhorne (mentor)
Differential Revision:  https://reviews.freebsd.org/D49523
DeltaFile
+1-1share/man/man7/hier.7
+1-11 files

FreeBSD/src 187d954usr.bin/top top.1 top.c

top: Sync usage and synopsis

Switching between io and cpu sorting uses a great example in the usage.
[-m io | cpu]. Use that everywhere.

MFC after:              3 days
Reviewed by:            mhorne
Approved by:            mhorne (mentor)
Differential Revision:  https://reviews.freebsd.org/D49515
DeltaFile
+2-2usr.bin/top/top.1
+1-1usr.bin/top/top.c
+3-32 files

FreeBSD/src 75a320ebin/ps ps.1

ps.1: Use ISO/IEC byte units

The ps(1) utility uses 1024 byte units, not 1000 byte units.

git grep KiB | wc -l
        535
git grep KBytes | wc -l
        39

Fixes:                  20bdda14fa5c (Consistent usage of Kbyte unit)
MFC after:              3 days
Reviewed by:            jsm, imp, mhorne
Approved by:            mhorne (mentor)
Differential Revision:  https://reviews.freebsd.org/D49522
DeltaFile
+7-7bin/ps/ps.1
+7-71 files

FreeBSD/src a1759dcsys/arm64/arm64 gicv3_its.c

arm64: Fix off-by-one in its_init_cpu_lpi

The low bits of GICR_PROPBASER are defined as
  The number of bits of LPI INTID supported, minus one, by the LPI
  Configuration table starting at Physical_Address.
but flsl(1 << n) returns n + 1; use ilog2_long instead.

PR:     285677
Reported by:    Julien Grall
Reviewed by:    andrew
Sponsored by:   Amazon
Differential Revision:  https://reviews.freebsd.org/D49542
DeltaFile
+1-1sys/arm64/arm64/gicv3_its.c
+1-11 files

FreeBSD/src 269cbe0sys/conf kern.opts.mk

kern.opts.mk: Remove EFI from riscv BROKEN_OPTIONS

This discrepancy previously caused `make makeman` to warn
`riscv/riscv64: ignoring duplicate option EFI`.  Make the kernel EFI
option consistent with EFI's per-arch defaults in src.opts.mk to remove
the warning.  Note that we do build EFI boot programs for RISC-V.

This is a NFC because the only component gated by the kernel's EFI
option is sys/modules/efirt, which is also inside of a MACHINE_CPUARCH
block that excludes riscv64 anyway.

Reviewed by:    mhorne
Sponsored by:   The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D49549
DeltaFile
+2-2sys/conf/kern.opts.mk
+2-21 files

FreeBSD/src a440b54sys/contrib/openzfs/include/os/freebsd/spl/sys simd_powerpc.h

zfs: remove inclusion of machine/pcpu.h

It was necessary in the beginning for a definition of curthread,
but in the later versions of the patch turned out to be not needed.

Fixes:  5b02365ac656e1cccf293ec1c57a8eb6c5cd51e2
Reported by:    mav
DeltaFile
+0-2sys/contrib/openzfs/include/os/freebsd/spl/sys/simd_powerpc.h
+0-21 files

FreeBSD/src 5b02365sys/conf files.powerpc, sys/contrib/openzfs/include/os/freebsd/spl/sys simd_powerpc.h

zfs: enable FPU on powerpc*

Summary:

MFC after:      1 week

Test Plan: make kernel and boot with ZFS on /

Reviewers: #powerpc

Subscribers: imp, delphij

Differential Revision: https://reviews.freebsd.org/D49538
DeltaFile
+12-3sys/contrib/openzfs/include/os/freebsd/spl/sys/simd_powerpc.h
+11-2sys/conf/files.powerpc
+23-52 files

FreeBSD/src aeddee8sbin/pfctl parse.y pfctl.c, sbin/pfctl/tests pfctl_test.c pfctl_test_list.inc

pfctl: Split pool parsing into separate functions

The pf pools are used in NAT, route-to and af-to rules. Some parts of
code are duplicated between them. Create functions apply_redirspec(),
apply_nat_ports() and apply_rdr_ports() to handle the common tasks.

Simplify data structures used for pool parsing. Move the contents of
struct redirection to struct redirspec. Map all ways of parsing pools
directly onto struct redirspec. Name various forms of struct redirspect
to hint where they are used.

Remove struct redirspec *rroute from struct filter_opts, because
filter_opts is bzero()'ed after the route part of rule is parsed, and
thus can't be used.

Add tests to ensure that parsing and error messages behave as expected.
The tests have been written and tested with pfctl from before this
patch.


    [6 lines not shown]
DeltaFile
+260-309sbin/pfctl/parse.y
+162-32sbin/pfctl/tests/pfctl_test.c
+37-0sbin/pfctl/tests/pfctl_test_list.inc
+10-0sbin/pfctl/pfctl.c
+3-0sbin/pfctl/tests/files/pf1054.in
+1-1sbin/pfctl/tests/files/pf1027.ok
+473-34277 files not shown
+550-34483 files

FreeBSD/src 16665c7tests/sys/netpfil/pf return.py Makefile

pf tests: verify that 'block return' generates the expected packets

Sponsored by:   Rubicon Communications, LLC ("Netgate")
DeltaFile
+153-0tests/sys/netpfil/pf/return.py
+1-0tests/sys/netpfil/pf/Makefile
+154-02 files

FreeBSD/src 93c4f31sys/vm vm_fault.c

vm_fault: correct mpred update after alloc fail

Find the predecessor in dst_object, not src_object.

Fixes: 6d6c97fb72a7 <https://reviews.freebsd.org/rG6d6c97fb72a7dce85008cef891d093b24dcbb380> ("vm_fault: update pred lock acq in copy_entry")

Reported by:    markj
Reviewed by:    markj
Differential Revision:  https://reviews.freebsd.org/D49547
DeltaFile
+1-1sys/vm/vm_fault.c
+1-11 files

FreeBSD/src 1b37af0lib/libsys aio_read.2 aio_waitcomplete.2

Bump .Dd for recently changed aio_*(2) manpages

The ones that were effectively unchanged from
d97e44784bb5a^..e24279e0f9e did not have `.Dd` bumped. Only
the ones that had a net content change between those
revisions.

MFC after:      2 weeks
MFC with:       d97e44784bb5a e24279e0f9e
DeltaFile
+1-1lib/libsys/aio_read.2
+1-1lib/libsys/aio_waitcomplete.2
+1-1lib/libsys/aio_write.2
+3-33 files

FreeBSD/src e24279elib/libsys aio_cancel.2 aio_error.2

Remove mentions of ENOSYS added in d97e44784bb5

aio(4) is a hard requirement in the kernel as of f3215338ef82. The
scenario that the patch was submitted for is no longer possible.

This isn't a straight up revert since the previous change also addressed
some minor issues.

PR:             190942
Reported by:    asomers
MFC after:      2 weeks
MFC with:       d97e44784bb5
Fixes:          d97e44784bb5 ("aio_*(2): mention ENOSYS under ERRORS")
Differential Revision: https://reviews.freebsd.org/D49541
DeltaFile
+0-7lib/libsys/aio_cancel.2
+0-7lib/libsys/aio_error.2
+0-7lib/libsys/aio_fsync.2
+0-7lib/libsys/aio_mlock.2
+0-7lib/libsys/aio_read.2
+0-7lib/libsys/aio_return.2
+0-423 files not shown
+0-639 files

FreeBSD/src ff9c290sys/powerpc/include spr.h, sys/powerpc/powernv platform_powernv.c

powernv: Explicitly enable the facilities we support

Thus far we've relied on the firmware setting HFSCR correctly, enabling
all facilities.  However, it appears some recent firmwares do not.
Linux explicitly enables all facilities it supports (including
transactional memory, which new firmwares apparently do not enable), so
do the same here, explicitly enable all the facilities FreeBSD supports.

MFC after:      1 week

(cherry picked from commit fe73eb441f1c98fe350f4822c7d2abfeef046bf8)
DeltaFile
+6-0sys/powerpc/powernv/platform_powernv.c
+5-0sys/powerpc/include/spr.h
+11-02 files

FreeBSD/src 16caf6asys/powerpc/aim aim_machdep.c, sys/powerpc/powerpc trap.c

powerpc: Add Hypervisor Facility Unavailable handling

Treat Hypervisor Facility Unavailable as an illegal instruction in user
space.  This way programs that use facilities like transactional memory,
which will never be supported as it has been removed from the ISA, will
not crash the kernel.

Tested by:      pkubaj
MFC after:      1 week

(cherry picked from commit 0b663e0cee89dedf5b070ff4e839d5ad95061535)
DeltaFile
+3-0sys/powerpc/powerpc/trap.c
+1-0sys/powerpc/aim/aim_machdep.c
+4-02 files

FreeBSD/src 4b3d44fsys/kern kern_descrip.c

kern/kern_descrip.c:  remove unneeded headers

(cherry picked from commit 6eb7cba469d7cf1beccfb18679d1e0bd4a468341)
DeltaFile
+0-3sys/kern/kern_descrip.c
+0-31 files

FreeBSD/src 4e923edsys/ufs/ufs ufs_acl.c

ufs_aclcheck(): accurately dereference vp->v_mount

(cherry picked from commit 5648c1d6f3b0d8f4d67d2e6ec56dd2abcbd8fff5)
DeltaFile
+11-8sys/ufs/ufs/ufs_acl.c
+11-81 files

FreeBSD/src 09b8745sys/kern vfs_acl.c

kern___acl_aclcheck_path: vrele the vnode after namei()

(cherry picked from commit 7fad17a3e63481ef71b731b0059cb918aec14f17)
DeltaFile
+1-0sys/kern/vfs_acl.c
+1-01 files

FreeBSD/src 658a439sys/ufs/ufs ufs_acl.c

ufs_acl.c: style

(cherry picked from commit d7352b2d57e9fe4b9cfb6ae61fd7cdd18851cdd3)
DeltaFile
+1-1sys/ufs/ufs/ufs_acl.c
+1-11 files

FreeBSD/src e6e5cd2release Makefile.vm

release/vm: fix setting NO_ROOT and WITHOUT_QEMU

To support common shell patterns (test -n and -z) we want NO_ROOT and
WITHOUT_QEMU to be set and not empty in mk-vmimage.sh if they are set at
all in the Makefile.

Actually do this rather than making them always set (which propogates to
submakes run by mk-vmimage.sh and unconditionally enables NO_ROOT with
undesirable side effects such as installing a /METALOG in vm images).

Reported by:    cperciva
Sponsored by:   DARPA, AFRL
Differential Revision:  https://reviews.freebsd.org/D49544
DeltaFile
+2-2release/Makefile.vm
+2-21 files

FreeBSD/src 86dd379sys/dev/pci pci.c pcivar.h

pci: Use a single variable for the offset of the power management registers

This is the more typical pattern for other capability register sets,
and two of these variables weren't used.

Differential Revision:  https://reviews.freebsd.org/D49267
DeltaFile
+24-22sys/dev/pci/pci.c
+1-3sys/dev/pci/pcivar.h
+25-252 files

FreeBSD/src 931baebsys/dev/acpica acpi_pci.c

acpi_pci: Use pci_has_pm and pci_clear_pme

Differential Revision:  https://reviews.freebsd.org/D49266
DeltaFile
+2-8sys/dev/acpica/acpi_pci.c
+2-81 files