pkg: Add -j and -r options
This allows pkg(7) to be used to bootstrap a jail or chroot, and to
recognize the -j and -r options and pass them through to pkg(8) if
already bootstrapped.
The -j option greatly complicates the option-parsing loop because we
can no longer pass our original argv unmodified to pkg(8); specifcially,
we must strip -j and its argument, which in practice means constructing
a whole new argv with the options we wish to pass on.
MFC after: 1 week
Reviewed by: imp, bapt, markj
Differential Revision: https://reviews.freebsd.org/D58165
ffs_bdflush(): do not call VOP_FSYNC(devvp) for unlocked devvp
Instead, delegate the fsync to taskqueue, which can lock mntfs devvp.
The asynchronous fsync there is fine because bdflush() is not guaranteed
to write anything at all.
Reported and tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
snd_hda: wake display audio and restore amplifier settings
An Intel display-audio codec was observed to remain in D3 after monitor
sleep on DragonFly BSD. Starting a new stream then produced no sound,
and waking the codec alone left the output pin amplifier muted and other
function configuration unrestored.
Read the audio function power state at stream start. If its requested or
actual state is not D0, use the existing power-up routine before
configuring and starting the stream, then restore the function to a
known state:
Restore selectors, pins, EAPD, GPIO/GPO and direct codec patches, then
replay the cached gain and mute values once the pins are configured.
Split widget configuration out of hdaa_audio_commit() into
hdaa_audio_widget_commit() so the wake path can reuse it without
reinitializing the cached amplifier values. Preserve the existing
volume, mute and forced-mute values.
[37 lines not shown]
pfsync: don't apply a stale dst peer from a state update
pfsync_upd_tcp() checks each peer of an incoming update separately. A
peer whose window is behind the local copy is skipped and counted as
stale, otherwise it is copied into the state. pfsync_in_upd() and
pfsync_in_upd_c() then copied the dst peer again whenever fewer than two
peers were stale. When only the dst peer was stale, that second copy
moved the local dst window backwards.
This is the common case for a bulk transfer, where the receiver's
window barely moves and the sender's advances quickly. Once dst.seqlo
regresses by more than MAXACKWINDOW, pf_tcp_track_full() drops every
packet of the connection as PFRES_BADSTATE. Dropped packets never
update the state, so the connection stays wedged until the application
times out. The only trace is the state-mismatch counter.
Remove the extra copy. Both branches that compute sync already copy dst
when it is acceptable. Allocate dst scrub memory before the peers are
compared, so an accepted update still finds it.
[9 lines not shown]
md: Read the preloaded image length as size_t
hint.md.N.len was read as an int, so on 64-bit platforms ram disks of
4 GiB or more were truncated, or skipped at exact multiples of 4 GiB.
Reported by: llm-postcr
Reviewed by: imp
Approved by: imp
Fixes: 15925062e1ba ("biosboot: Detect memory disks from PXE")
Sponsored by: Netflix
Differential Revision: https://ron-dev.freebsd.org/FreeBSD/src/pulls/104
mbuf: unshare headers again where m_pullup() did it implicitly
Since the inline m_pullup() returns a contiguous mbuf untouched, callers using
"!M_WRITABLE(m) || m_len < len" kept writing into a shared cluster.
Forwarded multicast fragments left with a corrupted IP header.
Use m_copyup(), which always allocates a new header mbuf, at those sites.
Reviewed by: glebius, pouria
Approved by: pouria
Fixes: 671babc79497 ("mbuf: make m_pullup() an inline over most expected case")
Sponsored by: Netflix
Differential Revision: https://ron-dev.freebsd.org/FreeBSD/src/pulls/109
Merge commit 5472aa0c1321 from llvm git (by Piotr Kubaj):
[PowerPC] Use the 16-byte stack and vector alignment on FreeBSD (#232336)
FreeBSD uses the ELFv2 ABI on both byte orders, so it has the same
16-byte stack alignment as Linux. The explicit vector alignment is a
backend workaround that does not depend on the OS. There is no
reason for the layouts to differ.
llvm 21 still keeps the data layout in two places, so the check is
changed in both the PowerPC backend and clang. They have to match, or
clang errors out with a data layout mismatch.
Reviewed by: dim
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D61678
freebsd.update.conf.5: No crossreferences in title
Crossreferences in titles are strongly discouraged and incompatible
with our own tooling. This is a wontfix by most of manpages ecosystem
because it is bad editorial style in the first place.
MFC after: 3 days
bspatch.1: No crossreferences in titles
Crossreferences in titles are strongly discouraged and incompatible
with our own tooling. This is a wontfix by most of manpages ecosystem
because it is bad editorial style in the first place.
MFC after: 3 days
ix.4: Canoncialize wake sysctl
Integrate the wake sysctl in SYNOPSIS and SYSCTL VARIABLES so that
it is integrated into the search engine and visible in the canonical
sections. Also, add a blank line after the example for visual harmony.
Fixes: c004384343be (ixgbe: Correct Wake-on-LAN configuration)
MFC after: the above is MFCed
Reviewed by: kbowling
Differential Revision: https://reviews.freebsd.org/D61702
rge.4: Polish
+ trim document description to fit on one line
+ canonicalize synopsis
+ move supported speeds to hardware with consistency with latest drivers
+ organize hardware in descending capability for marketing purposes
+ fix cursed line wrapping
+ make link to realtek.com clickable
+ first shipped in 15.2 actually
+ fix authors section line break and linter warning
Reviewed by: adrian
MFC after: immediately because this is shipping in 15.2
Differential Revision: https://reviews.freebsd.org/D61704
MFC: libdwarf: standard DWARF 5 form names, DW_LANG_C17 and C23
7bb441c86678 added the fixed-size string and address index forms
0x25 to 0x2c as DW_FORM_ref_strx1..4 and DW_FORM_ref_addrx1..4; the
standard (DWARF 5, table 7.6) names them DW_FORM_strx1..4 and
DW_FORM_addrx1..4, with no "ref". Rename them, keep the old spellings
as aliases since the header is installed, and update dwarf_dump.c's
form names accordingly. Add DW_LANG_C17 (0x2c) and DW_LANG_C23 (0x3e),
which clang emits for -std=c17 and -std=c23 units. ctfconv(1) needs
all of these; it carried them in a private header until now.
Reviewed by: markj, emaste
Differential Revision: https://reviews.freebsd.org/D61154
(cherry picked from commit f22d65998fe15b6bed9c8c3a2eede25c706837e1)
contrib/kyua: update to 0.15.2
This change contains a few bugfixes to the test executor.
MFC after: 1 week
Merge commit 'dab80d5deaf7d998d587b99f7941890237960638'
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
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]
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
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]