FreeBSD/src c16da33 — contrib/kyua/utils datetime.cpp auto_array.hpp, contrib/kyua/utils/signals timer_test.cpp

contrib/kyua: update to 0.15.2

This change contains a few bugfixes to the test executor.

MFC after:      1 week
Merge commit 'dab80d5deaf7d998d587b99f7941890237960638'
DeltaFile
+0-312contrib/kyua/utils/auto_array_test.cpp
+0-227contrib/kyua/utils/auto_array.ipp
+117-0contrib/kyua/utils/datetime_test.cpp
+92-19contrib/kyua/utils/signals/timer_test.cpp
+0-102contrib/kyua/utils/auto_array.hpp
+88-0contrib/kyua/utils/datetime.cpp
+297-66014 files not shown
+442-77020 files

FreeBSD/src dab80d5 — utils datetime.cpp auto_array.hpp, utils/signals timer_test.cpp

kyua: import kyua-0.15.2

This change adds kyua kyua-0.15.2 from [upstream][1].

The kyua-0.15.2 artifact was been verified by [SHA256 checksum][3].

This version update contains a few bugfixes and some developer workflow changes.

More information about the release (from a high level) can be found in
the [release notes][4].

Updated via [`update_kyua.sh`][4] `update_kyua.sh 0.15.2 kyua-0.15.2`.

1: https://github.com/freebsd/kyua/releases/download/kyua-0.15.2/kyua-0.15.2.tar.gz
2: https://github.com/freebsd/kyua/releases/download/kyua-0.15.2/kyua-0.15.2.tar.gz.sha256
3: https://github.com/freebsd/kyua/blob/kyua-0.15.2/NEWS.md
4: https://codeberg.org/ngie/freebsd-powertools:shell/update_kyua.sh@10a04edb
DeltaFile
+0-312utils/auto_array_test.cpp
+0-227utils/auto_array.ipp
+117-0utils/datetime_test.cpp
+92-19utils/signals/timer_test.cpp
+0-102utils/auto_array.hpp
+88-0utils/datetime.cpp
+297-66020 files not shown
+480-84026 files

FreeBSD/src ad0cd01 — sys/arm64/arm64 pmap.c

arm64 pmap: Eliminate page table rewalks after demotions

pmap_demote_l1() and pmap_demote_l2_locked() return the virtual address
of the page table page that replaces the demoted superpage mapping.  In
pmap_advise(), pmap_change_props_locked(), and pmap_clear_modify() use
that address instead of rewalking the page table from the L1 or L2
entry.  Similarly, after pmap_advise() demotes an L3C superpage, compute
the virtual address of the L3 entry that it removes from the virtual
address of the current L3 entry.

Reviewed by:    kib
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D61599
DeltaFile
+17-13sys/arm64/arm64/pmap.c
+17-131 files

FreeBSD/src 36d9f18 — usr.bin/man man.conf.5 man.sh

man: Convert licenses to SPDX only

Reported by:    ziaee
MFC after:      3 days
Differential Revision:  https://reviews.freebsd.org/D61729
DeltaFile
+3-25usr.bin/man/manpath.1
+3-25usr.bin/man/man.1
+2-24usr.bin/man/man.sh
+2-22usr.bin/man/man.conf.5
+10-964 files

FreeBSD/src d1e14cb — share/man/man4 ipsec.4, sys/netipsec ipsec_output.c

netipsec: Set the outer IPv6 flow label from the SA

Tunnel mode encapsulation leaves the flow label of the outer IPv6 header
zero. ESP and AH have no transport ports (UDP-encapsulated ESP has them, but
the same pair for every SA), so devices that hash IPv6 headers to spread
traffic, link aggregates and ECMP routers alike, see no difference between
the security associations of two gateways and put all of their tunnels on
one path. lagg(4)'s own header hash does the same: for IPv6 its layer 4
input is the flow label.

Set the label to the low 20 bits of the SA's flow ID, the hash of its SPI
that the previous change introduced. Each SA then carries one label for its
lifetime; SPIs are unique within the SADB, so distinct SAs carry distinct
labels unless the 20-bit hashes collide. A hasher that includes the flow
label then spreads SAs over its paths while keeping the packets of each SA
on one, which avoids reordering their sequence numbers across paths. A rekey
starts a new SA and a new label. The label is set whether or not
net.inet.ipsec.sa_flowid is enabled: that sysctl governs the local transmit
queue selection, this label what the network sees. In a bundle whose tunnel

    [29 lines not shown]
