Commit Graph

10169 Commits

Author SHA1 Message Date
Mateusz Piotrowski
78d4bd8753 ifconfig.8: Document -g all and -G all
The special group name "all" selects all the interfaces.

MFC after:	3 days
2022-06-24 11:38:02 +02:00
Eugene Grosbein
95144583f7 adjkerntz(8): revert "detect extra jailed invokation to keep logs clean"
This reverts commit 048ce0876f
due to bugs. Reworked change will be committed later hopefully.
2022-06-23 21:46:08 +07:00
Eugene Grosbein
048ce0876f adjkerntz(8): detect extra jailed invokation to keep logs clean
It may happen that "adjkerntz -a" called from jailed root crontab.
In that case it spams logs with a line:

sysctl(set: "machdep.wall_cmos_clock"): Operation not permitted

Be silent in that case.

MFC after:	1 month
2022-06-22 01:32:54 +07:00
Kristof Provost
1f61367f8d pf: support matching on tags for Ethernet rules
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D35362
2022-06-20 10:16:20 +02:00
Kyle Evans
4014365e42 mixer: remove volume backwards compat, add % interpretation
The current situation is fairly confusing, where an integer is interpreted
as a percent until you slap a decimal on it and magically it becomes an
absolute value.

Let's have a flag day in 14.0 and remove this shim entirely.  Setting with
percent can still be useful, so allow a trailing '%' to indicate as such.
As a side effect, we tighten down the format allowed in the volume a little
bit by ensuring there's no trailing garbage after the value once it's
separated into left and right components.

Reviewed by:	christos, hselasky, pauamma_gundo.com (manpages)
Relnotes:	yes
Differential Revision:	https://reviews.freebsd.org/D35101
2022-06-17 22:50:58 -05:00
Juraj Lutter
ad0a7ea650 kldload: Bring functionality in line with manual page
Honor -q parameter and do not display any warning messages when -q is
specified.

Approved by:		dfr
MFC after:		2 weeks
Sponsored by:		Resulta, s.r.o.
Differential Revision:	https://reviews.freebsd.org/D35511
2022-06-17 16:53:28 +02:00
Andrew Turner
ea578b34cb Remove PAGE_SIZE from hastd
It may not be known at compile time so we should detect it at run time.

Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D35118
2022-06-17 10:36:17 +01:00
Kristof Provost
5575d5a548 dhclient: fix pcp:pcp cleanup failure
If isc-dhcp44-server is not installed (as is the case the project's CI
servers) we don't create ngctl.shutdown, causing the 'rm' to fail.
That in turn causes the cleanup function to return non-zero, which
causes kyua to consider the test failed.

Use 'rm -f' instead, so we don't error even if the file doesn't exist.

Sponsored by:	Rubicon Communications, LLC ("Netgate")
2022-06-17 09:10:52 +02:00
Zhenlei Huang
030f3ee995 ifconfig.8: reflect removal of FDDI and Token Ring
Reviewed By:	pauamma
Differential Revision: https://reviews.freebsd.org/D35409
2022-06-15 18:52:05 +01:00
Doug Ambrisko
ce00b11940 mount: revert the active vnode reporting feature
Revert the computing of active vnode reporting since statfs is used
by a lot of tools.  Only report the vnodes used.

Reported by:	mjg
2022-06-15 07:24:55 -07:00
Mitchell Horne
ec1a13df03 Remove mips-specific Makefiles for /sbin and /usr/sbin
They are no longer needed, but were likely missed simply because they
don't show up in a grep for 'mips'.

Reviewed by:	emaste
Differential Revision:	https://reviews.freebsd.org/D35475
2022-06-14 10:15:03 -03:00
Doug Ambrisko
6468cd8e0e mount: add vnode usage per file system with mount -v
This avoids the need to drop into the ddb to figure out vnode
usage per file system.  It helps to see if they are or are not
being freed.  Suggestion to report active vnode count was from
kib@

Reviewed by:   	kib
Differential Revision: https://reviews.freebsd.org/D35436
2022-06-13 07:56:38 -07:00
Jens Schweikhardt
5d7c65ff36 Correct a typo in a string literal. 2022-06-07 21:48:59 +02:00
Gordon Bergling
e2dfabb589 nvmecontrol(8): Fix a typo in an error message
- s/insufficent/insufficient/

MFC after:	3 days
2022-06-04 20:30:48 +02:00
Arseny Smalyuk
81cac3906e ipfw: add support radix tables and table lookup for MAC addresses
By analogy with IP address matching, add a way to use ipfw radix
tables for MAC matching. This is implemented using new ipfw table
with mac:radix type. Also there are src-mac and dst-mac lookup
commands added.

Usage example:
  ipfw table 1 create type mac
  ipfw table 1 add 11:22:33:44:55:66/48
  ipfw add skipto tablearg src-mac 'table(1)'
  ipfw add deny src-mac 'table(1, 100)'
  ipfw add deny lookup dst-mac 1

Note: sysctl net.link.ether.ipfw=1 should be set to enable ipfw
filtering on L2.

Reviewed by:	melifaro
Obtained from:	Yandex LLC
MFC after:	1 month
Relnotes:	yes
Sponsored by:	Yandex LLC
Differential Revision:	https://reviews.freebsd.org/D35103
2022-06-04 19:12:29 +03:00
Rick Macklem
7cab630ba4 mount_nfs: Only create a mounttab file entry is nmount(2) succeeds
mount_nfs creates entries in the mounttab file and umount removes
them.  Entries in the mounttab file ae used by rpc.umntall to
notify the NFS server that NFSv3 entries need to be removed when
they have not been removed by umount.

Without this patch, an enty will be created in the mounttab file,
even if the nmount(2) syscall fails for the mount.  This patch
modifies the code so that the mounttab entry is only created
after nmount(2) succeeds.

This change only affects NFSv3 and only affects how showmount
displays NFSv3 mounts.

MFC after:	2 weeks
2022-05-28 15:48:40 -07:00
Konrad Sewiłło-Jopek
c9a5c48ae8 arp: Implement sticky ARP mode for interfaces.
Provide sticky ARP flag for network interface which marks it as the
"sticky" one similarly to what we have for bridges. Once interface is
marked sticky, any address resolved using the ARP will be saved as a
static one in the ARP table. Such functionality may be used to prevent
ARP spoofing or to decrease latencies in Ethernet networks.

The drawbacks include potential limitations in usage of ARP-based
load-balancers and high-availability solutions such as carp(4).

The implemented option is disabled by default, therefore should not
impact the default behaviour of the networking stack.

Sponsored by:		Conclusive Engineering sp. z o.o.
Reviewed By:		melifaro, pauamma_gundo.com
Differential Revision: https://reviews.freebsd.org/D35314
MFC after:		2 weeks
2022-05-27 12:41:30 +00:00
John-Mark Gurney
35dc7f8f5d
dhclient: test against a real (ISC) dhcp server
This tests both both normal (untagged), and pcp tagged (VLAN 0)
networks which are now common for fiber ISPs.

Reviewed by: markj, kp
Differential Revision: https://reviews.freebsd.org/D35178
2022-05-25 17:02:38 -07:00
Konstantin Belousov
d72ea9fb3f ifconfig: Use SIOCGIFCAPNV if supported
Reviewed by:	hselasky, jhb, kp (previous version)
Sponsored by:	NVIDIA Networking
MFC after:	3 weeks
Differential revision:	https://reviews.freebsd.org/D32551
2022-05-24 23:59:33 +03:00
Konstantin Belousov
277b9588fd ifconfig: add rxtls and -rxtls commands
Reviewed by:	hselasky, jhb, kp
Sponsored by:	NVIDIA Networking
MFC after:	3 weeks
Differential revision:	https://reviews.freebsd.org/D32551
2022-05-24 23:59:33 +03:00
Konstantin Belousov
6ca418e481 ifconfig: add setifcapnv()
which uses SIOCSIFCAPNV to set arbitrary string-named interface
capability.

Reviewed by:	hselasky, jhb, kp
Sponsored by:	NVIDIA Networking
MFC after:	3 weeks
Differential revision:	https://reviews.freebsd.org/D32551
2022-05-24 23:59:33 +03:00
Konstantin Belousov
42d5cb0927 ifconfig: add glue for specifying functions taking static string parameter
Reviewed by:	hselasky, jhb, kp
Sponsored by:	NVIDIA Networking
MFC after:	3 weeks
Differential revision:	https://reviews.freebsd.org/D32551
2022-05-24 23:59:33 +03:00
Konstantin Belousov
7aecd12d9c ifconfig: use c99 designated initializers for DEF_CMD
Reviewed by:	hselasky, jhb, kp
Sponsored by:	NVIDIA Networking
MFC after:	3 weeks
Differential revision:	https://reviews.freebsd.org/D32551
2022-05-24 23:59:32 +03:00
Konstantin Belousov
7541a95a54 ifconfig: some style
wrap several too long lines

Reviewed by:	hselasky, jhb, kp
Sponsored by:	NVIDIA Networking
MFC after:	3 weeks
Differential revision:	https://reviews.freebsd.org/D32551
2022-05-24 23:59:32 +03:00
Zhenlei Huang
2670ea8a07 devfs.rules: Do not expose "log" in the default devfs rules.
/etc/rc.d/jail no longer creates /dev/log as a symbolic link since
commit 84b354cb9a.

PR:		228351
Reviewed by:	jamie, mark
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D34563
2022-05-24 09:54:38 -04:00
Jessica Clarke
2986638550 pfctl: fix out-of-bounds access
If pfctl is called with "pfctl -a ''" we read outside of the anchoropt
buffer. Check that the buffer is sufficiently long to avoid that.

Maintain the existing (and desired, because it's used as such in
/etc/periodic/security/520.pfdenied) behaviour of treating "-a ''" as a
request for the root anchor (or no anchor specified).

PR:		264128
Reviewed by:	kp
2022-05-22 10:31:42 +02:00
Mike Karels
a30eee517d ping: add missing test files to Makefile
Should fix ATF tests after 5af718a592.
2022-05-20 22:13:02 -05:00
Mike Karels
5af718a592 ping: if -S srcaddr uses a numeric address, use that protocol
The command "ping -S dotted.quad hostname" fails on dual-stack hosts
with the confusing message "ping: invalid source address: Name does
not resolve" because IPv6 is selected in preference.  If the argument
to -S is numeric (likely), select the corresponding address family,
as if -4 or -6 was specified.  Add tests that either IPv4 or IPv6 can
be forced via a -S parameter.

Reviewed by:	asomers
Differential Revision: https://reviews.freebsd.org/D35271
MFC after:	1 week
2022-05-20 18:30:47 -05:00
Mitchell Horne
6543fa5a5c dumpon: warn if the configured netdump link is down
Previously we expected the DIOCSKERNELDUMP ioctl to return ENXIO if the
interface was down, but it does not actually do this. Grab the link
status using getifaddrs(3) instead, and downgrade this case from an
error to a warning; the user might bring the link back up at a later
time.

