aboutsummaryrefslogtreecommitdiff
path: root/sbin
Commit message (Collapse)AuthorAgeFilesLines
* nvmecontrol: telemetry-log --verboseWarner Losh3 hours2-4/+26
| | | | | | | | Add -v / --verbose to report status report since these things can take minutes to retrieve. Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D55019
* nvmecontrol: telemetry-log don't sanity check host generation numberWarner Losh3 hours1-10/+0
| | | | | | | | | Don't sanity check the host initiated generation number. It's not necessarily constant between the two log page fetches. nvme-cli doesn't do this stanity check and it generates a lot of false positives. Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D55018
* nvmecontrol: Always set the RAE bit on telemetry-log requestsWarner Losh3 hours1-2/+2
| | | | | | | | | | | nvme-cli, as well as some vendor scripts, always set the RAE bit of the GET LOG PAGE request when retrieving telemetry logs to avoid the log getting reset to something new. Adopt that praactice here (nvme-cli telemetry-log does have a --rae option, but that just turns on the rae bit which defaults to being on: there's no way to turn it off). Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D55017
* ifconfig: Exit with a non-zero status when SIOCSIFFIB failsMark Johnston5 days3-11/+40
| | | | | | | | | | | | | | Previously, setting an interface FIB to some invalid value would result in a warning being printed, but the ifconfig command would exit with status 0, but this is wrong. Add a little regression test. Reviewed by: pouria, zlei, melifaro MFC after: 2 weeks Sponsored by: Stormshield Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D54918
* sbin/setkey: add -Z option to disable receive timeoutsKonstantin Belousov7 days1-9/+15
| | | | | Sponsored by: NVidia networking MFC after: 1 week
* cam/scsi: Restore scsi_start_stop() and add scsi_start_stop_pc()Jaeyoon Choi7 days1-1/+0
| | | | | | | | | | Revert the argument change that broke libcam in 8c35de49 and move power_condition support to scsi_start_stop_pc(). Reported by: imp Reviewed By: #cam, imp (mentor) Sponsored by: Samsung Electronics Differential Revision: https://reviews.freebsd.org/D54822
* fusefs: Implement support for the auto_unmount option kernel-sideGleb Popov9 days2-1/+6
| | | | | | | | | libfuse clients may pass the "-o auto_unmount" flag to ensure that the mountpoint will get unmounted even if the server terminate abnormally. Without this flag sending KILL to a FUSE daemon leaves its mountpoint mounted. Approved by: asomers Differential Revision: https://reviews.freebsd.org/D53086
* mdmfs: Fix soft updates logicDag-Erling Smørgrav11 days1-10/+2
| | | | | | | | | | | Now that newfs(8) has a command-line argument to disable soft updates, use that instead of running tunefs(8) after the fact to turn them off. MFC after: 1 week Sponsored by: Klara, Inc. Sponsored by: NetApp, Inc. Reviewed by: mckusick, imp Differential Revision: https://reviews.freebsd.org/D54783
* pfctl(8): change default limiter action from no-match to blockKristof Provost14 days3-3/+3
| | | | | | | | | | | | | | | | | pf(4) users who use limiters in current should update the rules accordingly to reflect the change in default behavior. The existing rule which reads as follows: pass in from any to any state limiter test needs to be changed to: pass in from any to any state limiter test (no-match) OK dlg@ Obtained from: OpenBSD, sashan <sashan@openbsd.org>, c600931321 Sponsored by: Rubicon Communications, LLC ("Netgate")
* ifconfig: Use strlcpy(3) instead of strncpy(3) for interface nameAmy Vargas2026-01-181-1/+1
| | | | | | | | No functional change intended. Reviewed by: pouria, delphij, imp Approved by: glebius (mentor) Differential Revision: https://reviews.freebsd.org/D54752
* pfctl: allow new page character (^L) in pf.confKristof Provost2026-01-144-1/+7
| | | | | | | | | | | | | | PF configuration files can contains many things. Using the new page characters (i.e. ^L, \014) to mark the beginning of parts is useful because many editors such as emacs and vim has facilities to jump next/previous ones. PR: 86635 MFC after: 2 weeks Submitted by: MOROHOSHI Akihiko <moro@remus.dti.ne.jp> Submitted by: Simon Wollwage <rootnode+freebsd@wollwage.com> Sponsored by: Rubicon Communications, LLC ("Netgate")
* pfctl: make the source limiter output match the inputKristof Provost2026-01-142-2/+2
| | | | | | | | | | When printing source limiters use the same keywords as we accept on input, that is use 'entries' for the entries value (not 'limit') and 'limit' for the limit value (and not 'states'). Update the test case to match. Sponsored by: Rubicon Communications, LLC ("Netgate")
* pf: configurable action on limiter exceededKristof Provost2026-01-144-33/+66
| | | | | | | | | | | | | | | | This change extends pf(4) limiters so administrator can specify action the rule executes when limit is reached. By default when limit is reached the limiter overrides action specified by rule to no-match. If administrator wants to block packet instead then rule with limiter should be changed to: pass in from any to any state limiter test (block) OK dlg@ Obtained from: OpenBSD, sashan <sashan@openbsd.org>, 04394254d9 Sponsored by: Rubicon Communications, LLC ("Netgate")
* pfctl: distinguish broadcast and PPP peer addressesKristof Provost2026-01-141-3/+4
| | | | | | | | | | | pfctl_parser.c, ifa_load() should distinguish between broadcast and PPP peer address when it populates interface table for rule parser. OK @claudio, OK @dlg Obtained from: OpenBSD, sashan <sashan@openbsd.org>, 2e871bec67 Sponsored by: Rubicon Communications, LLC ("Netgate")
* pfctl: ifa_load() in pfctl_parser.c may attempt to read beyond the buffer.Kristof Provost2026-01-141-2/+8
| | | | | | | | | | | | | | The current ifa_load() is not paranoid enough when it deals with information which comes from kernel. The function just ignores sa_len member in socket address returned getifaddrs(). The issue has been reported by anton@. The idea for fix here comes fromy claudio@. OK @claudio, @deraadt Obtained from: OpenBSD, sashan <sashan@openbsd.org>, a48d060175 Sponsored by: Rubicon Communications, LLC ("Netgate")
* pfctl tests: basic source and state limiter testsKristof Provost2026-01-145-0/+10
| | | | Sponsored by: Rubicon Communications, LLC ("Netgate")
* pfctl.8: mention -k source -k <IP>Kristof Provost2026-01-141-2/+7
| | | | Sponsored by: Rubicon Communications, LLC ("Netgate")
* pfctl: improve limiters printingKristof Provost2026-01-141-12/+11
| | | | | | | | | | | Deviate a little from the OpenBSD code, to avoid unexpected output changes. Don't print limiter information when we show the rules (or labels). Do include the source and state limiters in the 'all' (pfctl -sa) output and give them their own titles. Sponsored by: Rubicon Communications, LLC ("Netgate")
* pfctl: resolve '-s' ambiguityKristof Provost2026-01-142-4/+4
| | | | | | | | | | The 'introduce source and state limiters' commit added source and state limiters, and used Stlimiters and Srclimiters as show options. However, FreeBSD had 'Sources' as a show option already. This means that 'pfctl -sS' would now be ambiguous. Avoid this by renaming the new options. Sponsored by: Rubicon Communications, LLC ("Netgate")
* pf: convert state limiter interface to netlinkKristof Provost2026-01-143-119/+82
| | | | | | | This is a new feature with new ioctl calls, so we can safely remove them right now. Sponsored by: Rubicon Communications, LLC ("Netgate")
* pf: introduce source and state limitersKristof Provost2026-01-145-101/+1286
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | both source and state limiters can provide constraints on the number of states that a set of rules can create, and optionally the rate at which they are created. state limiters have a single limit, but source limiters apply limits against a source address (or network). the source address entries are dynamically created and destroyed, and are also limited. this started out because i was struggling to understand the source and state tracking options in pf.conf, and looking at the code made it worse. it looked like some functionality was missing, and the code also did some things that surprised me. taking a step back from it, even it if did work, what is described doesn't work well outside very simple environments. the functionality i'm talking about is most of the stuff in the Stateful Tracking Options section of pf.conf(4). some of the problems are illustrated one of the simplest options: the "max number" option that limits the number of states that a rule is allowed to create: - wiring limits up to rules is a problem because when you load a new ruleset the limit is reset, allowing more states to be created than you intended. - a single "rule" in pf.conf can expand to multiple rules in the kernel thanks to things like macro expansion for multiple ports. "max 1000" on a line in pf.conf could end up being many times that in effect. - when a state limit on a rule is reached, the packet is dropped. this makes it difficult to do other things with the packet, such a redirect it to a tarpit or another server that replies with an outage notices or such. a state limiter solves these problems. the example from the pf.conf.5 change demonstrates this: An example use case for a state limiter is to restrict the number of connections allowed to a service that is accessible via multiple protocols, e.g. a DNS server that can be accessed by both TCP and UDP on port 53, DNS-over-TLS on TCP port 853, and DNS-over-HTTPS on TCP port 443 can be limited to 1000 concurrent connections: state limiter "dns-server" id 1 limit 1000 pass in proto { tcp udp } to port domain state limiter "dns-server" pass in proto tcp to port { 853 443 } state limiter "dns-server" a single limit across all these protocols can't be implemented with per rule state limits, and any limits that were applied are reset if the ruleset is reloaded. the existing source-track implementation appears to be incomplete, i could only see code for "source-track global", but not "source-track rule". source-track global is too heavy and unweildy a hammer, and source-track rule would suffer the same issues around rule lifetimes and expansions that the "max number" state tracking config above has. a slightly expanded example from the pf.conf.5 change for source limiters: An example use for a source limiter is the mitigation of denial of service caused by the exhaustion of firewall resources by network or port scans from outside the network. The states created by any one scanner from any one source address can be limited to avoid impacting other sources. Below, up to 10000 IPv4 hosts and IPv6 /64 networks from the external network are each limited to a maximum of 1000 connections, and are rate limited to creating 100 states over a 10 second interval: source limiter "internet" id 1 entries 10000 \ limit 1000 rate 100/10 \ inet6 mask 64 block in on egress pass in quick on egress source limiter "internet" pass in on egress proto tcp probability 20% rdr-to $tarpit the extra bit is if the source limiter doesn't have "space" for the state, the rule doesn't match and you can fall through to tarpitting 20% of the tcp connections for fun. i've been using this in anger in production for over 3 years now. sashan@ has been poking me along (slowly) to get it in a good enough shape for the tree for a long time. it's been one of those years. bluhm@ says this doesnt break the regress tests. ok sashan@ Obtained from: OpenBSD, dlg <dlg@openbsd.org>, 8463cae72e Sponsored by: Rubicon Communications, LLC ("Netgate")
* src.opts: Introduce MK_SOUNDChristos Margiolis2026-01-121-5/+7
| | | | | | | | PR: 291853 Sponsored by: The FreeBSD Foundation MFC after: 1 week Reviewed by: zarychtam_plan-b.pwste.edu.pl, markj Differential Revision: https://reviews.freebsd.org/D54456
* newfs: Add -u to getopt stringDag-Erling Smørgrav2026-01-111-1/+1
| | | | Fixes: 68562f8145e8 ("newfs: Add an option to disable soft updates")
* newfs: Add an option to disable soft updatesDag-Erling Smørgrav2026-01-112-9/+24
| | | | | | | | | | | | | A previous commit turned soft updates on by default for UFS2 without providing a way to turn them off. This corrects that by adding a new -u flag which forces soft updates (and soft updates journaling) off. MFC after: 1 week Sponsored by: Klara, Inc. Sponsored by: NetApp, Inc. Fixes: 61dece6d27fb ("Enable soft updates by default for UFS2 filesystems.") Reviewed by: mckusick Differential Revision: https://reviews.freebsd.org/D54576
* pfctl: remove duplicate "va" entryKristof Provost2025-12-301-1/+0
| | | | | | | | | It turns out we'd already added this a few years ago, so didn't need to add it again. Fixes: 190c1f3d9326 Reported by: Seth Hoffert <seth.hoffert@gmail.com> Sponsored by: Rubicon Communications, LLC ("Netgate")
* pf: convert DIOCRCLRASTATS to netlinkKristof Provost2025-12-301-1/+7
| | | | Sponsored by: Rubicon Communications, LLC ("Netgate")
* pf: move DIOCRCLRASTATS into libpfctlKristof Provost2025-12-301-17/+1
| | | | Sponsored by: Rubicon Communications, LLC ("Netgate")
* pfctl: allow network programs select DSCP_VA for network ToSKristof Provost2025-12-301-0/+1
| | | | | | | OK stsp@ Obtained from: OpenBSD, phessler <phessler@openbsd.org>, f8a2f73b65 Sponsored by: Rubicon Communications, LLC ("Netgate")
* ipfw.8: document how to delete nat configuration instanceEugene Grosbein2025-12-281-1/+15
| | | | MFC after: 3 days
* ipfw.8: fix misprint after previous changeEugene Grosbein2025-12-281-1/+1
| | | | | | | rulese -> ruleset MFC after: 3 days X-MFC-with: a7b8a5d37bcb0009297962137bfb6c6570e5af12
* ipfw.8: fix documentation bug for setmarkEugene Grosbein2025-12-281-2/+6
| | | | | | | | | | | | A mark set with "setmark" keyword is intended to be "sticky" and documented as such but in fact it is not yet, as current implementation lacks "sticky" feature and its implementation will be not MFC'd, most probably. Correct the manual page until the implementation improved. MFC after: 3 days Discussed with: Boris Lytochkin <lytboris@gmail.com> (author)
* fsck_msdosfs: avoid warnings about too-long initializer stringsDimitry Andric2025-12-251-2/+2
| | | | | | | | | | | | | | Mark `dot_name` and `dotdot_name` as as `__non_string`, to avoid warnings from clang 21 similar to: sbin/fsck_msdosfs/dir.c:466:39: error: initializer-string for character array is too long, array size is 11 but initializer has size 12 (including the null terminating character); did you mean to use the 'nonstring' attribute? [-Werror,-Wunterminated-string-initialization] 466 | static const u_char dot_name[11] = ". "; | ^~~~~~~~~~~~~ sbin/fsck_msdosfs/dir.c:467:39: error: initializer-string for character array is too long, array size is 11 but initializer has size 12 (including the null terminating character); did you mean to use the 'nonstring' attribute? [-Werror,-Wunterminated-string-initialization] 467 | static const u_char dotdot_name[11] = ".. "; | ^~~~~~~~~~~~~ MFC after: 3 days
* camcontrol.8: Descriptions before examplesAlexander Ziaee2025-12-231-201/+148
| | | | | | | | | | | | This page has a lot of examples, so having them in the previous order can be confusing. Rewrite to the normal order where the descriptions come before the command, followed by a colon, which is still clear even jumping to the middle of the section. PR: 291759 MFC after: 3 days Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D54285
* libpfctl: export a get states variant that takes a pfctl_handleKristof Provost2025-12-211-1/+1
| | | | Sponsored by: Rubicon Communications, LLC ("Netgate")
* reboot: Fix halt -p behaviorDag-Erling Smørgrav2025-12-191-2/+2
| | | | | | | | | | | The RB_HALT bit is always set when invoked as `halt`, so to maintain a distinction between `halt` and `halt -p`, we must check the RB_POWEROFF bit first. PR: 291814 Fixes: 4453ec5b8716 ("reboot: Default to a clean shutdown") Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D54320
* ipf: copy{in,out}ptr -> ipf_copy{in,out}_indirectBrooks Davis2025-12-192-4/+4
| | | | | | | | | | | | | | | | | These functions take the source or destintation address indirectly from a potentially missaligned buffer. Rename them to refect this and to free up the copy{in,out}ptr names. Some of the code in question is dead code and doesn't or won't compile, but I've changed it all for consistency. NB: If the pointers are actually stored under aligned then this code is broken with CHERI. Reviewed by: cy Effort: CHERI upstreaming Sponsored by: Innovate UK Differential Revision: https://reviews.freebsd.org/D54232
* ifconfig: Fix the -L flag when using netlinkMark Johnston2025-12-191-2/+4
| | | | | | | | | | | | | | | | | | By default, when ifconfig shows a v6 address derived from a router-advertised prefix, it shows the initial preferred and valid lifetimes. When -L is specified, it is supposed to show the remaining lifetimes, but this was broken in the conversion to netlink. Fix that, and add a regression test which validates ifconfig output before and after a short-lived address expires. Reported by: Franco Fichtner <franco@opnsense.org> Reviewed by: melifaro, allanjude, Seyed Pouria Mousavizadeh Tehrani Fixes: 4c91a5dfe483 ("ifconfig: make interface and address listing use Netlink as transport") MFC after: 2 weeks Sponsored by: OPNsense Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D54294
* gpart: add libxo support for "show" subcommand + man page updatesJohan Söllvander2025-12-181-1/+11
| | | | | | | | | | | | | Added libxo support to `gpart show`, also updated the man pages for geom and gpart to show where you can expect libxo formatted output. PR: 290629 MFC after: 1 week Sponsored by: ConnectWise Reviewed by: asomers, mckusick, phil Approved by: asomers (mentor) Differential Revision: https://reviews.freebsd.org/D53950
* bectl: log modifying functions to zpool historyRob Norris2025-12-171-16/+57
| | | | | | | | | | | | | | Modeled directly after the method used by the zfs/zpool commands: flag commands with a "please log me" flag, and when there, reconstruct the command line. On success, call the library function to add it to the log. (Majority of the change by Rob; minor edits by kevans@) Signed-off-by: Rob Norris <rob.norris@klarasystems.com> Co-authored-by: Kyle Evans <kevans@FreeBSD.org> Sponsored by: Modirum MDPay Sponsored by: Klara, Inc.
* ipfilter: Prevent stack buffer overflowDag-Erling Smørgrav2025-12-161-0/+5
| | | | | | | | | | | | | | | | When copying ipfs data from user space, don't just check that the payload length is nonzero, but also that it does not exceed the size of the stack buffer we're copying it into. While we're at it, use a union to create a buffer of the exact size we need instead of guessing that 2048 will be enough (and not too much). Finally, check the size of the payload once it gets to where it's used. MFC after: 3 days Reported by: Ilja Van Sprundel <ivansprundel@ioactive.com> Reviewed by: cy Differential Revision: https://reviews.freebsd.org/D54194
* ipfw: create a bpf tap point for every log ruleGleb Smirnoff2025-12-152-12/+26
| | | | | | | | | | | Dynamically allocate bpf tap points for every rule that has "log". The name is "ipfw%u", where %u is substituted to the rule number. The default catch all "ipfw0" tap still exists for compatibility and it will catch packets in case if there are no bpf listeners on a per-rule tap. Reviewed by: ae Differential Revision: https://reviews.freebsd.org/D53877
* ifconfig: print warning and return success on ipfw0, ipfwlog0 cloningGleb Smirnoff2025-12-151-0/+9
| | | | | | | This should provide people a chance to remove ipfw0 and ipfwlog0 from cloned_interfaces in their rc.conf during FreeBSD 16.x lifetime. Differential Revision: https://reviews.freebsd.org/D53876
* ipfw: create "ipfw0" and "ipfwlog0" bpf tapping points without ifnet(9)Gleb Smirnoff2025-12-151-29/+9
| | | | | | | As a free bonus the tapping points are now able to match packet direction. Reviewed by: ae Differential Revision: https://reviews.freebsd.org/D53875
* pfctl: report ICMP states consistently for IPv4/IPv6Kristof Provost2025-12-131-5/+0
| | | | | | | | | | | | Remove the '#ifndef INET6', which never actually mattered because this define is never set. This makes us report ICMP states for IPv4 and IPv6 the same way (and also aligns us with OpenBSD). This means we will now always report state 0:0 rather than NO_TRAFFIC:NO_TRAFFIC for icmp6 (like we already did for icmp). Reported by: Lev Prokofev <lev@netgate.com> Sponsored by: Rubicon Communications, LLC ("Netgate")
* gpart: "gpart --libxo:JP list" duplicates attribute keysAlan Somers2025-12-101-2/+6
| | | | | | | | | | | | | | | | Add leaf-list modifier to attrib as it's possible to have multiple attributes on a gpart provider. I purposely made it so that the normal output still says "attrib:" just so we don't break any scripts people may be using to parse the output, but the libxo output now says "attribute" just like `gpart show` will do once https://reviews.freebsd.org/D53950 is merged. PR: 291377 MFC after: 1 week Reviewed by: asomers Sponsored by: ConnectWise Differential Revision: https://reviews.freebsd.org/D54080
* shutdown: Adapt to changes in rebootDag-Erling Smørgrav2025-12-102-8/+8
| | | | | | | | | Now that halt and reboot actually signal init, shutdown needs to run fasthalt or fastboot instead when given the -o option. MFC after: 1 month Reviewed by: imp, allanjude Differential Revision: https://reviews.freebsd.org/D54122
* reboot: Default to a clean shutdownDag-Erling Smørgrav2025-12-102-32/+88
| | | | | | | | | | | | | | | | | | | | | | | | | * If invoked as fasthalt or fastboot, behavior is unchanged. * If not invoked as fasthalt or fastboot, we simply signal init(8), just like shutdown(8) does, instead of taking the system down ourselves. * Since only init can handle the RB_REROOT case, the -r flag is not supported in fast mode. * Update the usage string to correctly reflect the program being run (fast or normal; halt, boot, or nextboot) and the options available in each case. * Update the manual page to make the distinction between normal and fast mode clear, better explain what shutdown(8) still does that reboot(8) does not, and add a historical note explaining what the difference between the two used to be. MFC after: 1 month Relnotes: yes Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D54117
* shutdown(8): Document additional formats supported by the code.Xin LI2025-12-091-15/+47
| | | | MFC after: 1 week
* ipfilter: Disable ipfs(8) by defaultCy Schubert2025-12-081-1/+6
| | | | | | | | | | | | | At the moment ipfs(8) is a tool that can be easily abused. Though the concept is sound the implementation needs some work. ipfs(8) should be considered experimental at the moment. This commit also makes ipfs support in the kernel optional. Reviewed by: emaste, glebius MFC after: 1 week Differential revision: https://reviews.freebsd.org/D53787
* ipfilter: Restrict ipfilter within a jailCy Schubert2025-12-081-0/+1
| | | | | | | | | | | | | | | | | | | | Add a sysctl/tunable (net.inet.ipf.jail_allowed) to control whether a jail can manage its own ipfilter rules, pools, and settings. A jail's control over its own ipfilter rules and settings may not be desireable. The default is jail access to ipfilter is denied. The host system can stil manage a jail's rules by attaching the rules, using the on keyword, limiting the rule to the jail's interface. Or the sysctl/tunable can be enabled to allow a jail control over its own ipfilter rules and settings. Implementation note: Rather than store the jail_allowed variable, referenced by sysctl(9), in a global area, storing the variable in the ipfilter softc is consistent with ipfilter's use of its softc. Discussed with: emaste, jrm MFC after: 1 week Differential revision: https://reviews.freebsd.org/D53623