DeltaFile
+281-0tests/sys/netipsec/tunnel/flowlabel.sh
+38-5sys/netipsec/ipsec_output.c
+10-1share/man/man4/ipsec.4
+1-0tests/sys/netipsec/tunnel/Makefile
+330-64 files

FreeBSD/src 3ccfcda — sys/netpfil/pf pf.c, tests/sys/netpfil/pf forward.sh

pf: Do not report a packet the outbound pass sent as dropped

For route-to on the inbound pass, pf_route() and pf_route6() run the
outbound pass on the new interface themselves and hand it the actions
of the rule.  When that pass creates a state, the state has the route-to
as well, so the outbound pass sends the packet and returns PF_PASS
without an mbuf.  Since 349360b17eab the caller turns this into PF_DROP,
and the pfil hook returns PFIL_DROPPED for a packet that was forwarded.
ip6_tryforward() then counts an input discard on the receiving
interface for every such packet.

Leave the action at PF_PASS, so that the hook returns PFIL_CONSUMED, as
it does when pf_route() or pf_route6() send the packet themselves.
Extend forward:v6_route_to_discards to rules that keep state.

Reviewed by:            kp
Fixes:                  349360b17eab ("pf: return errors from pf_route() and ...")
MFC after:              1 week
Sponsored by:           Rubicon Communications, LLC ("Netgate")
Differential Revision:  https://reviews.freebsd.org/D61674
DeltaFile
+16-14tests/sys/netpfil/pf/forward.sh
+8-4sys/netpfil/pf/pf.c
+24-182 files

FreeBSD/src 20e652b — sys/netinet6 ip6_fastfwd.c, tests/sys/netpfil/pf forward.sh

netinet6: Do not count a packet a hook consumed as discarded in ip6_tryforward()

ip6_tryforward() treats every pfil result but PFIL_PASS as a drop: it
counts a discard on the receiving interface after the inbound hooks and
on the outgoing interface after the outbound hooks.  A hook that
consumes the packet returns PFIL_CONSUMED instead: pf sends a packet a
route-to rule matches out itself, and sends a packet it reassembled on
in fragments.  Those packets were forwarded, yet netstat -s -I shows
them as discarded, in the outbound case on the interface the route
lookup chose, which route-to did not even use.  ip6_forward() and
ip_tryforward() count nothing for a consumed packet.

Return without counting when a hook consumed the packet.  The new
forward:v6_route_to_discards test checks both passes.  Its rules keep
no state: pf reports a packet it sent from the inbound hook as dropped
when its own outbound pass created a state, and that packet is still
counted.

Reviewed by:            kp, glebius, pouria

    [4 lines not shown]
DeltaFile
+66-0tests/sys/netpfil/pf/forward.sh
+19-4sys/netinet6/ip6_fastfwd.c
+85-42 files

FreeBSD/src bf8783a — sys/modules/pf Makefile, sys/netinet6 ip6_fastfwd.c

netinet6: Decrement the hop limit before the outbound hooks in ip6_tryforward()

ip6_tryforward() decrements the hop limit after the outbound pfil hooks,
whereas ip_tryforward() and ip6_forward() do it before them.  The hooks
therefore see a packet one hop older than the one that leaves, and a hook
that transmits the packet itself does not decrement it at all: pf's
route-to and reply-to on an outbound state send it on with the hop limit
it arrived with.

Decrement it right after the check, before the route lookup, as the other
two paths do.  Errors sent after that point quote the decremented value,
as they do on those paths.

pf_refragment6() hands the fragments of a forwarded packet it
reassembled to ip6_forward(), which decrements the hop limit again, so
on the slow path such a packet has always lost two hops at this router,
and with this change it would on the fast path as well.  Give the hop
back before ip6_forward(), unless ip6stealth is on, in which case
neither path decrements, or the hop limit is 255, which a scrub

    [9 lines not shown]