Reviewed by:	cem
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D35196
2022-05-14 10:27:54 -03:00
Eugene Grosbein
9d7cefc278 ipfw.8: spell "layer2" consistently throughout the manual page
MFC after:	1 week
2022-05-14 04:30:29 +07:00
Kirk McKusick
bf46c0a9ae Clean up comments in fsck.h.
No functional change.
2022-05-10 16:06:15 -07:00
Mark Johnston
f775c417fd newfs_msdos: Fix warnings that arise when compiled for makefs
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
2022-05-10 17:26:50 -04:00
Warner Losh
2f44ad86f5 dmesg: Better wording from review
I pushed the last changes before I'd noticed the better wording
suggestions in the review. Also include a note that not all lines will
have a timestampe. Some multi-line messages are generated with sbuf, and
when those are pushed, only the first line will have the
timestamp. Document this quirky behavior as well since fixing it likely
won't happen soon. CAM periph drivers generate all the lines in their
announce message together so they aren't intermingled with other things,
for example.

Suggested by:		allanjude, emaste, rpokala
Sponsored by:		Netflix
Differential Revision:	https://reviews.freebsd.org/D35139
Differential Revision:	https://reviews.freebsd.org/D35141
2022-05-07 09:55:40 -06:00
Warner Losh
45ae223ac6 msgbuf: Allow microsecond granularity timestamps
Today, kern.msgbuf_show_timestamp=1 will give 1 second granularity
timestamps on dmesg lines. When kern.msgbuf_show_timestamp=2, we'll
produce microsecond level graunlarity.
For example:
old (== 1):
[13] Dual Console: Video Primary, Serial Secondary
[14] lo0: link state changed to UP
[15] bxe0: NIC Link is Up, 10000 Mbps full duplex, Flow control: ON - receive & transmit
[15] bxe0: link state changed to UP
new (== 2):
[13.807015] Dual Console: Video Primary, Serial Secondary
[14.544150] lo0: link state changed to UP
[15.272044] bxe0: NIC Link is Up, 10000 Mbps full duplex, Flow control: ON - receive & transmit
[15.272052] bxe0: link state changed to UP

Sponsored by:		Netflix
2022-05-07 09:32:22 -06:00
Warner Losh
6910fee62e dmesg: Document kern.msgbuf_show_timestamp
kern.msgbuf_show_timestamp=1 turns on timestamps in kernel's message
buffer which dmesg(8) prints.

Sponsored by:		Netflix
2022-05-07 09:32:21 -06:00
Alexander Leidinger
b29fb6cffd Improve description of the nocache option.
Discussed with:	pstef
2022-05-06 13:03:30 +02:00
Kirk McKusick
262b581d17 Properly specify the level of indirect block being looked up.
The value is used only for diagnostic purposes so no functional
change should result.
2022-05-05 16:58:03 -07:00
Eugene Grosbein
0aef862845 If setkey(8) is used without ipsec.ko loaded beforehand,
its attempt to install SA/SPD into the kernel results in cryptic
EINVAL error code.

Let it be a bit more user-friendly and try to load ipsec.ko
automatically if it is not loaded, just like ifconfig(8) does it
for modules it needs.

PR:		263379
MFC after:	2 weeks
2022-05-05 19:02:29 +07:00
Mina Galić
7ac164dc8e pkgbase: move devd's hyperv.conf to hyperv-tools package
This devd config file is useless without hyperv-tools, so we're moving
it into the hyperv-tools package. pr#263691

PR:		263691
MFC after:	3 days
2022-05-03 18:15:54 +02:00
Enji Cooper
f9f42a709b sbin/devfs: Correct usage
The -s applies to rule keyword only and it follows the rule keyword.