DeltaFile
+67-0tests/sys/netpfil/pf/forward.sh
+12-8sys/netinet6/ip6_fastfwd.c
+16-0sys/netpfil/pf/pf_norm.c
+14-0tests/sys/netpfil/pf/fragmentation_pass.sh
+1-1sys/modules/pf/Makefile
+110-95 files

FreeBSD/src fb9969c — sys/netinet6 ip6_fastfwd.c, tests/sys/netpfil/ipfw fwd.sh

netinet6: Keep a pfil-chosen next hop in ip6_tryforward()

When an inbound pfil hook chooses the next hop (ipfw fwd),
ip6_tryforward() looks up the route to it.  After the outbound hooks it
decides whether they changed the destination by comparing the packet's
destination with the address it looked up, which is that next hop.  The
two differ, so it looks up the route to the packet's destination again
and the fwd rule is lost.  ipfw always installs an outbound hook, so
every packet such a rule matches goes the wrong way while
net.inet6.ip6.redirect is 0.

Compare with the destination as it was before the outbound hooks, as
ip6_forward() does.

Reviewed by:            pouria
Fixes:                  5a1842a2 ("Add ip6_tryforward() - a run to completion ...")
MFC after:              1 week
Sponsored by:           Rubicon Communications, LLC ("Netgate")
Differential Revision:  https://reviews.freebsd.org/D61038
DeltaFile
+56-0tests/sys/netpfil/ipfw/fwd.sh
+3-1sys/netinet6/ip6_fastfwd.c
+59-12 files

FreeBSD/src b74577a — sys/net if_epair.c

if_epair: Hash the IP header, not the Ethernet header, for fanout

With RSS, epair_select_queue() hashes a packet that carries no RSS hash
with rss_soft_m2cpuid_v4() or rss_soft_m2cpuid_v6(), which read the IP
header at the start of the mbuf.  On transmit the mbuf starts with the
Ethernet header, so the hash covered the MAC addresses, the EtherType
and the first bytes of the IP header, the IPv4 total length and
identification among them.  The packets of one flow were spread over the
queues by their IP ID and delivered out of order, and the value was
stored in the mbuf as an RSS hash for the receiving side to use.

Step over the Ethernet header, and over inline 802.1Q or 802.1ad tags,
while the software hash runs.  A tag is inline when vlan(4) or a bridge
member runs without VLAN_HWTAGGING, always for 802.1ad, and for the
inner tag of stacked vlans; those frames previously went to the first
queue unhashed.  Frames with more than two tags still do.

Hash with rss_mbuf_software_hash_v4() and rss_mbuf_software_hash_v6()
and map the hash with rss_getbucket(), as the hardware hash path does,

    [10 lines not shown]
DeltaFile
+41-9sys/net/if_epair.c
+41-91 files

FreeBSD/src 09fa4e2 — sys/vm vm_object.c

Revert "vm_object: Fix synchronization with teardown in the object list loop"

This was pushed by accident.

This reverts commit 4e6e4fa8be9940e711b791073eee5bcfa77ec5d4.
DeltaFile
+7-13sys/vm/vm_object.c
+7-131 files

FreeBSD/src 4e6e4fa — sys/vm vm_object.c

vm_object: Fix synchronization with teardown in the object list loop

Checking for OBJT_DEAD is racy since pagers update the object type
without the object lock held.  Check for the flag as well, as that is
set beforehand.  Otherwise pager dealloc can race with, e.g.,
cdev_pager_get_path().

Try to minimize accesses of the object after dropping the object lock in
vm_object_list_handler().
DeltaFile
+13-7sys/vm/vm_object.c
+13-71 files

FreeBSD/src b9dca39 — sys/dev/gve gve_tx_dqo.c

gve: Fix return value in gve_tx_has_desc_room_dqo()

When the cached tx->dqo.desc_head does not show enough available
descriptor ring slots, gve_tx_has_desc_room_dqo() reloads desc_head from
tx->dqo.hw_tx_head and re-checks availability. If the refreshed
desc_head provides sufficient space, the function mistakenly returns 0
(false) instead of true, causing callers to treat a successful
descriptor head refresh as ENOBUFS, stop the TX queue, and retry or
abort packet transmission (including unloading already-mapped DMA
segments) unnecessarily.

Return true when sufficient descriptor space is available after
refreshing desc_head.

In 60s iperf benchmarks between two FreeBSD 14.4 c4-standard-192
instances, this eliminates spurious tx->stopped transitions across all
workloads:
- TCP 1-stream:  54,859 -> 13 (-99.98%)
- TCP 16-stream: 9,623,851 -> 6,324,299 (-34.3%, -3.30M spurious stops)

    [9 lines not shown]
DeltaFile
+1-1sys/dev/gve/gve_tx_dqo.c
+1-11 files

FreeBSD/src 62866fc — sys/dev/gve gve_tx_dqo.c

gve: Fix DQO TX free-list memory ordering and pending_pkt state

The DQO TX path uses lockless producer/consumer free lists
(free_pending_pkts_prd/csm and free_qpl_bufs_prd/csm) shared between
the completion and transmit taskqueues. On weakly ordered architectures
such as arm64, the current synchronization has three issues:

1. gve_free_pending_packet() updates pending_pkt state and links
   pending_pkt->next before pushing the entry onto
   free_pending_pkts_prd using a relaxed atomic_cmpset_32(), while
   gve_alloc_pending_packet() steals free_pending_pkts_prd using a
   relaxed atomic_swap_32(). Without release/acquire ordering, the
   transmit thread can observe a stale pending_pkt->next pointer after
   stealing the producer list (either orphaning freed entries or
   re-allocating entries whose completion tags are still in flight), or
   prior completion stores (such as setting state to FREE or clearing
   mbuf) can become visible after the slot is re-allocated.
2. Similarly, in QPL mode, gve_tx_alloc_qpl_buf() steals
   free_qpl_bufs_prd with a relaxed atomic_swap_32() without an acquire

    [53 lines not shown]
DeltaFile
+32-9sys/dev/gve/gve_tx_dqo.c
+32-91 files

FreeBSD/src c15a606 — sys/net/route fib_algo.c

route/fib_algo: Fix nexthop reference leak on FLM_BATCH

handle_rtable_change_cb() references the new nexthop before calling
the algorithm.  If the algorithm asks to batch the change by
returning FLM_BATCH, queue_rtable_change() references the same
nexthop again for the queued entry, while apply_rtable_changes()
only unreferences the old nexthop of each entry.

Reference new nhop once in handle_rtable_change_cb(), before
deciding whether the change is queued or passed to the algorithm,
and do not reference it again in fill_change_entry().  This also
leaves the queue reallocation as the only way for
queue_rtable_change() to fail.

Currently, dxr is the only algorithm returning FLM_BATCH.

Fixes:          6b8ef0d428c9 ("Add batched update support for the fib algo.")
MFC after:      3 days
Differential Revision:  https://reviews.freebsd.org/D61577
DeltaFile
+23-23sys/net/route/fib_algo.c
+23-231 files

FreeBSD/src 5d18a80 — sys/cam/scsi scsi_pass.c

pass(4): Don't drop the periph lock before selrecord() in passpoll()

passpoll() checked the done queue while holding the peripheral lock,
dropped the lock, and only then called selrecord().  A CCB completing
in the window between the unlock and the selrecord() call sent its
selwakeuppri() before the polling thread was on the selinfo list, so
the wakeup was lost and select(2) or poll(2) slept until another
completion arrived or the timeout expired.

Call selrecord() before dropping the lock.  This lock order is
already established: passdone() calls selwakeuppri(), which takes
the selinfo lock, while holding the peripheral lock.

kqueue is not affected, since the knlist is backed by the peripheral
mutex.

Reported by:    llm-postcr
Fixes:          a9934668aa13
MFC after:      1 week

    [4 lines not shown]
DeltaFile
+1-1sys/cam/scsi/scsi_pass.c
+1-11 files

FreeBSD/src 21b7a2f — sys/cam/scsi scsi_pass.c

pass(4): Wake select/kqueue waiters when an immediate CCB completes

In the CAMIOQUEUE ioctl, a queued CCB completes through passdone(),
which moves it to the done queue and calls selwakeuppri() and
KNOTE_LOCKED() so that a consumer blocked in select(2), poll(2) or
kevent(2) wakes up and collects the CCB with CAMIOGET.  An immediate
CCB (e.g. XPT_DEV_ADVINFO or XPT_DEV_MATCH) is instead executed
synchronously in the ioctl and moved to the done queue directly,
with no notification, so a consumer sleeping while waiting for its
completion never wakes up until some other queued I/O completes.