MFC after:	1 week
PR: [[https://bugs.freebsd.org/bugzilla/show_bug.cgi?id= 263289|263289]]
Submitted by: Yuichiro NAITO <naito.yuichiro@gmail.com>
Fixes: c3e412c083 sbin/devfs: clarify usage
Reviewed by: ngie
Differential Revision: https://reviews.freebsd.org/D34934
2022-04-30 11:00:11 -07:00
Alan Somers
2f6362484c fusefs: use the fsname mount option if set
The daemon can specify fsname=XXX in its mount options.  If so, the file
system should report f_mntfromname as XXX during statfs.  This will show
up in the output of commands like mount and df.

Submitted by:	Ali Abdallah <ali.abdallah@suse.com>
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D35090
2022-04-29 11:10:03 -06:00
John Baldwin
e6dede1456 setkey(8): Clarify language around AEAD ciphers.
AEAD ciphers for IPsec combine both encryption and authentication.  As
such, ESP configurations using an AEAD cipher should not use a
seperate authentication algorithm via -A.  However, this was not
apparent from the setkey manpage and 12.x and earlier did not perform
sufficient argument validation permitting users to pair an explicit -A
such as SHA256-HMAC with AES-GCM.  (The result was a non-standard
combination of AES-CTR with the specified MAC, but with the wrong
initial block counter (and thus different keystream) compared to using
AES-CTR as the cipher.)

Attempt to clarify this in the manpage by explicitly calling out AEAD
ciphers (currently only AES-GCM) and noting that AEAD ciphers should
not use -A.

While here, explicitly note which authentication algorithms can be
used with esp vs esp-old.  Also add subsection headings for the
different algorithm lists and tidy some language.

I did not convert the tables to column lists (Bl -column) though that
would probably be more correct than using literal blocks (Bd
-literal).

PR:		263379
Reviewed by:	Pau Amma <pauamma@gundo.com>, markj
Differential Revision:	https://reviews.freebsd.org/D34947
2022-04-27 12:23:18 -07:00
Reid Linnemann
0abcc1d2d3 pf: Add per-rule timestamps for rule and eth_rule
Similar to ipfw rule timestamps, these timestamps internally are
uint32_t snaps of the system time in seconds. The timestamp is CPU local
and updated each time a rule or a state associated with a rule or state
is matched.

Reviewed by:	kp
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D34970
2022-04-22 19:53:20 +02:00
Alexander Leidinger
b75644771a Add nullfs specific nocache option. 2022-04-22 10:22:26 +02:00
Kristof Provost
c90f8cb899 pfctl tests: fix Ethernet output expectations
Since a16732d670 we always print the l3 src/destination for Ethernet
rules. Update the tests to account for this.

Sponsored by:	Rubicon Communications, LLC ("Netgate")
2022-04-21 10:26:00 +02:00
Warner Losh
b91a48693a ifconfig: Fix spelling error
s/discreet/discrete

Reported by: Diane Bruce
2022-04-20 17:57:42 -06:00
Kristof Provost
a16732d670 pfctl: always print 'l3' source/destination
While the kernel only performs the L3 check for
ETHERTYPE_IP/ETHERTYPE_IP6 we should always print the source and
destination addresses.

Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D34918
2022-04-20 13:01:12 +02:00
Kristof Provost
812839e5aa pf: allow the use of tables in ethernet rules
Allow tables to be used for the l3 source/destination matching.
This requires taking the PF_RULES read lock.

Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D34917
2022-04-20 13:01:12 +02:00
Piotr Pawel Stefaniak
d399eb3ef7 ping: split the visual part of -f into a new option -.
After this, we'll be able to ping a host and not spam the terminal, and
no flooding will have to be involved. I've been doing this under Linux
as ping -fi1 host.

Reviewed by:	rpokala, Pau Amma
Differential Revision:	https://reviews.freebsd.org/D34882
2022-04-18 18:10:50 +02:00
Mitchell Horne
0a5c04a892 savecore: add an option to save a live minidump
The new '-L' flag will cause savecore to invoke the new mem(4) kernel
dump ioctl, taking a dump of the running system and writing the result
to a temporary file. Validation of the dump header is performed, similar
to regular crash dumps, and the final result is written to
livecore.X[.zst|.gz].

Also added is the '-Z' flag, which instructs the kernel to compress the
livedump compressed with zstd, akin to the existing -z flag. This option
has no effect in normal savecore(8) operation, but in theory could be
extended to perform such compression while reading the dump from the
dump device.

Encryption is unsupported for live dumps.

For example: 'savecore -Lz /var/crash' would create:
/var/crash/livecore.0.gz

Reviewed by:	markj
MFC after:	2 weeks
Sponsored by:	Juniper Networks, Inc.
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D34347
2022-04-18 12:56:16 -03:00
Mitchell Horne
cf02cf8dbf savecore: factor out info file handling
Move it to a separate function, allowing its reuse.

Reviewed by:	markj
MFC after:	3 days
Sponsored by:	Juniper Networks, Inc.
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D34822
2022-04-18 12:56:15 -03:00
Mitchell Horne
fafeb5342b savecore: decrease filename buffer sizes
All files are now created relative to savedirfd, e.g. with openat(2).
Therefore, we do not need character buffers to be PATH_MAX bytes long,
just long enough to hold the complete filename. 32 bytes is long enough
in all cases. These can be allocated on the stack.

While here, fix an error message that attempts to use an uninitialized
infoname.

Reviewed by:	markj
MFC after:	3 days
Sponsored by:	Juniper Networks, Inc.
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D34821
2022-04-18 12:56:15 -03:00
Mitchell Horne
4243d307d3 savecore: fold maxdumps check into getbounds()
So that new callers of getbounds() don't need to duplicate it.

Reviewed by:	markj
MFC after:	3 days
Sponsored by:	Juniper Networks, Inc.
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D34783
2022-04-18 12:56:15 -03:00
Matteo Riondato
d86cf44350 pfctl: fix recursive printing of rules
When asked to print rules recursively, correctly recurse for anchors
included in pf.conf with "anchorname/*".

PR:		262590
Reviewed by:	kp
MFC after:	3 weeks
2022-04-14 17:25:41 +02:00
Mateusz Piotrowski
632ea8ea98 ifconfig.8: Note that -l accepts -g in addition to -d and -u
Fixes:	5533c5046a ifconfig.8: Update -l synopsis
MFC after:	3 days
2022-04-11 20:05:36 +02:00
Mateusz Guzik
a3214fbe7f mount: use pidfile_signal
This fixes a performance problem where poudriere -j 104 keeps remounting
filesystems, which induce wanting to signal mountd, if running. The
current code tries to do it by creating the pidfile in /var/run and
unlinking it if the operation succeeds, inducing contention against
anything doing an exec as it tries to look up /var/run/ld-elf.so.hints

Differential Revision:	https://reviews.freebsd.org/D34681
2022-04-09 15:59:43 +00:00
Gordon Bergling
299fcf402d fsck_ffs(8): Fix a typo in a source code comment
- s/it it/if it/

MFC after:	3 days
2022-04-09 14:38:00 +02:00
Gordon Bergling
009727ed57 routed(8): Remove a double word in a source code comment
- s/it it/it/

MFC after:	3 days
2022-04-09 14:36:20 +02:00
Gordon Bergling
b95a6ecffa hastd(8): Fix a typo in a source code comment
- s/proccesses/processes/

MFC after:	3 days
2022-04-09 14:06:30 +02:00
Gordon Bergling
efb45ad024 umount(8): Remove a double word in a source code comment
- s/this this/this/

MFC after:	3 days
2022-04-09 10:13:45 +02:00
Gordon Bergling
d7958fe1bc ipnat(5): Fix a double word in the manual page
- s/be be/be/

MFC after:	3 days
2022-04-09 09:28:43 +02:00
Gordon Bergling
a06052d623 dhclient(8): Fix a typo in a source code comment
- s/explicitely/explicitly/

MFC after:	3 days
2022-04-09 09:28:06 +02:00
Mitchell Horne
173fc6f456 savecore: include '-u' flag in usage message
Reported by:	Pau Amma <pauamma@gundo.com>
Fixes		bc7ed46b63 ("Add '-u' switch that would...")
MFC after:	3 days
2022-04-05 16:23:02 -03:00
Reid Linnemann
4823489ab6 libpfctl: relocate implementations of pfr_add/get/set_addrs
Reviewed by:	kp
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D34740
2022-04-04 19:14:23 +02:00
Kyle Evans
dadb9c7093 bectl: push space-in-name check down into libbe
This check was previously in `create` only, not applying to renames.  It
should really be applied at the libbe level, so that we can avoid
writing about this restriction over and over again.

While we're here: `bectl rename` always succeeds, even when it doesn't.
Start returning the error.

Reported By:	Christian McDonald <cmcdonald netgate com>
Reviewed by:	rew, jwmaag_gmail.com (earlier version)
Differential Revision:	https://reviews.freebsd.org/D34605
2022-04-02 21:04:31 -05:00
Gordon Bergling
8a3568b584 ipf(5): Fix a typo in the manual page
- s/accomodate/accommodate/

MFC after:	3 days
2022-04-02 14:50:45 +02:00
Gordon Bergling
e09d161bd9 devd(8): Fix a typo in a configuration file
- s/coresponding/corresponding/

MFC after:	3 days
2022-04-02 11:52:26 +02:00
Mateusz Guzik
c4a08ef2af pf: handle duplicate rules gracefully
Reviewed by:	kp
Reported by:	dch
PR:		262971
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2022-04-01 18:01:48 +00:00
Kyle Evans
c0f846ff23 bectl: add some discussion about boot environment layouts
Discuss the standard type of layout, as well as the "deep" BE layout,
and some of the properties of both.  Point the various -r flags at this
new section, to help users understand which they're working with and
what the -r flag is actually doing. Note that we may just deprecate the
-r flag in future versions, but the flag will be recognized as a NOP at
that point.

Reviewed by:	pauamma_gundo.com, rew
Differential Revision:	https://reviews.freebsd.org/D34538
2022-03-31 17:42:33 -05:00
Mateusz Piotrowski
5533c5046a ifconfig.8: Update -l synopsis
The -g flag can be used together with the -l flag.

MFC after:	2 weeks
2022-03-31 17:12:27 +02:00
Mateusz Piotrowski
4d91c53a78 ifconfig.8: Document "ifconfig -g groupname"
"ifconfig -g groupname" prints a list of interface names,
which could be confusing, because it differs from
the behavior of "ifconfig -a -g groupname".

While here, add two examples showing the difference between
"ifconfig -a -g groupname" and "ifconfig -g groupname".

Fixes:	0dad3f0e15 Import interface groups from OpenBSD.
MFC after:	2 weeks
2022-03-31 17:07:15 +02:00
Mateusz Piotrowski
e57f6630d9 ifconfig.8: Remove commented-out Xr eon 5
This reference has been present in the manual page since the initial
import of BSD 4.4 Lite sbin Sources. It's time for it to be removed.

MFC after:	2 weeks
2022-03-31 12:07:18 +02:00
Mateusz Piotrowski
1969cc7bdc ifconfig.8: Remove remaining Xerox Network Systems(tm) bits
Support for Xeros Network Systems seems to be long gone. There is no
reason to keep this in the manual page.

MFC after:	2 weeks
2022-03-31 12:00:42 +02:00
Mateusz Piotrowski
19ac0bc5c1 ifconfig.8: Simplify examples by using canonical parameters
Also, use Bd instead of Dl for multi line examples.

MFC after:	2 weeks
2022-03-31 11:54:06 +02:00
Mateusz Piotrowski
2cd28d6f9b ifconfig.8: Mark address_family as optional in synopsis
Commands like "ifconfig wlan0 up" are valid. There is no need to always
specify the address family.

MFC after:	2 weeks
2022-03-31 11:43:18 +02:00
Mateusz Piotrowski
3049aac91b ifconfig.8: Improve description of the address argument
- Split paragraphs for clarity.
- Add an example of setting a random MAC address.

MFC after:	2 weeks
2022-03-31 11:43:18 +02:00
Mateusz Piotrowski
ad8cac1229 ifconfig.8: Improve readability of address_family documentation
Also, move the description of the special case of "ifconfig -l ether" to
the description of the -l flag.

MFC after:	2 weeks
2022-03-31 11:43:17 +02:00
Jose Luis Duran
607eed2f84 ifconfig.8: Fix quoting
Obtained from:	67d77afb0d (r69907135)
Fixes:		67d77afb0d ifconfig.8: Do not use ``'' for quoting
MFC after:	2 weeks
2022-03-30 17:43:13 +02:00
Mateusz Piotrowski
388c12e3f4 ifconfig.8: Clean up markup of "state" parameter
MFC after:	2 weeks
2022-03-30 14:58:39 +02:00
Mateusz Piotrowski
39da6db9bc ifconfig.8: Make the -f flag description compact
- Remove extraneous examples
- Apply "-compact" to the list macros so that it is possible to fit the
  definitions of the types and formats in one terminal screen.

MFC after:	2 weeks
2022-03-30 14:58:39 +02:00
Mateusz Piotrowski
67d77afb0d ifconfig.8: Do not use ``'' for quoting
MFC after:	2 weeks
2022-03-30 14:58:38 +02:00
Mateusz Piotrowski
ce03846373 ifconfig.8: Clean up the channel parameter description
MFC after:	2 weeks
2022-03-30 14:58:38 +02:00
Mateusz Piotrowski
0e2045b294 ifconfig.8: Add section headers to the parameters section
MFC after:	2 weeks
2022-03-30 14:58:37 +02:00
Mateusz Piotrowski
186a372f24 ifconfig.8: Clean up -n documentation
MFC after:	2 weeks
2022-03-30 14:58:37 +02:00
Mateusz Piotrowski
9076f99b9b ifconfig.8: Clean up -k documentation
MFC after:	2 weeks
2022-03-30 14:58:36 +02:00
Mateusz Piotrowski
59cdaadcf6 ifconfig.8: Clean up -C and -v documentation
MFC after:	2 weeks
2022-03-30 14:58:36 +02:00
Mateusz Piotrowski
fe1e3b55f2 ifconfig.8: Clean up -l documentation
MFC after: 2 weeks
2022-03-30 14:58:35 +02:00
Mateusz Piotrowski
787599088b ifconfig.8: Clean up -G & -g documentation
MFC after:	2 weeks
2022-03-30 14:58:35 +02:00
Mateusz Piotrowski
0625c31391 ifconfig.8: Clean up documentation of -a, -d, and -u
MFC after:	2 weeks
2022-03-30 14:58:34 +02:00
Mateusz Piotrowski
19c1b75f71 ifconfig.8: Clean up -L documentation
MFC after:	2 weeks
2022-03-30 14:58:34 +02:00
Mateusz Piotrowski
b56e4224e9 ifconfig.8: Clean up -m documentation
MFC after: 2 weeks
2022-03-30 14:58:33 +02:00
Mateusz Piotrowski
f4f02fa1e3 ifconfig.8: Clean up formatting of -f documentation
This change is about moving the -f documentation into the right place in
the manual. Also, document the IFCONFIG_FORMAT variable in the
ENVIRONMENT section.

MFC after:	2 weeks
2022-03-30 14:58:33 +02:00
Mateusz Piotrowski
f15eed7c2a ifconfig.8: Move options sections to the top
In order to clean up the layout of the manual page, let's keep
parameters in the end of the DESCRIPTION section. This patch does not
change any content, it's meant to only move the content around before
refactoring.

MFC after:	2 weeks
2022-03-30 14:58:32 +02:00
Mateusz Piotrowski
12a774649a ifconfig.8: Deduplicate groupname documentation
-G and -g flags are already described somewhere else in the manual.

MFC after:	2 weeks
2022-03-30 14:58:32 +02:00
Kristof Provost
d27c9f5bc3 pf: fixup match rules
Ensure that we can set and print match rules in ethernet rules.

Sponsored by:	Rubicon Communications, LLC ("Netgate")
2022-03-30 10:28:19 +02:00
Kristof Provost
9bb06778f8 pf: support listing ethernet anchors
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2022-03-30 10:28:19 +02:00
Mateusz Piotrowski
b710d4c85a ifconfig.8: Document that -k can be used with -a
MFC after:	2 weeks
2022-03-29 19:37:01 +02:00
Mateusz Piotrowski
52ec8807d8 ifconfig.8: Improve -f synopsis
- There is no need to mention in the synopsis that -f can be a list of
  comma-separated type:format pairs. Let's keep it simple instead.
- Mention that -f can be supplied multiple times.
- Add -f to other entries in the synopsis where it can be used.

MFC after:	2 weeks
2022-03-29 19:32:32 +02:00
Mateusz Piotrowski
efb4f7fd09 ifconfig.8: Document the synopsis of -C
As documented, the -C flag can only be used on its own. Any other
command modifiers and flags are ignored when -C is used. Reflect that in
synopsis.

MFC after:	2 weeks
2022-03-29 19:16:07 +02:00
Mateusz Piotrowski
a9475cb389 ifconfig.8: Show that -g groupname can be used on its own
MFC after:	2 weeks
2022-03-29 19:14:20 +02:00
Mateusz Piotrowski
2e053399fc ifconfig.8: Cluster together short flags
MFC after:	2 weeks
2022-03-29 19:12:50 +02:00
Mateusz Piotrowski
d1d14f0428 ifconfig.8: Simplify -G & -g synopsis
MFC after:	1 week
2022-03-29 18:53:10 +02:00
Mateusz Piotrowski
075999d3f1 Cross-reference nextboot(8) and freebsd-update(8)
MFC after:	1 week
2022-03-29 15:15:35 +02:00
Mateusz Piotrowski
05621e0b20 ifconfig.8: Add capability codes descriptions from handbook
We document capability codes (the CAPS field of "ifconfig wlan0 scan")
in both ifconfig(8) and the handbook. The list is more complete in the
manual page, while the descriptions of individual capabilities are more
detailed in the handbook.

In order to reduce content duplication and bit rot, let's move
handbook's details to the manual page and reference the manual page
whenever necessary.

Reviewed by:	debdrup
Reviewed by:	Pau Amma
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D34662
2022-03-29 13:12:32 +02:00
Gordon Bergling
90ea9c0dcd camcontrol(8): Fix typo in a source code comment
- s/querried/queried/

MFC after:	3 days
2022-03-28 19:36:01 +02:00
Gordon Bergling
2fa6223aaa pfctl(8): Fix a typo in a comment
- s/steping/stepping/

MFC after:	3 days
2022-03-28 19:35:55 +02:00
Gordon Bergling
c09770b2cd mount(8): Fix a typo in source code comments
- s/filesytem/filesystem/

MFC after:	3 days
2022-03-28 19:35:02 +02:00
Gordon Bergling
407a0eac79 geom(4): Fix a typo in a source code comment
- s/comand/command/

MFC after:	3 days
2022-03-28 19:28:08 +02:00
Warner Losh
dea368bc5e devd: Add rtw to wireless list
rtw88 and rtw89 are coming soon, so add them here now

Sponsored by:		Netflix
MFC After:		1 day
2022-03-28 08:16:14 -06:00
Kristof Provost
3468cd95ca pf: ether l3 rules can only use addresses
Disallow the use of tables in ethernet rules. Using tables requires
taking the PF_RULES lock. Moreover, the current table code isn't ready
to deal with ethernet rules.

Disallow their use for now.

Sponsored by:	Rubicon Communications, LLC ("Netgate")
2022-03-25 11:13:47 +01:00
Colin Percival
1dee7c74d1 sysctl(8): Mention CTLFLAG_SKIP
`sysctl -a` does not print values with this flag.

Reviewed by:	debdrup
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D34615
2022-03-20 11:30:43 -07:00
Robert Wing
8772a9117b mount.8: mention that the snapshot option is exclusive
When using the snapshot option, all other options are ignored. This
update reflects changes made in ab2dbd9b87.

Reviewed by:	0mp, mckusick
Differential Revision:	https://reviews.freebsd.org/D34584
2022-03-17 14:33:03 -08:00
Kristof Provost
a632d9e360 pfctl: fix retrieving nested nat-anchors
When retrieving nat rules in anchors we need to set the path just like
we do for regular rules.

MFC after:	1 week
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2022-03-17 22:37:06 +01:00
Matteo Riondato
cd8438e5a3 pfctl: fix retrieving nested anchors
PR:		262622
MFC after:	1 week
Reviewed by:	kp
2022-03-17 22:37:05 +01:00
Mateusz Piotrowski
fd06117525 *: Do not use the no-op -r flag for bsdlabel(8)
The -r flag is ignored by the FreeBSD implementation of bsdlabel(8)
(also called disklabel(8) in the past). Remove its use from examples
and tests in the tree.

This commit does not touch historical documentation under share/doc/smm
and files under contrib/netbsd-tests.

Reviewed by:	imp
MFC after:	2 weeks
Approved by:	imp (src)
Fixes:		57dfbec57b More axe-work:
Differential Revision:	https://reviews.freebsd.org/D34585
2022-03-17 17:28:07 +01:00
Kirk McKusick
2983ec0a87 Ensure that fsck(8) / fsck_ffs(8) produces the correct exit code
for missing devices.

The fsck_ffs(8) utility uses its internal function openfilesys()
when opening a disk to be checked. This change avoids the use
of pfatal() in openfilesys() which always exits with failure (exit
value 8) so that the caller can choose the correct exit value.
In the case of a non-existent device it should exit with value 3
which allows the startup system to wait for drives (such as those
attached by USB) to come online.

Reported by: karels
Tested by:   karels
PR:          262580
MFC after:   3 days
2022-03-16 11:37:15 -07:00
Ed Maste
2b20327ec9 dumpon: proceed without compression if the kernel lacks support
PR:		252554
Reviewed by:	markj
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D34520
2022-03-16 12:08:28 -04:00
Kristof Provost
8a42005d1e pf: support basic L3 filtering in the Ethernet rules
Allow filtering based on the source or destination IP/IPv6 address in
the Ethernet layer rules.

Reviewed by:	pauamma_gundo.com (man), debdrup (man)
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D34482
2022-03-14 22:42:37 +01:00
Hans Petter Selasky
d5ad1713cc Chase mixer(8) command-line interface changes
Some more nits regarding mute feature.

Differential revision:	https://reviews.freebsd.org/D34545
Sponsored by:		NVIDIA Networking
2022-03-14 09:38:04 +01:00
Mateusz Piotrowski
e83a53abeb Chase mixer(8) command-line interface changes
FreeBSD 14.0 is going to ship with a new implementation of the mixer(8)
command. Unfortunately, in order to support new features like mute, the
command-line interface of the new implementation is not backwards
compatible.

Update all the remaining documentation and scripts in the src tree
to use the new syntax.

While here, document in usbhidaction.1 that the mute functionality is
now supported.

Reviewed by:	christos, debdrup, hselasky
Approved by:	hselasky (src)
Fixes:	903873ce15 Implement and use new mixer(3) library for FreeBSD.
Differential Revision:	https://reviews.freebsd.org/D34545
2022-03-13 17:43:49 +01:00
Alexander Motin
7f16b501e2 GEOM: Introduce partial confxml API
Traditionally the GEOM's primary channel of information from kernel to
user-space was confxml, fetched by libgeom through kern.geom.confxml
sysctl.  It is convenient and informative, representing full state of
GEOM in a single XML document.  But problems start to arise on systems
with hundreds of disks, where the full confxml size reaches many
megabytes, taking significant time to first write it and then parse.

This patch introduces alternative solution, allowing to fetch much
smaller XML document, subset of the full confxml, limited to 64KB and
representing only one specified geom and optionally its parents.  It
uses existing GEOM control interface, extended with new "getxml" verb.
In case of any error, such as the buffer overflow, it just transparently
falls back to traditional full confxml.  This patch uses the new API in
user-space GEOM tools where it is possible.

Reviewed by:	imp
MFC after:	2 month
Sponsored by:	iXsystems, Inc.
Differential Revision:	https://reviews.freebsd.org/D34529
2022-03-12 11:55:52 -05:00
Wuyang Chung
c5f549c1e0 newfs(8): Fix a bug in initialization of sblock.fs_maxbsize .
Fixes:		1c85e6a35d (SVN r98542)
Pull Request:	https://github.com/freebsd/freebsd-src/pull/587
MFC after:	1 week
Sponsored by:	NVIDIA Networking
2022-03-11 10:17:06 +01:00
Alexander Motin
5678114cd8 geom: Allow "load" command for already loaded modules.
I see more user-friendly to do nothing if the module is already
loaded, rather than returning quite confusing error message.

As side effect it allows to avoid std_list_available() call, using
quite expensive on large systems geom_gettree().

MFC after:	1 month
2022-03-08 12:13:51 -05:00
Kristof Provost
c4e49c3a65 pfctl: remove unused variable
MFC after:	1 week
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2022-03-08 13:57:46 +01:00
Kristof Provost
8c1400b0a1 libpfct: factor out pfctl_get_rules_info()
Introduce pfctl_get_rules_info(), similar to pfctl_get_eth_rules_info()
to retrieve rules information (ticket and total number of rules).

Use the new function in pfctl.

MFC after:	1 week
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D34443
2022-03-08 13:57:45 +01:00
Kristof Provost
f0c334e4de libpfctl: support flushing rules/nat/eth
Move the code to flush regular rules, nat rules and Ethernet rules into
libpfctl for easier re-use.

MFC after:	1 week
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D34442
2022-03-08 13:57:45 +01:00
Kristof Provost
a20773c810 pfctl: support recursive printing of nat rules
PR:		252617
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D34455
2022-03-08 10:51:09 +01:00
Alexander Motin
2117cdd4b4 GEOM: Introduce gctl_add_param() API.
Make gctl_add_param() API public, allowing more precise control over
parameter flags.  Previously it was impossible to properly declare
write-only ASCII parameters, used for result reporting, they were
declared as read-write binary instead, that was not nice.

MFC after:	1 month
2022-03-07 11:12:25 -05:00
Kristof Provost
5bed7d2fa1 pfctl.8: Use the serial comma
Pointed out by:	Pau Amma.
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2022-03-03 18:32:27 +01:00
Cy Schubert
93c1048a13 ipfilter: Reliably print the interface name
When printing the interface name from the ipstate_t struct the interface
name in is_ifp may not always be avaiable when reading it from kmem
(tested on FreeBSD and NetBSD). However the is_ifname (the interface
name character string) is almost always available -- it is not available
when the source of the packet is a process running on the firewall
itself. Rather than print both interface name strings, print only the
one.

MFC after:	1 week
2022-03-03 06:43:12 -08:00
Cy Schubert
ec793543fe ipfilter: Obtain the interface name more efficiently
Rather than use a kmem read to determine the interface name used by a
nat_t structure through a pointer, nat_ipfs->netif->if_xname, obtain it
directly from nat_ifnames in the nat_t structure itself using the new
FORMAT_IF macro.

MFC after:	1 week
2022-03-03 06:43:11 -08:00
Cy Schubert
915395a280 ipfilter: Introduce the new FORMAT_IF macro
Interface names stored in the ipstate_t and ipnat_t structures can be
NULL. This occurs when an application, such as named, is running on the
firewall machine itself. For example an application, i.e. named, running
on the firewall itself will cause a state table display and NAT mapping
display to show a null ingress interface and its egress interface. This
is perfectly valid but confusing to human eyes. Rather than print
nothing, print "(null)".

MFC after:	1 week
2022-03-03 06:43:11 -08:00
Kristof Provost
e5349a2909 pfctl tests: Ethernet rule parsing tests
A few basic test cases for Ethernet rule parsing.

Sponsored by:	Rubicon Communications, LLC ("Netgate")
2022-03-02 17:00:08 +01:00
Kristof Provost
c32cd18055 pfctl: print ethernet rules when called with '-n'
Just as pfctl already does for other rules we print the ethernet rules
we would have loaded if '-n' is specified.

Sponsored by:	Rubicon Communications, LLC ("Netgate")
2022-03-02 17:00:08 +01:00
Kristof Provost
b590f17a11 pf: support masking mac addresses
When filtering Ethernet packets allow rules to specify a mac address
with a mask. This indicates which bits of the specified address are
significant. This allows users to do things like filter based on device
manufacturer.

Sponsored by:	Rubicon Communications, LLC ("Netgate")
2022-03-02 17:00:08 +01:00
Kristof Provost
6ea1c3cfc8 pfctl: support flushing ethernet rules
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2022-03-02 17:00:07 +01:00
Kristof Provost
c5131afee3 pf: add anchor support for ether rules
Support anchors in ether rules.

Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D32482
2022-03-02 17:00:07 +01:00
Kristof Provost
87a89d6e14 pfctl: support lists of mac addresses
Teach the 'ether' rules to accept { mac1, mac2, ... } lists, similar to
the lists of interfaces or IP addresses we already supported for layer 3
filtering.

Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D32481
2022-03-02 17:00:07 +01:00
Kristof Provost
fb330f3931 pf: support dummynet on L2 rules
Allow packets to be tagged with dummynet information. Note that we do
not apply dummynet shaping on the L2 traffic, but instead mark it for
dummynet processing in the L3 code. This is the same approach as we take
for ALTQ.

Sponsored by:   Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D32222
2022-03-02 17:00:06 +01:00
Kristof Provost
77207b6022 pfctl: Document displaying Ethernet rules
Document the new 'pfctl -s ether' functionality.

Reviewed by:	bcr
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D31750
2022-03-02 17:00:06 +01:00
Kristof Provost
c696d5c72f pfctl: Don't print (ether) to / from if they're not set
If we're not filtering on a specific MAC address don't print it at all,
rather than showing an all-zero address.

Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D31749
2022-03-02 17:00:05 +01:00
Kristof Provost
30087aa2e0 pf: Support clearing ether counters
Allow the evaluations/packets/bytes counters on Ethernet rules to be
cleared.

Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D31748
2022-03-02 17:00:05 +01:00
Kristof Provost
2b29ceb86f pfctl: Print Ethernet rules
Extent pfctl to be able to read configured Ethernet filtering rules from
the kernel and print them.

Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D31738
2022-03-02 17:00:03 +01:00
Kirk McKusick
c7996ddf80 Create a new GEOM utility, gunion(8).
The gunion(8) utility is used to track changes to a read-only disk on
a writable disk. Logically, a writable disk is placed over a read-only
disk. Write requests are intercepted and stored on the writable
disk. Read requests are first checked to see if they have been
written on the top (writable disk) and if found are returned. If
they have not been written on the top disk, then they are read from
the lower disk.

The gunion(8) utility can be especially useful if you have a large
disk with a corrupted filesystem that you are unsure of how to
repair. You can use gunion(8) to place another disk over the corrupted
disk and then attempt to repair the filesystem. If the repair fails,
you can revert all the changes in the upper disk and be back to the
unchanged state of the lower disk thus allowing you to try another
approach to repairing it. If the repair is successful you can commit
all the writes recorded on the top disk to the lower disk.

Another use of the gunion(8) utility is to try out upgrades to your
system. Place the upper disk over the disk holding your filesystem
that is to be upgraded and then run the upgrade on it. If it works,
commit it; if it fails, revert the upgrade.

Further details can be found in the gunion(8) manual page.

Reviewed by: Chuck Silvers, kib (earlier version)
tested by:   Peter Holm
Differential Revision: https://reviews.freebsd.org/D32697
2022-02-28 16:36:08 -08:00
Cy Schubert
9291d079d5 ipfilter: Print protocol when listing NAT table mappings
NAT table mappings list only the source and destination IP, the source
and destinaion port numbers, and their mappings. But the protocol is not
listed. Now that Facebook and Google use QUIC, seeing port 443 in in a
list of active NAT sessions could mean 443/tcp or 443/udp. This patch
adds the protocol to the listing to aid in determining whether HTTPS is
TCP or QUIC in a NAT mapping listing. This also helps differentiatinete
between other protocols such as ICMP, ESP, and AH in ipnat list of active
sessions.

MFC after:	1 week
2022-02-28 12:11:39 -08:00
Kirk McKusick
c5d476c98c Update fsdb(8) to reflect new structure of fsck_ffs(8).
The cleanup of fsck_ffs(8) in commit c0bfa109b9 broke fsdb(8).
This commit adds the one-line update needed in fsdb(8) to make it
work with the new fsck_ffs(8) structure.

Reported by: Chuck Silvers
Tested by:   Chuck Silvers
MFC after:   3 days
2022-02-23 15:40:58 -08:00
Warner Losh
78fbaa1fac camcontrol fwdownload minor improvements
Minor improvements to the fwdownload code suggested by chs@:
o Print the path_id/target we're rescanning so it's not invisible
o No need for XPT_GDEVLIST, all the info is filled in. Remove sending it
  as well as a comment related to it from a mistaken observation. libcam
  always fills these in properly, so use those for the ccb path/target.
o Don't leak /dev/xpt fd in success cases.
o Rename fw_rescan_lun to fw_rescan_target and pass sim_mode to
  only print path_id and target_id info.

Reviewed by:		chs@
Fixes:			9835900cb9
Sponsored by:		Netflix
MFC After:		1 week
Differential Revision:	https://reviews.freebsd.org/D34348
2022-02-22 14:38:38 -07:00
Warner Losh
9835900cb9 camcontrol: Force a rescan of the lun after firmware download.
After downloading the firmware to a device, it's inquiry data likely
will change. Force a rescan of the target with the CAM_EXPECT_INQ_CHANGE
flag to get it to record the new inqury data as being expected. This
avoids the need for a 'camcontrol rescan' on the device which detaches
and re-attaches the disk (da, ada) device. This brings fwdownload up to
nvmecontrol's ability to do the same thing w/o changing the exposed
nvme/nvd/nda device. We scan the target and not the LUN because dual
actuator drives have multiple LUNs, but the firmware is global across
many vendors' drives (and the so far theoretical ones that aren't won't
be harmed by the rescan).

Since the underlying struct disk is now preserved accross this
operation, it's now possible to upgrade firmware of a root device w/o
crashing the system.  On systems that are quite busy, the worst that
happens is that certain operaions are reported cancelled when the new
firmware is activated. These operations are retried with the normal CAM
recovery mechanisms and will work on the retry. The only visible hiccup
is the time that new firmware is flashing / initializing. One should not
consider this operation completely risk free, however, since not all
drives are well behaved after a firmware download.

MFC After:		1 week
Relnotes:		yes
Sponsored by:		Netflix
Feedback by:		mav
Differential Revision:	https://reviews.freebsd.org/D34325
2022-02-22 10:43:26 -07:00
Mitchell Horne
de08b5167b init(8): use proper boolean type for globals
Now that stdbool.h is included, prefer this. No functional change
intended.
2022-02-21 20:16:13 -04:00
Mitchell Horne
7b0a665d72 boottrace: annotate init and shutdown utilities
Add boottrace annotations to record events in init(8), shutdown(8), and
reboot(8).

Sponsored by:	NetApp, Inc.
Sponsored by:	Klara, Inc.
X-NetApp-PR:	#23
Differential Revision:	https://reviews.freebsd.org/D31928
2022-02-21 20:16:07 -04:00
Chuck Tuffli
c2318cf80a nvme: fix spelling of Namespace
Fix spelling of a macro definition.

Reviewed by:	mav, imp
Differential Revision:	https://reviews.freebsd.org/D34330
2022-02-21 10:34:46 -08:00
Kirk McKusick
7a1c1f6a03 Avoid unaligned writes by fsck_ffs(8).
Normally fsck_ffs never does reads or writes that are not aligned
to the size of one of the checked filesystems fragments. The one
exception is when it finds that it needs to write the superblock
recovery information. Here it will write with the alignment reported
by the underlying disk as its sector size as reported by an
ioctl(diskfd, DIOCGSECTORSIZE, &secsize).

Modern disks have a sector size of 4096, but for backward compatibility
with older disks will report that they have a sector size of 512.
When presented with a 512 byte write, they have to read the associated
4096 byte sector, replace the 512 bytes to be written, and write
the updated 4096 byte sector back to the disk. Unfortunately, some
disks report that they have 512 sectors, but fail writes that are not
aligned to 4096 boundaries and are a multiple of 4096 bytes in size.

This commit updates fsck_ffs(8) so that it uses the filesystem fragment
size as the smallest size and alignment for doing writes rather than
the disk's reported sector size.

Reported by:  Andriy Gapon
MFC after:    1 week
2022-02-20 13:21:12 -08:00
Eric van Gyzen
4e71258227 newfs_msdos: connect the ATF test from NetBSD
NetBSD has an ATF test for newfs_msdos.  Connect it to the build.
Adapt it for FreeBSD.  This would have caught the bug fixed by my
previous commit.

Reviewed by:	delphij, emaste
MFC after:	1 week
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D34116
2022-02-16 09:56:16 -06:00
Eric van Gyzen
9990450e17 newfs_msdos: fix type of kern.maxphys
The type of the kern.maxphys sysctl OID is now ulong.  Change the
local variable type to match.

Reviewed by:	delphij, emaste
MFC after:	1 week
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D34116
2022-02-16 09:56:16 -06:00
Simon J. Gerraty
a8189e9bd4 veriexec(8): explain that only a unique prefix is required
When setting or querying state it is sufficient to
provide only enough of the state name to be unambiguous.
2022-02-14 13:54:22 -08:00
Franco Fichtner
abf5bff71d dhclient: support VID 0 (no vlan) decapsulation
VLAN ID 0 is supposed to be interpreted as having no VLAN with a bit of
priority on the side, but the kernel is not able to decapsulate this on
the fly so dhclient needs to take care of it.

Reviewed by:	markj
MFC after:	3 weeks
Differential Revision:	https://reviews.freebsd.org/D31515
2022-02-14 10:06:47 -05:00
Gleb Smirnoff
c999e3481d dmesg: detect wrapped msgbuf on the kernel side and if so, skip first line
Since 59f256ec35 dmesg(8) will always skip first line of the message
buffer, cause it might be incomplete.  The problem is that in most cases
it is complete, valid and contains the "---<<BOOT>>---" marker.  This
skip can be disabled with '-a', but that would also unhide all non-kernel
messages.  Move this functionality from dmesg(8) to kernel, since kernel
actually knows if wrap has happened or not.

The main motivation for the change is not actually the value of the
"---<<BOOT>>---" marker.  The problem breaks unit tests, that clear
message buffer, perform a test and then check the message buffer for
a result.  Example of such test is sys/kern/sonewconn_overflow.
2022-02-05 13:35:31 -08:00
Wolfram Schneider
179a53bb91 update external URL 2022-02-05 17:14:27 +00:00
Wolfram Schneider
83e6667726 update external URL 2022-02-05 17:11:18 +00:00
Wolfram Schneider
c918f50f8b update external URL 2022-02-05 17:09:48 +00:00
Wolfram Schneider
6981ec8bdf update external URLs 2022-02-05 08:19:56 +00:00
Kirk McKusick
9583be047b Properly fix parameter to sysctlnametomib(). 2022-02-04 14:04:12 -08:00
Kirk McKusick
504cb544e2 Fix parameter to sysctlnametomib(); 2022-02-04 14:00:38 -08:00
Kirk McKusick
c0bfa109b9 Have fsck_ffs(8) properly correct superblock check-hash failures.
Part of the problem was that fsck_ffs would read the superblock
multiple times complaining and repairing the superblock check hash
each time and then at the end failing to write out the superblock
with the corrected check hash. This fix reads the superblock just
once and if the check hash is corrected ensures that the fixed
superblock gets written.

Tested by:    Peter Holm
PR:           245916
MFC after:    1 week
Sponsored by: Netflix
2022-02-04 11:47:48 -08:00
John Baldwin
6c9ed42828 ggatec: Use ANSI C definition for init_initial_buffer_size.
This fixes -Wstrict-prototypes and -Wold-style-definition warnings
from GCC 9.
2022-01-31 17:12:04 -08:00
Alexander V. Chernikov
656f5031c3 ifconfig: remove debug printf introduced in 779fd05344
Reported by:	jhb
2022-01-29 11:19:01 +00:00
Kristof Provost
735748f30a libpfctl: fix creatorid endianness
We provide the hostid (which is the state creatorid) to the kernel as a
big endian number (see pfctl/pfctl.c pfctl_set_hostid()), so convert it
back to system endianness when we get it from the kernel.

This avoids a confusing mismatch between the value the user configures
and the value displayed in the state.

MFC after:	3 weeks
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D33989
2022-01-27 09:07:27 +01:00
Kristof Provost
e68de66943 pfctl: improve error reporting for routehost
If an invalid (i.e. overly long) interface name is specified error out
immediately, rather than in expand_rule() so we point at the incorrect
line.

PR:		260958
MFC after:	3 weeks
Differential Revision:	https://reviews.freebsd.org/D34008
2022-01-27 07:36:26 +01:00
Alexander V. Chernikov
779fd05344 ifconfig: improve vlan options parsing
PR:	261136
Reported by:	Daniel O'Connor
MFC after:	2 weeks
2022-01-17 09:35:15 +00:00
Li-Wen Hsu
6853ef66f1
fsck(8): Fix typo
PR:		260949
Reported by:	Graham Perrin <grahamperrin@gmail.com>
MFC after:	3 days
2022-01-12 13:52:23 +08:00
Rick Macklem
08a8d16cbb mount_nfs: Add a "bgnow" NFS mount option
The "bg" option does not go background until the initial mount
attempt fails, which can take 60+ seconds.

This new "bgnow" option goes background immediately, avoiding
the 60+ second delay, if the NFS server is not yet available.

The man page update is a content change.

Tested by:	jwb
Reviewed by:	debdrup, emaste
PR:		260764
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D33733
2022-01-11 08:21:35 -08:00
Andriy Gapon
75bc7150f4 add and use defintions for ATA power modes
Those can be returned by CHECK POWER MODE command (0xe5).
Note that some of the definitions duplicate definitions for Extended
Power Conditions.

MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D33646
2022-01-11 15:41:38 +02:00
Warner Losh
e0ab0ff104 devd: correct wifi regexp
Correct the wifi regexp to include iwlwifi and remove wi driver that was
has been retired.

Sponsored by:		Netflix
2022-01-09 10:16:31 -07:00
Warner Losh
926e825ef8 devd: remove the scsi regexp
We don't really use the scsi regexp for anything. The rescan was a
workaround that was fixed a long time ago and has been disabled for
ages. And the regexp was incomplete.

Sponsored by:		Netflix
2022-01-09 10:13:58 -07:00
Konstantin Belousov
fcbb1441d0 ldconfig: remove two symbols
_PATH_LD32_HINTS is unused because it is a.out remnant.
_PATH_ELF32_HINTS is provided by rtld_paths.h already.

Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2022-01-08 12:45:46 +02:00
Cy Schubert
08ab34a06a ipfilter: Restore ipfsync
ipfsync is a WIP sync daemon designed to be used in a failover scenario.
It was removed by 5ee61c7daa. This commit
restores its three files. ipfsync is in my work queue.

MFC after:	10 days
X-MFC with:	5ee61c7daa
2022-01-07 21:46:53 -08:00
Warner Losh
8b7cc20f79 ldconfig: remove libsoft support
Remove support for -soft and its implementation. This arg was never
documented, so no need to remove it from the man page.

Sponsored by:		Netflix
2022-01-06 22:44:07 -07:00
Ed Maste
f567fcb2ff route: remove write-only struct hostent from getaddr()
Under some INET/INET6 src.conf configurations sbin/route previously
failed to build due to an unused variable warning.  It was functionally
write-only anyway, so just remove it.

Reported by:	melifaro
Reviewed by:	melifaro
MFC after:	3 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D33717
2022-01-06 10:45:44 -05:00
Kirk McKusick
c82df0a0bf Whitespace and capitalization cleanups.
No changes intended.

Sponsored by: Netflix
2022-01-05 16:32:48 -08:00
Stefan Eßer
ac413189f5 vfslist.c: initialize skipvfs variable
The function makevfslist is only called once in mount.c, but should
be save to be called more than once with different parameters.

The bin/df command links against this file, and will need this
possibility to allow -l and -t to be used together.

MFC after:	3 days
2022-01-05 23:00:36 +01:00
Cy Schubert
ad07e93fe1 ipfilter: Fix manpage typos
Reported by:	jrtc27
Fixes:		2582ae5740
MFC after:	1 month
2022-01-04 07:11:00 -08:00
Cy Schubert
cc3e5b372e ipfilter userland: Fix typos
Reported by:	netchild
Fixes:		2582ae5740
MFC after:	1 month
2022-01-04 03:08:51 -08:00
Cy Schubert
a3522837b0 ipfilter userland: Fix branch mismerge
The work to ANSIfy and adjust returns to style(9) resulted in a mismerge
of a stash when ipfilter was moved from contrib to sbin. An older file
replaced WIP at the time, resulting in a regression.

The majority of this work was done in 2018 saved as git stashes within
a git-svn tree and migrated to the git tree. The regression occurred
when the various stashes were sequentially merged to create individual
commits, following the ipfilter move to netpfil and sbin.

Reported by:	jrtc27
Fixes:		2582ae5740
Pointy hat to:	cy
MFC after:	1 month
2022-01-03 19:39:24 -08:00
Cy Schubert
44bc301921 ipfilter userland: Style(9) requires a space after return
Reported by:    jrtc27
Fixes:          2582ae5740
MFC after:      1 month
2022-01-03 19:37:25 -08:00
Cy Schubert
d86f022e79 ipfilter: Fix typos
Reported by:	jrtc27
Fixes:		2582ae5740
MFC after:	1 month
2022-01-03 18:45:10 -08:00
Cy Schubert
5e13b104a4 ipfilter userland: Fix whitespace errors
Replace leading spaces with a tabs on affected lines.

MFC after:	1 month
2022-01-03 18:06:44 -08:00
Cy Schubert
27fc223414 ipfilter userland: Remove trailing whitespace
MFC after:	1 month
2022-01-03 18:06:44 -08:00
Cy Schubert
2582ae5740 ipfilter: Adjust userland returns to conform to style(9)
Adjust ipfilter's userland return statements to conform to style(9).

MFC after:	1 month
2022-01-03 18:06:43 -08:00
Cy Schubert
9be9c1c084 ipfilter: INLINE --> inline
Replace the INLINE macro with inline. Some ancient compilers supported
__inline__ instead of inline. The INLINE hack compensated for it.
Ancient compilers are history.

Reported by:	glebius
MFC after:	1 month
2022-01-03 18:06:42 -08:00
Cy Schubert
efeb8bffe3 ipflter: ANSIfy userland function declarations
Convert ipfilter userland function declarations from K&R to ANSI. This
syncs our function declarations with NetBSD hg commit 75edcd7552a0
(apply our changes). Though not copied from NetBSD, this change was
partially inspired by NetBSD's work and inspired by style(9).

Reviewed by:		glebius (for #network)
MFC after:		1 month
Differential Revision:	https://reviews.freebsd.org/D33595
2022-01-03 18:06:42 -08:00
Kristof Provost
9d406e088e dnctl: Support reading config from file like ipfw(8)
Extend the dnctl (dummynet config) tool to be able to read commands from
a file, just like ipfw already does.

Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D33627
2022-01-03 09:50:18 +01:00
Alan Somers
6226477a46 Various fixes for ggatec and ggated
Dynamically size buffers in ggatec. Instead of static size on the stack.
Add flush support.

Submitted by:	Johannes Totz <jo@bruelltuete.com>
MFC after:	2 weeks
Reviewed by:	asomers
Differential Revision: https://reviews.freebsd.org/D31722
2022-01-02 17:53:55 -07:00
Jessica Clarke
5b13fa7987 ufs: Rework shortlink handling to avoid subobject overflows
Shortlinks occupy the space of both di_db and di_ib when used. However,
everywhere that wants to read or write a shortlink takes a pointer do
di_db and promptly runs off the end of it into di_ib. This is fine on
most architectures, if a little dodgy. However, on CHERI, the compiler
can optionally restrict the bounds on pointers to subobjects to just
that subobject, in order to mitigate intra-object buffer overflows, and
this is enabled in CheriBSD's pure-capability kernels.

Instead, clean this up by inserting a union such that a new di_shortlink
can be added with the right size and element type, avoiding the need to
cast and allowing the use of the DIP macro to access the field. This
also mirrors how the ext2fs code implements extents support, with the
exact same structure other than having a uint32_t i_data[] instead of a
char di_shortlink[].

Reviewed by:	mckusick, jhb
Differential Revision:	https://reviews.freebsd.org/D33650
2022-01-02 20:55:36 +00:00
Ed Maste
c217390359 route: use NULL for null ptr in getaddr call, not 0
Style(9) prefers NULL.

Sponsored by:	The FreeBSD Foundation
2022-01-01 12:02:17 -05:00
Cy Schubert
d740faa30a ipfilter userland: Revert the ipmon part of a6fb9bbea7
a6fb9bbea7 caused incorrect formatting of ipmon log output.

Fixes:		a6fb9bbea7
MFC after:	immediately
2021-12-27 01:10:52 -08:00
Cy Schubert
7cb2d7c413 ipfilter userland: Path fixup no longer required
Since the move of ipfilter from contrib to sbin adjusting the source path
is no longer required.

Fixes:		41edb306f0
MFC after:	1 month
2021-12-27 00:40:18 -08:00
Emmanuel Vadot
93c4369096 pkgbase: Put more binaries/lib in runtime
Move some needed binaries/libs from FreeBSD-utilities to FreeBSD_runtime.
This is everything needed to boot to multiuser with FreeBSD-rc installed.

MFC after:	2 weeks
Sponsored by:	Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D33435
2021-12-21 10:17:27 +01:00
Emmanuel Vadot
0855e37c72 pkgbase: Put sconfig in FreeBSD-utilities
There is no need to have it in runtime as it's not essential.

MFC after:	2 weeks
Sponsored by:	Beckhoff Automation GmbH & Co. KG
2021-12-21 10:16:08 +01:00
Emmanuel Vadot
9e94953e66 Revert "amd64: Do not build sconfig"
This reverts commit a46856c3f9.

Requested by:	glebius
2021-12-21 10:14:45 +01:00
Cy Schubert
41edb306f0 ipfilter: Move userland bits to sbin
Through fixes and improvements our ipfilter sources have diverged
enough to warrant move from contrib into sbin/ipf. Now that I'm
planning on implementing MSS clamping as in iptables it makes more
sense to move ipfilter to sbin.

This is the second of three commits of the ipfilter move.

Suggested by glebius on two occaions.

Suggested by and discussed with:	glebius
Reviewed by:				glebius, kp (for #network)
MFC after:				1 month
Differential Revision:		https://reviews.freebsd.org/D33510
2021-12-20 06:16:33 -08:00
Cy Schubert
3b9b51fe46 ipfilter: Move kernel bits to netpfil
Through fixes and improvements our ipfilter sources have diverged
enough to warrant move from contrib into sys/netpil. Now that I'm
planning on implementing MSS clamping as in iptables it makes more
sense to move ipfilter to netpfil.

This is the first of three commits the ipfilter move.

Suggested by glebius on two occaions.

Suggested by and discussed with:	glebius
Reviewed by:				glebius, kp (for #network)
MFC after:				1 month
Differential Revision:		https://reviews.freebsd.org/D33510
2021-12-20 06:16:33 -08:00
Warner Losh
7090cba410 fsutil: forward declare struct fstab
Fix the build by forward declaring struct fstab.

Sponsored by:		Netflix
2021-12-15 19:38:28 -07:00
Kirk McKusick
c72372c693 Update fsck(8) to ignore failures from a check program for a filesystem
when the fstab(5) entry for the filesystem has the "failok" attribute.

Reviewed by:  kib
PR:           246201
MFC after:    2 weeks
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D33424
2021-12-15 16:53:46 -08:00
Warner Losh
c6b2efb64e route(8): Remove obsolete information
xns and osi are no longer relevant (or supported) so remove their
vestiges.

Noticed by:	phk
Sponsored by:	Netflix
2021-12-15 16:07:35 -07:00
Emmanuel Vadot
a46856c3f9 amd64: Do not build sconfig
We do not build the drivers for this arch so no need to build the
configuration tools.

MFC after:	2 weeks
Sponsored by:	Beckhoff Automation GmbH & Co. KG
2021-12-15 17:39:36 +01:00
Konstantin Belousov
b49b6e0f95 swapon(8): adapt to the new swapoff(2) interface
also fix test sys/audit/administrative.c.

Reviewed by:	brooks
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D33343
2021-12-09 02:48:59 +02:00
Kyle Evans
ace38c58fb savecore: emit information about saved cores under verbose
Declare how many cores we saved, and where we saved them to.  Drop a
comment about emitting little information; it's obvious from the block
in question that we emit nothing without verbose.

Reviewed by:	markj
Sponsored by:	NetApp, Inc.
Sponsored by:	Klara, Inc.
X-NetApp-PR:	#65
Differential Revision:	https://reviews.freebsd.org/D31393
2021-12-07 18:39:34 -06:00
Hans Petter Selasky
83237efcdb kldstat(8): style(9) fixes.
No functional change intended.

Differential revision:  https://reviews.freebsd.org/D32506
Submitted by:   christos@
MFC after:      1 week
Sponsored by:   NVIDIA Networking
2021-12-07 11:40:22 +01:00
Kristof Provost
73fd0eaf59 pfsync: fix incorrect enabling of defer mode
When we exposed the PFSYNCF_OK flag to userspace in 5f5bf88949 we
unintentionally caused defer mode to always be enabled.
The ioctl check only looked for nonzero, not for the PFSYNCF_DEFER flag.

Fix this check and ensure ifconfig sets the flag.

Reviewed by:	glebius
MFC after:	1 week
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D33244
2021-12-06 13:25:14 +01:00
Warner Losh
4de76195ce sysctl: Small style fix
Slightly reorder to make this look better. No functional change.

Sponsored by:		Netflix
2021-12-05 21:40:47 -07:00
Stefan Eßer
5e04571cf3 sys/bitset.h: reduce visibility of BIT_* macros
Add two underscore characters "__" to names of BIT_* and BITSET_*
macros to move them to the implementation name space and to prevent
a name space pollution due to BIT_* macros in 3rd party programs with
conflicting parameter signatures.

These prefixed macro names are used in kernel header files to define
macros in e.g. sched.h, sys/cpuset.h and sys/domainset.h.

If C programs are built with either -D_KERNEL (automatically passed
when building a kernel or kernel modules) or -D_WANT_FREENBSD_BITSET
(or this macros is defined in the source code before including the
bitset macros), then all macros are made visible with their previous
names, too. E.g., both __BIT_SET() and BIT_SET() are visible with
either of _KERNEL or _WANT_FREEBSD_BITSET defined.

The main reason for this change is that some 3rd party sources
including sched.h have been found to contain conflicting BIT_*
macros.

As a work-around, parts of shed.h have been made conditional and
depend on _WITH_CPU_SET_T being set when sched.h is included.
Ports that expect the full functionality provided by sched.h need
to be built with -D_WITH_CPU_SET_T. But this leads to conflicts if
BIT_* macros are defined in that program, too.

This patch set makes all of sched.h visible again without this
parameter being passed and without any name space pollution due
to BIT_* macros becoming visible when sched.h is included.

This patch set will be backported to the STABLE branches, but ports
will need to use -D_WITH_CPU_SET_T as long as there are supported
releases that do not contain these patches.

Reviewed by:	kib, markj
MFC after:	1 month
Relnotes:	yes
Differential Revision:	https://reviews.freebsd.org/D33235
2021-12-05 23:00:25 +01:00
Konstantin Belousov
1aa249c935 swapoff(8): add -f flag
to force swapout by ignoring the heuristic that calculates amount of
allocated memory against total of RAM plus remaining swap.

Reviewed by:	markj
Discussed with:	alc
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D33165
2021-12-05 00:20:58 +02:00
Ed Maste
a4ef9e58bc sbin: build ping if at least one of INET & INET6 is enabled
It does not build (and serves no purpose) if neither is true (i.e.,
building WITHOUT_INET and WITHOUT_INET6).  Also add an explicit error
in ping to make this case clear.

PR:		260082
Sponsored by:	The FreeBSD Foundation
2021-11-28 13:05:39 -05:00
Konstantin Belousov
3ede04c78c ldconfig(8): check for no-args command line after options are parsed
Default action for ldconfig is specified as -R AKA 'append', and for
no-args (without options changing default actions), ldconfig should
append empty list of directories to current list.  But because the check
was done before options were parsed out, presence of any option turned
off default rescan.

As result, innocently-looked commands like `ldconfig -v' were interpreted
as setting directory hints list to one specified on the command line,
i.e. empty.

Reported by:	https://github.com/mesonbuild/meson/issues/9592
Reviewed by:	emaste
Tested by:	jbeich
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D33058
2021-11-25 01:55:04 +02:00
Konstantin Belousov
af91158706 ldconfig: use libexec/rtld-elf/rtld_paths.h
instead of duplicating definitions using slighly different macro names.

Reviewed by:	emaste
Tested by:	jbeich
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D33058
2021-11-25 01:55:04 +02:00
Konstantin Belousov
b828161d12 ldconfig(8): nostd/-s does nothing
Remove the option from man page and summary.  Silently ignore it when
parsing command line for backward compatibility.

Reviewed by:	emaste
Tested by:	jbeich
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D33058
2021-11-25 01:55:03 +02:00
Konstantin Belousov
3f2c6f5598 ldconfig: start of cleanup
Use bool.
Use local variables instead of static.
Remove non-functional debugging override of hints file path.
Use explicit exit() instead of return from main.
Minor style tweaks.

Reviewed by:	emaste
Tested by:	jbeich
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D33058
2021-11-25 01:55:03 +02:00
Konstantin Belousov
83511ce5c4 ldconfig: remove a comment which is another remnant of a.out support
Noted and reviewed by:	emaste
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D33058
2021-11-25 01:55:03 +02:00
Mark Johnston
517373f723 natd: Remove uneeded in_cksum.h includes
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
2021-11-24 13:31:16 -05:00
Warner Losh
a8935083b5 devmatch: Allow devmatch_blocklist to be set in kenv too
Add in all the variables set in the kenv variable devmatch_blocklist
too. This allows blocking autoloading from the boot loader.

Sponsored by:		Netflix
Reviewed by:		0mp
Differential Revision:	https://reviews.freebsd.org/D32171
2021-11-21 08:54:45 -07:00
Kristof Provost
19dc644511 if_stf: add 6rd support
Implement IPv6 Rapid Deployment (RFC5969) on top of the existing 6to4
(RFC3056) if_stf code.

PR:		253328
Reviewed by:	hrs
Obtained from:	pfSense
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D33037
2021-11-20 19:29:01 +01:00
Ed Maste
3f9acedb02 growfs: do not error if filesystem is already requested size
For some cloud/virtualization use cases it can be convenient to grow the
filesystem on boot any time the disk/partition happens to be larger, but
not fail if it remains the same size.

Continue to emit a message if we have no action to take, but exit with
status 0 if the size remains the same.

Reviewed by:	trasz
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D32856
2021-11-15 15:40:57 -05:00
Kirk McKusick
e38717c128 Fix regression to verbose behavior introduced in 68bff4a07e.
Reported by:    Brad Davis (brd)
Reviewed by:    Kristof Provost (kp)
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D32736
Sponsored by:   Netflix
2021-11-11 12:11:25 -08:00
Hans Petter Selasky
ad8f078f66 ifconfig(8): Don't set network interface capabilities when there is no change.
A quick grep through the kernel code shows network drivers compute the
changed bits of network capabilities after a SIOCSIFCAP IOCTL(2) by
using the bitwise exclusive or operation. When the set capabilities
are equal to the already read capabilities, no action will be taken.

Let ifconfig(8) predict this case and skip the SIOCSIFCAP IOCTL(2)
system call.

Discussed with:	kib@ (revert change in case of issues)
MFC after:	1 week
Sponsored by:	NVIDIA Networking
2021-11-10 15:50:52 +01:00
Hans Petter Selasky
337c814316 kldstat(8): Fix indentation, whitespace to tabs.
No functional change intended.

Differential revision:  https://reviews.freebsd.org/D32502
Submitted by:   christos@
MFC after:      1 week
Sponsored by:   NVIDIA Networking
2021-11-09 22:12:19 +01:00
Mike Karels
d8237b9555 ifconfig: warn if setting an Internet address without mask
Add a postproc function for af_inet, and add interface flags as a
parameter.  Check there if setting an address without a mask unless
the interface is loopback or point-to-point, where mask is not really
meaningful; warn if so.  This will hopefully be an error in the future.

MFC after:	1 month
Reviewd by:	bz
Differential Revision: https://reviews.freebsd.org/D32709
2021-11-09 09:33:01 -06:00
Zhenlei Huang
55b0acc092 ifconfig.8: Add the missing option -vlanhwcsum
Commit 9b776960c3 documented a new option
vlanhwcsum but missed the opposite one -vlanhwcsum.

Reviewed by:	kp
Differential Revision:	https://reviews.freebsd.org/D32887
2021-11-08 11:12:43 +01:00
Andriy Gapon
c01a46d4ac camcontrol: dump received data for MMC command even if it is unknown
For example, EXT_CSD can be read like this:
    # camcontrol mmcsdcmd 2:0:0 -c 8 -a 0 -f 0x35 -l 512
    CMD 8 arg 0 flags 35
    MMCIO: error 0, 00000900 00000000 00000000 00000000
    No command-specific decoder for CMD 8
    0000   00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  |................|
    0010   39 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  |9...............|
    ...
    0100   00 00 00 00 00 00 00 00 01 08 00 01 02 02 00 00  |................|
    ...
    01e0   00 00 00 00 00 00 00 00 00 81 c7 00 00 01 03 07  |................|
    01f0   05 00 03 01 3f 3f 01 01 01 00 00 00 00 00 00 00  |....??..........|

MFC after:	2 weeks
2021-11-06 19:25:57 +02:00
Kristof Provost
76c5eecc34 pf: Introduce ridentifier
Allow users to set a number on rules which will be exposed as part of
the pflog header.
The intent behind this is to allow users to correlate rules across
updates (remember that pf rules continue to exist and match existing
states, even if they're removed from the active ruleset) and pflog.

Obtained from:	pfSense
MFC after:	3 weeks
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D32750
2021-11-05 09:39:56 +01:00
Xin LI
890cae1977 fsck_msdosfs: truncate directory entry when the head pointer is invalid.
As far as we know, there is no FAT implementation that supported hard
links, and our msdosfs driver assumed one cluster chain is only
referenced by one directory entry and clears it out when the file is
deleted.  On the other hand, the current code would proceed with
checkchain() when the directory entry's head cluster is a valid numbered
cluster without checking if it was a valid head node of a cluster chain.

So if the cluster do not being a chain (e.g. CLUST_FREE, CLUST_BAD),
or was already referenced by another directory entry, this would
trigger an assertion in check_chain() at a later time.

Fix this by giving the user an option to truncate the directory entry
when the head cluster is an invalid cluster, an visited head node,
or not a head node.

Reported by:	NetApp (kevans@)
Reviewed by:	kevans, emaste (no objection)
MFC after:	2 weeks
Differential Revision: https://reviews.freebsd.org/D32699
2021-11-03 22:09:32 -07:00
Warner Losh
80f21bb039 vt: fix git mismerge
I made a mistaking in merging the final commits for the devctl changes. This
adds the 'hushed' variable and has the correct dates for the manuals.

Pointy hat to: imp
2021-11-03 16:20:41 -06:00
Warner Losh
cc48eb70d1 vt: fix typo
Notifcation -> Notification
2021-11-03 16:12:55 -06:00
Warner Losh
4ac3d08a96 vt: Add devctl message for bells
Generate VT events when the bell beeps. When coupled with disabling the
bell,this allows custom bells to be rung when we'd otherwise beep.

Reviewed by:	kevans
Differential Revision:	https://reviews.freebsd.org/D32656
2021-11-03 16:03:51 -06:00
Zhenlei Huang
7acd322ebe devfs.rules: Correctly unhide pf in vnet jails
Revision 9e9be081d8 introduced a new devfs rule devfsrules_jail_vnet. It
includes rule devfsrules_jail which include other rules. Unfortunately
devfs could not recursively parse the action include and thus
devfsrules_jail_vnet will expose all nodes.

PR:		255660
Reviewed by:	kp
Obtained from:	Gijs Peskens <gijs@peskens.net>
MFC after:	3 weeks
Differential Revision:	https://reviews.freebsd.org/D32814
2021-11-03 12:50:13 +01:00
Kirk McKusick
68bff4a07e Allow GEOM utilities to specify a -v option.
Geom utilities (geli(8), glabel(8), gmirror(8), gpart(8), gmirror(8),
gmountver(8), etc) all use the geom(8) utility as their back end
to process their commands and pass them into the kernel. Creating
a new utility requires no more than filling out a template describing
the commands and arguments that the utility supports. Consider the
specification for the very simple gmountver(8) utility:

struct g_command class_commands[] = {
	{ "create", G_FLAG_VERBOSE | G_FLAG_LOADKLD, NULL,
	    {
		G_OPT_SENTINEL
	    },
	    "[-v] prov ..."
	},
	{ "destroy", G_FLAG_VERBOSE, NULL,
	    {
		{ 'f', "force", NULL, G_TYPE_BOOL },
		G_OPT_SENTINEL
	    },
	    "[-fv] name"
	},
	G_CMD_SENTINEL
};

It has just two commands of its own: "create" and "destroy" along
with the four standard commands "list", "status", "load", and
"unload" provided by the base geom(8) utility. The base geom(8)
utility allows each command to use the G_FLAG_VERBOSE flag to specify
that a command should accept the -v flag and when the -v flag is
given the utility prints "Done." if the command completes successfully.
In the above example, both of the commands set the G_FLAG_VERBOSE,
so have the -v option available. In addition the "destroy" command
accepts the -f boolean flag to force the destruction.

If the "destroy" command wanted to also print out verbose information,
it would need to explicitly declare its intent by adding a line:

		{ 'v', "verbose", NULL, G_TYPE_BOOL },

Before this change, the geom utility would silently ignore the above
line in the configuration file, so it was impossible for the utility
to know that the -v flag had been set on the command. With this
change a geom command can explicitly specify a -v option with a
line as given above and handle it as it would any other option. If
both a -v option and G_FLAG_VERBOSE are specified for a command
then both types of verbose information will be output when that
command is run with -v.

MFC after:    1 week
Sponsored by: Netflix
2021-10-28 22:50:50 -07:00
Ed Maste
48cb3fee25 Retire obsolete iscsi_initiator(4)
The new iSCSI initiator iscsi(4) was introduced with FreeBSD 10.0, and
the old intiator was marked obsolete shortly thereafter (in commit
d32789d95c, MFC'd to stable/10 in ba54910169).  Remove it now.

Reviewed by:	jhb, mav
Relnotes:	yes
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D32673
2021-10-26 16:17:35 -04:00
Gleb Smirnoff
c242672339 Fix sconfig(8) build.
Missed that since sconfig(8) was built on i386 only. Since I enabled
cp(4) on amd64, enable sconfig(8) as well.

Fixes:	6aae3517ed
2021-10-22 13:28:44 -07:00
Gleb Smirnoff
6aae3517ed Retire synchronous PPP kernel driver sppp(4).
The last two drivers that required sppp are cp(4) and ce(4).

These devices are still produced and can be purchased
at Cronyx <http://cronyx.ru/hardware/wan.html>.

Since Roman Kurakin <rik@FreeBSD.org> has quit them, they no
longer support FreeBSD officially.  Later they have dropped
support for Linux drivers to.  As of mid-2020 they don't even
have a developer to maintain their Windows driver.  However,
their support verbally told me that they could provide aid to
a FreeBSD developer with documentaion in case if there appears
a new customer for their devices.

These drivers have a feature to not use sppp(4) and create an
interface, but instead expose the device as netgraph(4) node.
Then, you can attach ng_ppp(4) with help of ports/net/mpd5 on
top of the node and get your synchronous PPP.  Alternatively
you can attach ng_frame_relay(4) or ng_cisco(4) for HDLC.
Actually, last time I used cp(4) back in 2004, using netgraph(4)
instead of sppp(4) was already the right way to do.

Thus, remove the sppp(4) related part of the drivers and enable
by default the negraph(4) part.  Further maintenance of these
drivers in the tree shouldn't be a big deal.

While doing that, remove some cruft and enable cp(4) compilation
on amd64.  The ce(4) for some unknown reason marks its internal
DDK functions with __attribute__ fastcall, which most likely is
safe to remove, but without hardware I'm not going to do that, so
ce(4) remains i386-only.

Reviewed by:		emaste, imp, donner
Differential Revision:	https://reviews.freebsd.org/D32590
See also:		https://reviews.freebsd.org/D23928
2021-10-22 11:41:36 -07:00
Alan Somers
9ce201f2ee ping: fix parsing of options including '4' and '6'
ping uses a two-pass option parser.  The first pass determines whether
ipv4 or ipv6 is desired, and the second parses the rest of the options.
But the first pass wrongly detects a '4' or '6' in an option's value as
a request to use ipv6 or ipv6 respectively, for example in an invocation
like "ping -c6 1.2.3.4".

Fix this confusion by including all options in the first round of
parsing, but ignoring those unrelated to ipv4/ipv6 selection.

PR:		258048
Reported by:	ghuckriede@blackberry.com
Submitted by:	ghuckriede@blackberry.com
MFC after:	2 weeks
Reviewed by:	emaste
Differential Revision: https://reviews.freebsd.org/D32344
2021-10-20 18:05:43 -06:00
Felix Johnson
d4cf7dc0df camcontrol(8): Clean up references to removed symbols
Patch the manpage to remove references to devq_openings and devq_queued.
Document the allocated tag that has been added in the same commit. The
relevant code change was committed as r271588
(959ec2581b) by mav@.

PR:		223651
MFH after:	3 days
Reported by:	Bertrand Petit <bsdpr@phoe.frmug.org>
2021-10-20 00:32:54 -04:00
Felix Johnson
bad324ace4 devd(8): Note default config file search locations
PR:		197003
MFC after:	3 days
Reported by:	Harald Schmalzbauer <bugzilla.freebsd@omnilan.de>
2021-10-19 00:37:40 -04:00
Kristof Provost
09c7f23869 pfctl: delay label macro expansion until after rule optimisation
We used to expand the $nr macro in labels into the rule number prior to
the optimisation step. This would occasionally produce incorrect rule
numbers in the labels.

Delay all macro expansion until after the optimisation step to ensure
that we expand the correct values.

MFC after:	1 week
Reported by:	Özkan KIRIK <ozkan.kirik@gmail.com>
Differential Revision:	https://reviews.freebsd.org/D32488
2021-10-15 22:19:45 +02:00
Elyes HAOUAS
c8a45820e0 sbin/mount_fusefs/mount_fusefs.8: Fix typos
"expicitly" --> "explicitly"
"uknown" --> "unknown"

Signed-off-by: Elyes HAOUAS <ehaouas@noos.fr>

MFC after:	3 days
Pull Request:	https://github.com/freebsd/freebsd-src/pull/552
2021-10-09 09:02:39 -06:00
Kirk McKusick
4313e2ae44 Avoid lost buffers in fsck_ffs.
The ino_blkatoff() and indir_blkatoff() functions failed to release
the buffers holding second and third level indirect blocks. This
commit ensures that these buffers are now properly released.

MFC after:    1 week
Sponsored by: Netflix
2021-10-07 15:52:58 -07:00
Kristof Provost
90dedf0fef pfctl: Remove unused variable
MFC after:	2 weeks
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2021-10-07 19:50:01 +02:00
Baptiste Daroussin
cbc83e378a ncurses: chase dependency changes in the source tree
Differential Revision:	https://reviews.freebsd.org/D32098
2021-10-04 11:38:24 +02:00
Kristof Provost
5062afff9d pfctl: userspace adaptive syncookies configration
Hook up the userspace bits to configure syncookies in adaptive mode.

MFC after:	1 week
Sponsored by:	Modirum MDPay
Differential Revision:	https://reviews.freebsd.org/D32136
2021-09-29 15:11:54 +02:00
Piotr Pawel Stefaniak
260f26f035 mount: make libxo support more locale-aware
"special", "node", and "mounter" are not guaranteed to be encoded with
UTF-8. Use the appropriate modifier.

Reported by:	eugen@
2021-09-27 07:12:26 +02:00
John Baldwin
9d324b5ffc mount: Don't pass a NULL format string to xo_err().
This fixes a -Wformat error from GCC 9.

Fixes:		e725ee7eb6 mount: add libxo(3) support
2021-09-25 11:52:10 -07:00
Cameron Katri
e725ee7eb6 mount: add libxo(3) support
Adds --libxo to mount(8).

Differential Revision:	https://reviews.freebsd.org/D30341
2021-09-24 23:07:00 +02:00