Send the same notification that passdone() sends.  The peripheral
lock is held at this point and backs the knlist, so KNOTE_LOCKED()
is the correct variant.

A version of this fix has been in production use at Spectra Logic
since 2024.

Co-authored-by: Dave Baukus <daveb at spectralogic.com>

    [7 lines not shown]
DeltaFile
+4-1sys/cam/scsi/scsi_pass.c
+4-11 files

FreeBSD/src 89e585b — sys/cam/scsi scsi_pass.c

pass(4): Don't drop the periph lock before selrecord() in passpoll()

passpoll() checked the done queue while holding the peripheral lock,
dropped the lock, and only then called selrecord().  A CCB completing
in the window between the unlock and the selrecord() call sent its
selwakeuppri() before the polling thread was on the selinfo list, so
the wakeup was lost and select(2) or poll(2) slept until another
completion arrived or the timeout expired.

Call selrecord() before dropping the lock.  This lock order is
already established: passdone() calls selwakeuppri(), which takes
the selinfo lock, while holding the peripheral lock.

kqueue is not affected, since the knlist is backed by the peripheral
mutex.

Reported by:    llm-postcr
Fixes:          a9934668aa13
MFC after:      1 week

    [4 lines not shown]
DeltaFile
+1-1sys/cam/scsi/scsi_pass.c
+1-11 files

FreeBSD/src a4abe5f — sys/cam/scsi scsi_pass.c

pass(4): Wake select/kqueue waiters when an immediate CCB completes

In the CAMIOQUEUE ioctl, a queued CCB completes through passdone(),
which moves it to the done queue and calls selwakeuppri() and
KNOTE_LOCKED() so that a consumer blocked in select(2), poll(2) or
kevent(2) wakes up and collects the CCB with CAMIOGET.  An immediate
CCB (e.g. XPT_DEV_ADVINFO or XPT_DEV_MATCH) is instead executed
synchronously in the ioctl and moved to the done queue directly,
with no notification, so a consumer sleeping while waiting for its
completion never wakes up until some other queued I/O completes.

Send the same notification that passdone() sends.  The peripheral
lock is held at this point and backs the knlist, so KNOTE_LOCKED()
is the correct variant.

A version of this fix has been in production use at Spectra Logic
since 2024.

Co-authored-by: Dave Baukus <daveb at spectralogic.com>

    [7 lines not shown]
DeltaFile
+4-1sys/cam/scsi/scsi_pass.c
+4-11 files

FreeBSD/src b5e5c85 — usr.sbin/sysrc sysrc sysrc.8, usr.sbin/sysrc/tests sysrc_test.sh

sysrc: Add .= operator for STRAPPEND

There are almost 100 *_flags variables in /etc/defaults/rc.conf and
each holds a set of options processed by getopts in one way or
another. The temptation to manage these `*_flags` variables with the
list operator += leads to potentially unexpected behavior.

For example, let's say you have in rc.conf:

cron_flags="$cron_flags -j 15"

Executing `sysrc cron_flags+="-J 15"` to set rootjitter to 15 will
instead result in:

cron_flags="$cron_flags -j 15 -J"

That's because += is not a string append operation but a list add
operation that adds -J but, seeing that 15 is already in the space-
delimited "list," does not add "15".

    [30 lines not shown]
DeltaFile
+77-5usr.sbin/sysrc/sysrc.8
+51-0usr.sbin/sysrc/tests/sysrc_test.sh
+17-7usr.sbin/sysrc/sysrc
+145-123 files

FreeBSD/src 929b256 — usr.sbin/sysrc sysrc sysrc.8

sysrc: Add -_*~$ as non-delimiter list operation chars

This is potentially a breaking change (MFC not recommended).

List operators += and -= should not consider some characters as
delimiters when they appear as the first character.

The += and -= operators allow specifying the list delimter as the
first character. For example, `sysrc foo+=,123` will iterate over the
value of foo delimited by commas, and if 123 is not found will append
`,123` to the value of foo.

However, for the sake of convenience, sysrc has always supported
defaulting to using $IFS as delimiter when the first character of the
+= or -= list operator is [a-zA-Z0-9./]. For example, if you execute
`sysrc foo+=abc` or `sysrc bar+=/tmp` or `sysrc baz-=.text` then the
lists foo, bar, and baz are all presumed to be delimited by $IFS.

By adding [-_*~$] we potentially break lists delimited by any of

    [14 lines not shown]
DeltaFile
+11-1usr.sbin/sysrc/sysrc.8
+3-3usr.sbin/sysrc/sysrc
+14-42 files

FreeBSD/src 26ac2c3 — usr.sbin/sysrc sysrc

sysrc: Disable filename globbing on list assignment

This is potentially a breaking change (MFC not recommended).

Assignments with += or -= should not expand filename globs.

For example, executing `sysrc foo+=' *'` would result in adding to
foo the glob expansion of `*` instead of a literal `*`.

This was unexpected and inconsistent because `sysrc foo='*' would set
foo to literal `*`.

If you need the old behavior, you can do `sysrc foo+="$( echo * )"`.

Reviewed by:    kfv
Differential Revision:  https://reviews.freebsd.org/D61657
DeltaFile
+5-1usr.sbin/sysrc/sysrc
+5-11 files

FreeBSD/src 51435c6 — usr.sbin/sysrc sysrc

sysrc: Enforce raw (-r) mode for all assignments

This is potentially a breaking change, warranting major version bump
(7.x -> 8.0).

Assignments with =, +=, or -= should not cause expansion of variables.
For example, if rc.conf(5) has one="$1", two="$2", and foo="$one", and
you execute `sysrc foo+=' $two'` you should get foo="$one $two" but
at-present (version 7.x) sysrc stores foo="1 $two". This is because
when querying current value, we read the expanded (read: not raw)
value.

Similary, if rc.conf has foo="$one $two" and you execute the command
`sysrc foo-=' $two'` you should get foo="$one" but at-present sysrc
erroneously stores foo="1 2". Since sysrc was reading the expanded
value prior to modifying, it would read "1 2" prior to attempting to
elide '$two' from the [space-separated] list (and since '$two' does
not appear in the expanded value, no removal is performed and it
subsequently wrote back the expanded value).

    [29 lines not shown]
DeltaFile
+5-17usr.sbin/sysrc/sysrc
+5-171 files

FreeBSD/src 09768aa — usr.sbin/sysrc sysrc.8 sysrc, usr.sbin/sysrc/tests sysrc_test.sh

sysrc: Add -r raw and fixup -c assignment check

Add new -r flag to query raw, unexpanded values and display/use raw
values during assignments (including +=/-= assignments).

Constraint -c assignment checks to always use raw values when testing
if an assignment would induce a change or if the existing value is
already set as desired.

PR:             299413
MFC after:      2 weeks
Reviewed by:    kfv
Differential Revision:  https://reviews.freebsd.org/D61584
DeltaFile
+482-0usr.sbin/sysrc/sysrc.subr
+102-0usr.sbin/sysrc/tests/sysrc_test.sh
+31-9usr.sbin/sysrc/sysrc
+6-4usr.sbin/sysrc/sysrc.8
+621-134 files

FreeBSD/src 42d3584 — sys/netpfil/ipfw ip_dummynet.c, tests/sys/netpfil/common Makefile dummynet_config_test.c

dummynet: validate object length before fixed-size copies in do_config()

do_config() checks that each command's o.len fits in the remaining
buffer, but the DN_LINK, DN_PROFILE, DN_SCH and DN_FS cases then copy a
fixed sizeof(struct) out of the command, which can be larger than o.len.
A command with o.len == sizeof(struct dn_id) reads past the end of the
sockopt buffer (DN_PROFILE copies about 4 KB).

Reject a command whose o.len is shorter than the structure it carries.
Add a test.

Reviewed by:    kp
MFC after:      1 week
Sponsored by:   Advanced Micro Devices, Inc.
Signed-off-by:  Osvaldo Janeri Filho <ojanerif at amd.com>
Differential Revision:  https://reviews.freebsd.org/D61440
DeltaFile
+119-0tests/sys/netpfil/common/dummynet_config_test.c
+16-0sys/netpfil/ipfw/ip_dummynet.c
+2-0tests/sys/netpfil/common/Makefile
+137-03 files

FreeBSD/src a139b43 — tests/sys/netpfil/pf unmapped_mbuf.sh

pf tests: Skip unmapped_mbuf:dummynet without dummynet

The dummynet test case in unmapped_mbuf.sh calls pft_init but never
checks whether dummynet(4) is loaded.  When it is not, dnctl fails with
"setsockopt(IP_DUMMYNET3): Protocol not available" and the test is
reported as failed instead of skipped.

Call dummynet_init instead.  It runs pft_init and skips the test when
dummynet(4) is not loaded, as the other dummynet test cases in
tests/sys/netpfil/pf already do.

Fixes:  8a14fcd23a20 ("pf: fix a crash on sendfile()")
Signed-off-by:  Jaswanth Saravanan <jaswanth.s006 at gmail.com>
Reviewed-by:    kp
Pull-Request:   https://github.com/freebsd/freebsd-src/pull/2556
DeltaFile
+1-1tests/sys/netpfil/pf/unmapped_mbuf.sh
+1-11 files

FreeBSD/src 53e0d3f — sys/netpfil/pf pf_table.c, tests/sys/netpfil/pf table.sh

pf: reject table anchors with empty path components

pfr_fix_anchor() strips leading slashes from table anchors but not
trailing or repeated ones.  pf_find_or_create_kruleset() ignores those,
so a table added as "foo/bar/" lands in ruleset "foo/bar" but keeps
"foo/bar/" as its anchor.  pfr_table_count() and pfr_skip_table() then
disagree, and with INVARIANTS:

```
panic: pfr_get_tables: corruption detected (1)
```

"foo//bar" does the same once "foo" exists, and pfctl -vsT hits the
same check in pfr_get_tstats().

Loading rules into such an anchor already fails with EINVAL, since
pf_find_kruleset() doesn't find it.  Reject it for tables as well.

Reviewed by:    kp

    [4 lines not shown]
DeltaFile
+32-0tests/sys/netpfil/pf/table.sh
+7-0sys/netpfil/pf/pf_table.c
+39-02 files

FreeBSD/src 42bf1d9 — sys/netpfil/pf pf.c, tests/sys/netpfil/pf frag6.py

pf: implement RFC 7112 Section 5

RFC 7112 Section 5 and RFC 8200 Section 4.5 require IPv6 fragmented
packets to contain all headers in the first fragment. If this is not the
case we now discard the packet.

We do not send the ICMPv6 Parameter Problem error RFC 8200 requires (but
7112 lists this as "MAY").

This makes bypassing the firewall, in cases where fragment reassembly is
disabled, harder.

RelNotes:       yes
Sponsored by:   Rubicon Communications, LLC ("Netgate")
DeltaFile
+50-0tests/sys/netpfil/pf/frag6.py
+9-27sys/netpfil/pf/pf.c
+59-272 files

FreeBSD/src a396a02 — sys/netpfil/pf pf_table.c, tests/sys/netpfil/pf/ioctl validation.c

pf: improve anchor string validation

Ensure that these are not overly long.
Add a test case.

Reported by:    Kevin Day <kevin at your.org>
MFC after:      1 week
Sponsored by:   Rubicon Communications, LLC ("Netgate")
DeltaFile
+33-0tests/sys/netpfil/pf/ioctl/validation.c
+3-2sys/netpfil/pf/pf_table.c
+36-22 files

FreeBSD/src cb9e8cc — sys/opencrypto crypto.c

opencrypto: Do not requeue a re-dispatched request as ordered

crypto_dispatch_async() marks an ordered request with
CRYPTO_F_ASYNC_ORDERED and gives it a sequence number.  The return
thread runs the callbacks in sequence and only takes the head of its
ordered queue when the head carries the next number.

When a driver unregisters, the request completes with EAGAIN and the
ESP and AH callbacks dispatch it again with crypto_dispatch().  The
flag is still set, so crypto_done() puts the request back on the
ordered queue under the number the return thread has already passed.
The head of the queue never matches again, and no ordered request of
any session on that return worker completes after that.

Before crypto_dispatch_async() existed, crypto_dispatch() gave such a
request a new sequence number.  Clear the flag when the return thread
takes a request off the ordered queue, so a request that is dispatched
again completes like any other.


    [5 lines not shown]
DeltaFile
+9-0sys/opencrypto/crypto.c
+9-01 files