Commit Graph

10215 Commits

Author SHA1 Message Date
Gordon Bergling
328ebd4680 devd.conf.5: Fix a typo in the manual page
- s/deteted/detected/

MFC after:	5 days
2023-03-26 09:43:58 +02:00
Kristof Provost
0ab2c92234 ifconfig: free memory allocated by getaddrinfo()
Reported by:	emaste, Coverity
Sponsored by:	Rubicon Communications, LLC (Netgate)
2023-03-24 08:08:19 +01:00
Jose Luis Duran
4630a3252a ping: Fix an uninitialized variable
The variable oicmp, which holds the original ("quoted packet") ICMP
packet in a structured way, did not have a copy of the original ICMP
packet obtained from the raw data.

The code was accidentally removed in 20b4130314. Bring it back.

Reported by:	Coverity Scan, cy
Reviewed by:	cy
CID:		1506960 (UNINIT)
Fixes:		20b4130314
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D39233
2023-03-23 21:58:28 -07:00
Bjoern A. Zeeb
e091be417a ifconfig: ifieee80211: print bssid name
In certain setups (e.g., autonomous APs) it is extremly helpful to have
a way to map the BSSIDs to names for both normal status output as well
as the scan list.  This often allows a quicker overview than remembering
(or manually looking up) BSSIDs.
Call ether_ntohost() on the bssid and consult /etc/ethers
and print "(name)" after the bssid for the status output and "(name)"
at the end of the line after the IE list.

MFC after:	10 days
Reviewed by:	adrian, cy
Differential Revision: https://reviews.freebsd.org/D39192
2023-03-23 00:15:15 +00:00
Kirk McKusick
e5d0d1c5fb Rewrite function definitions with identifier lists.
A few functions snuck in with K&R style definitions.

Also add some missing memory frees.

MFC after:    1 week
2023-03-22 15:58:18 -07:00
Kristof Provost
b1a4ccdd83 carp: document peer/peer6 and mcast/mcast6 in the relevant man pages
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D38943
2023-03-20 14:37:10 +01:00
Kristof Provost
137818006d carp: support unicast
Allow users to configure the address to send carp messages to. This
allows carp to be used in unicast mode, which is useful in certain
virtual configurations (e.g. AWS, VMWare ESXi, ...)

Reviewed by:	melifaro
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D38940
2023-03-20 14:37:09 +01:00
Kristof Provost
40e0435964 carp: add netlink interface
Allow carp configuration information to be supplied and retrieved via
netlink.

Reviewed by:	melifaro
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D39048
2023-03-20 10:52:27 +01:00
Jose Luis Duran
ea6d169266 ping: Avoid reporting negative time statistics
Display a warning when the time goes back.

PR:		192417
Reviewed by:	markj
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D38480
2023-03-19 12:24:06 -04:00
Jose Luis Duran
076b718d9e ping tests: Add tests for IP header options
The function pr_pack() prints out a packet, if the IP packet contains
options, these are printed as well.

Test the functionality fixed in
70960bb86a.

Reviewed by:	markj
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D38470
2023-03-19 12:23:44 -04:00
Jose Luis Duran
1dc1f6bd31 ping: Remove pr_retip()
Ping used to provide some sort of packet sniffing capabilities, this was
in an era where hubs were used and tcpdump wasn't invented.

pr_iph() is a function that prints the IP header of the packet.

pr_retip() is essentially a wrapper function to pr_iph(), that also
displays the source and destination ports of a TCP or UDP packet.

After ef9e6dc7ee some of this
functionality was almost removed, to only display packets sent by us
(26+ years ago).

At this point, reaching this code path was only possible by doctoring
the original packet.

After 46d7b45a26 this code path can never
be reached.

Remove the code.

Reviewed by:	markj
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D38475
2023-03-19 12:23:22 -04:00
Jose Luis Duran
20b4130314 ping: Print the IP options of the original packet
When an ICMP packet contains an IP packet in its payload, and that
original IP packet contains options, these options were not displayed
accordingly in pr_iph().

pr_iph() is a function that prints the original "quoted packet" IP
header, with only an IP struct as an argument.  The IP struct does not
contain IP options, and it is not guaranteed that the options will be
contiguous in memory to the IP struct after
d9cacf605e.

Pass the raw ICMP data along with the IP struct, in order to print the
options, if any.

Reviewed by:	markj
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D38469
2023-03-19 12:23:06 -04:00
Jose Luis Duran
491263d7a6 ping: Avoid magic numbers
The sizeof(struct ip) is 20.
The sizeof(struct in_addr) is 4.

No functional change intended.

Reviewed by:	asomers, markj
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D39125
2023-03-17 09:24:44 -04:00
Jose Luis Duran
6d33121337 ping: Remove ifndef icmp_data guards
Early versions of <netinet/ip_icmp.h> [1] did not have icmp_data
defined, but FreeBSD has always had.  Remove these guards.

NetBSD [2] and OpenBSD [3] have already removed them.

[1]: https://www.tuhs.org/cgi-bin/utree.pl?file=4.2BSD/usr/src/sys/netinet/ip_icmp.h
[2]: 203dfd3486
[3]: d83449c83c

Reviewed by:	markj
MFC after:	1 week
2023-03-14 11:58:03 -04:00
Jose Luis Duran
9185854d19 ping: Fix the display of Flags/Fragment Offset
In the IP header, Flags + Fragment Offset is a 16-bit field.

Use ntohs() instead of ntohl(), otherwise the Flags/Fragment Offset
values may not display correctly.

Before (DF set)

    Vr HL TOS  Len   ID Flg  off TTL Pro  cks      Src      Dst
     4  5  00 0054 0001   0 0000  40  01 b6a4 192.0.2.1  192.0.2.2

After (DF set)

    Vr HL TOS  Len   ID Flg  off TTL Pro  cks      Src      Dst
     4  5  00 0054 0001   2 0000  40  01 b6a4 192.0.2.1  192.0.2.2

Reviewed by:	markj
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D38479
2023-03-14 11:58:02 -04:00
Jose Luis Duran
f32d6f745d ping6: Use errx to avoid appending a specious error message
Reviewed by:	asomers, markj
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D38418
2023-03-14 11:58:02 -04:00
Gordon Bergling
21f2681828 route.8: Don't reference an external command in EXAMPLES
It is better to mention the externel command for showing
the routing table as using an explicit command.

PR:	231579
Suggested by:	karels
Reviewed by:	karles, gbe
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D39075
2023-03-14 14:55:28 +01:00
Alexander Motin
20dc2c4d11 nvmecontrol: Fix default ns create parameters.
Instead of passing 0xff's for all unset parameters, prefer reasonable
defaults.  It is much easier to use it this was without specs in hand.

MFC after:	1 week
2023-03-09 10:19:00 -05:00
Kirk McKusick
129ea078cd FFS/UFS snapshots: improve documentation for removal (deletion) and unlinking.
Clarification of the size of the snapshot file.

Suggested by: Matteo Riondato
PR:           266358
MFC after:    2 weeks
Differential Revision: https://reviews.freebsd.org/D38817
2023-03-07 22:03:00 -08:00
Kirk McKusick
52f9710412 Correct several bugs in fsck_ffs(8) triggered by corrupted filesystems.
If a directory entry has an illegal inode number (less than zero
or greater than the last inode in the filesystem) the entry is removed.
If a directory '.' or '..' entry had an illegal inode number they
were being removed. Since fsck_ffs knows what the correct value is
for these two entries fix them rather deleting them.

Add much more extensive cylinder group checks and use them to be
more careful about rebuilding a cylinder group.

Check for out-of-range block numbers before trying to free them.

When a directory is deleted also remove its cache entry created
in pass1 so that later passes do not try to operate on a deleted
directory.

Check for ctime(3) returning NULL before trying to use its return.

When freeing a  directory inode, do not try to interpret it as a
directory.

Reserve space in the inostatlist to have room to allocate a
lost+found directory.

If an invalid block number is found past the end of an inode simply
remove it rather than clearing and removing the inode.

Modernize the inoinfo structure to use queue(3) LIST rather than a
handrolled linked list implementation.

Reported by:  Bob Prohaska, John-Mark Gurney, and Mark Millard
Tested by:    Peter Holm
Reviewed by:  Peter Holm
MFC after:    2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D38668
2023-03-07 15:14:47 -08:00
Kirk McKusick
7741a5c4dc FFS/UFS snapshots: improve documentation for removal (deletion) and unlinking.
Minor clarification.
2023-03-06 21:45:41 -08:00
Kristof Provost
1be25bdb73 pfctl: remove set but unused variable
In pfctl_show_ifaces() `i` is set, but never used. Remove it.

Sponsored by:	Rubicon Communications, LLC ("Netgate")
2023-03-06 19:22:35 +01:00
Kajetan Staszkiewicz
9f1beeaed4 pfctl: fix superblock printf format mismatch
It is impossible to compile pfctl with OPT_DEBUG due to integer width mismatch:

	/usr/home/kajetan.staszkiewicz/freebsd.git/sbin/pfctl/pfctl_optimize.c:1479:9: error: format specifies type 'unsigned int' but the argument has type 'unsigned long' [-Werror,-Wformat]
					    i - pf_rule_desc[closest].prf_off--- pfctl_optimize.o ---
	^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
	/usr/home/kajetan.staszkiewicz/freebsd.git/sbin/pfctl/pfctl_optimize.c:52:44: note: expanded from macro 'DEBUG'
		printf("%s: " str "\n", __FUNCTION__ , ## v)
			      ~~~                         ^
	1 error generated.

Reviewed by:	kp
Obtained from:	OpenBSD (pfctl_optimize.c 1.15)
Differential Revision:	https://reviews.freebsd.org/D38918
2023-03-06 19:22:35 +01:00
Alexander V. Chernikov
e2dc8d789f dhclient: do not add 0.0.0.0 interface alias.
Subscribers: imp

Differential Revision: https://reviews.freebsd.org/D38908
2023-03-06 15:08:09 +00:00
Kirk McKusick
528d8e55c8 FFS/UFS snapshots: improve documentation.
This update provides a more detailed description of FFS/UFS snapshots
and adds links to useful man pages.

Requested by: Graham Perrin
Submitted by: darius-dons.net.au
Reviewed by:  Ravi Pokala
PR:           266358
MFC after:    2 weeks
Differential Revision: https://reviews.freebsd.org/D38817
2023-03-05 21:38:57 -08:00
Kristof Provost
f5b204adf4 ifconfig: remove unused variable
In printgroup() 'cnt' is set, but never read. Remove it.

Sponsored by:	Rubicon Communications, LLC ("Netgate")
2023-03-04 11:19:12 +01:00
Kyle Evans
0c42886449 sysctl: tests: fix a couple issues
The function that sets test case metadata is actually named ${tc}_head
rather than ${tc}, so add the suffix.

While we're here, hook the tests up to the infrastructure so that they
do get run.

Sponsored by:	Klara, Inc.
2023-03-01 14:38:46 -06:00
Poul-Henning Kamp
996606792f Add deprecation notice to the gbde(8) program, scheduled to be removed in FreeBSD 15.0. 2023-02-28 21:39:06 +00:00
Gordon Bergling
6dbfbe6e11 route.8: Fix mandoc warnings
- skipping end of block that is not open: Oc
- no blank before trailing delimiter
- remove useless TN macros
- remove commented out reference for esis(4)

MFC after:	5 days
Differential Revision:	https://reviews.freebsd.org/D38783
2023-02-26 14:33:58 +01:00
Gordon Bergling
b06338167d route.8: Add information about ROUTE_MPATH and FIB_ALGO
Since the kernel options ROUTE_MPATH and FIB_ALGO are enabled
per default for a while, it's good to have some user facing
documetation about the general functionality of multipath
routing and fib lookup algorithms.

Reviewed by:	pauamma, Jose Luis Duran <jlduran at gmail dot com>
MFC after:	5 days
Differential Revision:	https://reviews.freebsd.org/D38783
2023-02-26 14:15:34 +01:00
Cy Schubert
70960bb86a ping: Fix unsigned integer underflow resuling in a ping -R segfault
ping -R (F_RROUTE) will loop at ping.c:1381 until it segfaults or
the unsigned int hlen happens to be less than the size of an IP header:

slippy$ ping -R 192.168.0.101
PING 192.168.0.101 (192.168.0.101): 56 data bytes
64 bytes from 192.168.0.101: icmp_seq=0 ttl=63 time=1.081 ms
RR: 	192.168.0.1
	192.168.0.101
	192.168.0.101
	10.1.1.254
	10.1.1.91
unknown option bb
unknown option 32
unknown option 6
...
unknown option 96
unknown option 2d
Segmentation fault

The reason for this is while looping through loose source routing (LSRR)
and strict source routing (SSRR), hlen will become smaller than the IP
header. It may even become negative. This should terminate the loop.
However, when hlen is unsigned, an integer underflow occurs becoming a
large number causing the loop to continue virtually forever until hlen
is either by chance smaller than the lenghth of an IP header or it
segfaults.

Reviewed by:	asomers
Fixes:		46d7b45a26
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D38744
2023-02-24 06:50:53 -08:00
Mina Galić
7e2af4f90b veriexec(4): Fix a compiler error
When building WITH_BEARSSL=1 veriexec(4) failes to compile.
So update the function prototype so that veriexec(4)
compiles again.

Reported by:	gbe
Reviewed by:	mjg, gbe
Approved by:	mjg
Pull Request:	https://github.com/freebsd/freebsd-src/pull/657
2023-02-23 12:14:41 +01:00
Jose Luis Duran
5b8af90fe3 ping: Add ATF-Python tests
ping(8) is an old utility, which has received many changes and updates through the years.
Some of these changes may have introduced small bugs, in part due to the lack of tests.
Attempt to remedy the current situation by introducing a way to easily add tests.

Differential Revision: https://reviews.freebsd.org/D38053
2023-02-20 10:34:33 +00:00
Alexander V. Chernikov
3d360ca49c Revert "ping: Add ATF-Python tests"
This reverts commit 0343e90f39.
2023-02-20 10:34:09 +00:00
Alexander V. Chernikov
0343e90f39 ping: Add ATF-Python tests
ping(8) is an old utility, which has received many changes and updates through the years.
Some of these changes may have introduced small bugs, in part due to the lack of tests.
Attempt to remedy the current situation by introducing a way to easily add tests.

Differential Revision: https://reviews.freebsd.org/D38053
2023-02-20 10:31:38 +00:00
Konstantin Belousov
5942b4b6fd sys/param.h: Add _WANT_P_OSREL
Use it instead of defining IN_RTLD by base sources that want P_OSREL_
defines in userspace, but are not rtld.
This allows to remove abuse of IN_RTLD from userspace.

Reviewed by:	dchagin, markj, imp
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D38585
2023-02-15 02:43:18 +02:00
Kyle Evans
8d78a0d331 md5: fix *sum -c with missing files
If we fail to open one of the files in the file listing, we still need
to advance `rec` along with `argv` so that the checksum we're checking
against lines up with the file we're hashing.

Tests added both for the -c flag, as well as the -b and -t modes of
the *sum programs.

PR:		267722
Reviewed by:	emaste (earlier version)
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D37374
2023-02-13 00:32:38 -06:00
Emmanuel Vadot
cab549c76c pkgbase: Create a FreeBSD-console-tools package
And put in it:
 - kbdcontrol
 - vidcontrol
 - moused
 - kbdmap

Those aren't useful in a jail or for a modern desktop.
While here, split the devd.conf part into some new files.

Reviewed by:	bapt
Sponsored by:	Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D38321
2023-02-08 08:52:40 +01:00
Emmanuel Vadot
2878e21ff1 devd: Move power_profile part in devd/power_profile.conf
And make it part of the FreeBSD-acpi package.
This avoid calling service power_profile on an installation without it
installed.

Sponsored by:   Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D38324
2023-02-08 08:52:17 +01:00
Emmanuel Vadot
9150a0455e devd: Move bluetooth part in devd/bluetooth.conf
And make it part of the FreeBSD-bluetooth package.
This avoid calling service bluetooth on an installation without it
installed.

Sponsored by:   Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D38323
2023-02-08 08:51:34 +01:00
Emmanuel Vadot
f4d9116de1 devd: Move dhclient part in devd/dhclient.conf
And make it part of the FreeBSD-dhclient package.
This avoid calling dhclient on an installation without dhclient
installed.

Sponsored by:	Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D38322
2023-02-08 08:51:20 +01:00
Dmitry Chagin
de59f46a82 bsdlabel: Fix whitespace.
MFC after:		1 week
2023-02-07 10:43:40 +03:00
Dmitry Chagin
901b050b36 bsdlabel: Remove a write-only variable.
Since r149061 (2005) the total_size variable is write-only.

Differential Revision:	https://reviews.freebsd.org/D38368
MFC after:		2 weeks
2023-02-07 10:43:18 +03:00
Stefan Eßer
d804497068 md5/tests: extend md5 test
The testloop function is called with various parameters, but those
were ignored in the coreutils-c-test script. This was an oversight
and is fixed by passing the option to all invocations of the hash
functions in this test script.

Reported by:	des
MFC after:	3 days
2023-02-06 21:25:44 +01:00
Dag-Erling Smørgrav
2768d70567 libmd / md5: Add SHA-512/224.
While there, remove .Tn from man pages.

Also remove an obsolete comment about the 80386.

MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	kevans, allanjude
Differential Revision:	https://reviews.freebsd.org/D38373
2023-02-06 18:03:04 +01:00
Xin LI
fdbfaefefa hastctl: use zlib's crc32 implementation.
X-MFC-with:	6998572a74
MFC after:      2 weeks
2023-02-03 00:30:08 -08:00
Xin LI
6998572a74 hastd: use zlib's crc32 implementation.
Reviewed by:	pjd
MFC after:	2 weeks
Differential Revision: https://reviews.freebsd.org/D35767
2023-02-02 23:14:21 -08:00
Mateusz Piotrowski
197947e0a3 ifconfig.8: Improve readability of vlanproto's description
Sponsored by:	Klara Inc.
MFC after:	1 week
2023-02-01 16:06:45 +01:00
Xin LI
195ec47b47 sbin/ping6: Remove remains of ping6.
MFC after:	2 weeks
2023-01-29 15:21:25 -08:00
Kirk McKusick
ad055467be Fix for getmntpoint(3) when checking for NFS mount points.
Only attempt to add /dev/ to f_mntfromname names that result in a
valid character device.

MFC after:    1 week
Reported by:  Bjoern A. Zeeb
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D37907
2023-01-29 15:14:43 -08:00
Ed Maste
ac4c695ad6 Retire WITHOUT_CXX option
Several important base system components are written in C++, and the
WITHOUT_CXX option produced a system that was not fully functional.
Just accept this, and remove the option to build without C++ support.

This reverts commit adc3c128c6.

Reviewed by:	brooks, kevans, jhb (earlier)
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D33108
2023-01-26 21:13:16 -05:00
Kirk McKusick
0bd4c448ec Rewrite to avoid Coverity false positive.
MFC after:    1 week
Reported by:  Coverity (CID 1502669)
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D37907
2023-01-25 16:57:26 -08:00
Ceri Davies
da52fc464a ipfw.8: there never was a "skip-action" action
It was renamed during review of D1776 but this entry slipped through.

PR:		243284
Reported by:	pprocacci@gmail.com
Obtained from:	Chad Jacob Milios <milios@ccsys.com>
2023-01-25 18:15:18 +00:00
Kristof Provost
cd80c52cad pfctl: rule.label is a two-dimensional array
Fix checking for a non-empty first string.

PR:		269075
MFC after:	1 week
Reported by:	nreilly@blackberry.com
2023-01-24 07:46:46 +01:00
Alan Somers
5205908816 Revert "ifconfig: abort if loading a module fails other than for ENOENT"
This reverts commit 2c24ad3377.

This change causes some commands to fail, for example when working with
renamed interfaces or when trying to list a nonexistent interface by
name.

PR:		269042
Reported by:	dbaio, Michael Paepcke <bugs.fbsd@paepcke.de>
MFC with:	2c24ad3377
2023-01-20 10:17:21 -07:00
Kirk McKusick
906c312bbf Document the mntopts(3) functions.
The mntopts(3) functions support operations associated with a mount
point. The main purpose of this commit is to document the mntopts(3)
functions that now appear in 18 utilities in the base system. See
mntopts(3) for the documentation details.

The getmntopts() function appeared in 4.4BSD. The build_iovec(),
build_iovec_argf(), free_iovec(), checkpath(), and rmslashes()
functions were added with nmount(8) in FreeBSD 5.0. The getmntpoint()
and chkdoreload() functions are being added in this commit.

These functions should be in a library but for historic reasons are
in a file in the sources for the mount(8) program. Thus, to access
them the following lines need to be added to the Makefile of the
program wanting to use them:

SRCS+= getmntopts.c
MOUNT= ${SRCTOP}/sbin/mount
CFLAGS+= -I${MOUNT}
.PATH: ${MOUNT}

Once these changes have been MFC'ed to 13 they may be made into
a library.

Reviewed by:  kib, gbe
MFC after:    2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D37907
2023-01-15 10:21:31 -08:00
Jose Luis Duran
bdd60b224f ipfw: Add missing 'va' code point name
Per RFC 5865, add the 'va' (VOICE-ADMIT, 101100) symbolic name.

Reviewed By: melifaro, pauamma
Differential Revision: https://reviews.freebsd.org/D37508
MFC after:	2 weeks
2023-01-13 20:21:27 +00:00
Alan Somers
2c24ad3377 ifconfig: abort if loading a module fails other than for ENOENT
If "ifconfig create" tries to load a kernel module, and the module
exists but can't be loaded, fail the command with a useful error
message.  This is helpful, for example, when trying to create a cloned
interface in a vnet jail.  But ignore ENOENT, because sometimes ifconfig
can't correctly guess the name of the required kernel module.

MFC after:	2 weeks
Reviewed by:	jhb
Differential Revision: https://reviews.freebsd.org/D37873
2023-01-09 19:56:18 -07:00
Jose Luis Duran
8eb4df9487 ping(8): man page cleanup
* Appease mandoc -T lint and igor

* Use example.com for documentation

* Update the IPv4 TTL section.
  Update the IPv4 TTL section specifically for FreeBSD.
  FreeBSD changed the default TTL to 64 in
  5639e86bdd.  NetBSD and OpenBSD still
  use 255.  Remove some references of extinct operating systems.

Reviewed by:	gbe (manpages), asomers
MFC after:	2 weeks
Pull Request:	https://github.com/freebsd/freebsd-src/pull/630
2023-01-02 00:48:25 +00:00
Alan Somers
e35cfc606a Add test cases for ping with IP options in the response
MFC after:	1 week
Reviewed by:	markj
Differential Revision: https://reviews.freebsd.org/D37210
2022-12-25 22:59:58 -07:00
Kirk McKusick
f126d34981 Add -F option to sysctl(8) to display sysctl format.
Also add a test to ensure that it is working correctly.

Submitted by: ota_j.email.ne.jp
Reviewed by:  mckusick
Differential Revision: https://reviews.freebsd.org/D34012
2022-12-24 22:59:00 -08:00
Ceri Davies
8183df7f00 mount_nullfs.8: Bump .Dd for file mounts update. 2022-12-19 18:58:39 +00:00
Doug Rabson
a3f714c4ff Add support for mounting single files in nullfs
My main use-case for this is to support mounting config files and secrets
into OCI containers. My current workaround copies the files into the
container which is messy and risks secrets leaking into container images
if the cleanup fails.

Reviewed by:	mjg, kib
Tested by:	pho
Differential Revision: https://reviews.freebsd.org/D37478
2022-12-19 16:44:54 +00:00
Ed Maste
fa4d25f5b4 retire sconfig(8) ce(4)/cp(4) configuration tool
The ce(4) and cp(4) drivers have been retired.

Differential Revision:	https://reviews.freebsd.org/D33469
2022-12-13 15:25:13 -05:00
Ed Maste
20dfe27b2d Add deprecation notices to ce,cp sync serial drivers
And the related sconfig utility.  Sync serial (e.g. E1/T1) interfaces
are obsolete, and nobody responded to several inquires on the mailing
lists about use of these drivers.

Relnotes:	Yes
MFC after:	3 days
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D23928
2022-12-13 14:59:08 -05:00
Jose Luis Duran
47972d6dc4 Fix rcorder example to match the keyword in the description
Differential Revision: https://reviews.freebsd.org/D37686
2022-12-13 19:56:28 +00:00
Ceri Davies
cd9cdd0eaa sysctl.8: grammar nit 2022-12-13 19:52:10 +00:00
Ed Maste
94db10b2db geom: minor man page updates suggested by igor(1)
Reviewed by:	pauamma
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D37681
2022-12-12 19:27:17 -05:00
Ed Maste
d181a91267 geom: add vinum as a recognized class
And note that it is deprecated.

PR:		236569
Reported by:	bcran
Reviewed by:	imp
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D37678
2022-12-12 16:19:02 -05:00
Chuck Silvers
9dda00df7e restore: fix restore of NFS4 ACLs
Changing the mode bits on a file with an NFS4 ACL results in the
NFS4 ACL being replaced by one matching the new mode bits being set,
so when restoring a file with an NFS4 ACL, set the owner/group/mode first
and then set the NFS4 ACL, so that setting the mode does not throw away
the ACL that we just set.

Reviewed by:	mckusick
Differential Revision:  https://reviews.freebsd.org/D37618
2022-12-12 08:19:51 -08:00
Warner Losh
7652743540 devd: Warn for deprecated 'kern' system type
One year ago, I deprecated 'kern' in favor of 'kernel' for the system
name for some power events. I'm about to remove it from the kernel, but
realized there's been no warning generated for users. Preserve POLA by
converting on the fly here and issuing a warning for 14.x, and an fatal
error after we branch 15. Make compiling it an error on 16 to remove
the gross hack after we branch.

Sponsored by:		Netflix
Reviewed by:		bapt
Differential Revision:	https://reviews.freebsd.org/D37584
2022-12-02 10:48:02 -07:00
Warner Losh
8d147537bf newbus: Remove deprecated "kern" system name for resume events.
The new "kernel" system name is the one that's documented and has
been generated for a year now. Remove the old one now that 14.0
is getting close.

Sponsored by:		Netflix
Reviewed by:		bapt
Differential Revision:	https://reviews.freebsd.org/D37582
2022-12-02 10:48:02 -07:00
Tom Jones
46d7b45a26 ping: Fix handling of IP packet sizes
Ping reads raw IP packets to parse ICMP responses. When reading the
IP Header Len (IHL) ping was was taking the value from the provided
packet without any validation. This could lead to remotely triggerable
stack corruption.

Validate the IHL against expected and recieved data sizes when reading
from the received packet and when reading any quoted packets from within
the ICMP response.

Approved by:	so
Reviewed by:	markj, asomers
Security:	FreeBSD-SA-22:15.ping
Security:	CVE-2022-23093
Sponsored by:   NetApp, Inc.
Sponsored by:   Klara, Inc.
X-NetApp-PR:    #77
Differential Revision: https://reviews.freebsd.org/D37195
2022-11-29 14:51:50 -08:00
Kristof Provost
88e858e57c pf: drop support for fragment crop|drop-ovl
We removed the code for these modes back in 2015, but converted such
configurations to 'scrub fragment reassemble'. It's been long enough,
drop the backwards compatibility glue too.

Reviewed by:	mjg
MFC after:	never
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D37460
2022-11-28 20:19:12 +01:00
Kristof Provost
57e047e51c pf: allow scrub rules without fragment reassemble
scrub rules have defaulted to handling fragments for a long time, but
since we removed "fragment crop" and "fragment drop-ovl" in 64b3b4d611
this has become less obvious and more expensive ("reassemble" being the
more expensive option, even if it's the one the vast majority of users
should be using).

Extend the 'scrub' syntax to allow fragment reassembly to be disabled,
while retaining the other scrub behaviour (e.g. TTL changes, random-id,
..) using 'scrub fragment no reassemble'.

Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D37459
2022-11-28 20:19:05 +01:00
Goran Mekic
3599da158e ipfw: Fix ipfw/dnctl detection
Running "dnctl" vs "/sbin/dnctl" gave different results, because we
looked at the entire argv[0] string, rather than the basename.

Reviewed by:	kp
Differential Revision:	https://reviews.freebsd.org/D37431
2022-11-22 09:53:20 +01:00
Ed Maste
8214b9d65a Make devd shared now that libc++ is in /lib
Commit 5e6a2d6eb2 moved libc++ from /usr/lib to /lib, so we no longer
have an interval during boot when it is not available (before /usr is
mounted).  We no longer need to force devd to be statically linked.

Reviewed by:	jhb
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D37409
2022-11-20 11:49:09 -05:00
Wanpeng Qian
41be508d31 nvmecontrol: Fix IEEE OUI Identifier output
Current sequence of IEEE OUI Identifier output is wrong.

For Intel, current output is e4 d2 5c, specification is 5CD2E4h
For Samsung, current output is 38 25 00, specification is 002538h
also check with Linux nvme-cli.

Reviewed by:	imp, chuck
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D33856
2022-11-19 19:14:00 -08:00
Ed Maste
714f6f9c14 ipfilter: replace defunct home page link with FAQ URL
ipfilter.org disappeared in mid 2004.  There is still a FAQ at
https://www.phildev.net/ipf so point to that.
2022-11-15 17:11:59 -05:00
Wanpeng Qian
0fd43b0c6a
nvmecontrol: Fix condition when print number of Firmware Slots and Firmware Slot1 Readonly.
The Number of Firmware Slots should never be zero. So, a Firmware Slot 1
should always exist. For that reason, always print the Number of
Firmware Slots and the Firmware Slot 1 Read-Only value.

Reviewed by:		imp
Approved by:		manu (mentor)
MFC after:		1 week
Differential Revision:	https://reviews.freebsd.org/D34700
2022-11-15 07:48:20 +01:00
Hans Petter Selasky
3492caf512 dhclient(8): Verify lease-, renewal- and rebinding-time option sizes.
Else out-of-bound reads and undefined behaviour may happen.
The current code only checked for the presence of the first of four bytes.
Make sure the fields in question have the minium size required.

No functional change intended.

Reviewed by:	rrs@
MFC after:	1 week
Sponsored by:	NVIDIA Networking
2022-11-14 16:47:21 +01:00
Kirk McKusick
78f4129876 Enable taking snapshots on UFS/FFS filesystems using journaled soft updates.
All the needed infrastructure updates have been made to allow
snapshots to be taken on UFS/FFS filesystems that are using journaled
soft updates. The most immediate benefit is the ability to use a
snapshot to take a consistent filesystem dump on a live filesystem
using the -L option to dump(8).

Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D36491
2022-11-12 22:56:03 -08:00
Wanpeng Qian
3a194eac3c nvmecontrol: fix wrong temperature unit for INTEL SSDs.
Although intel's specification did not tell which unit for Temperature
Statistics (Log Identifier C5h), I believe it is based on Celsius
instead of Kelvin.

here is my P3700 SSDs result(before):

Intel Temperature Log
=====================
Current:                        30 K, -243.15 C, -405.67 F
Overtemp Last Flags             0
Overtemp Lifetime Flags         0
Max Temperature                 53 K, -220.15 C, -364.27 F
Min Temperature                 17 K, -256.15 C, -429.07 F
Max Operating Temperature       63 K, -210.15 C, -346.27 F
Min Operating Temperature       0 K, -273.15 C, -459.67 F
Estimated Temperature Offset:   0 C/K
after apply the patch, result is

Intel Temperature Log
=====================
Current:                        303.15 K, 30 C, 86.00 F
Overtemp Last Flags             0
Overtemp Lifetime Flags         0
Max Temperature                 326.15 K, 53 C, 127.40 F
Min Temperature                 290.15 K, 17 C, 62.60 F
Max Operating Temperature       336.15 K, 63 C, 145.40 F
Min Operating Temperature       273.15 K, 0 C, 32.00 F
Estimated Temperature Offset:   0 C/K
I also compare to smartctl's report. it match very well.

also tested on Intel P3600, it fixed the problem.

Signed-off-by: Wanpeng Qian <wanpengqian@gmail.com>
Reviewed by: imp (added tweak to samsung.c so it still compiles)
Differential Revision: https://reviews.freebsd.org/D32845
2022-11-11 12:15:52 -07:00
Kirk McKusick
5f7acd1858 Fix printfs for fsck_ffs(8) i386 build.
Reported by:  jenkins
Sponsored by: The FreeBSD Foundation
2022-11-09 21:59:20 -08:00
Kirk McKusick
689a9368eb Fix types for fsck_ffs(8) i386 build.
Reported by:  jenkins
Reported by:  Cy Schubert
Sponsored by: The FreeBSD Foundation
2022-11-09 18:31:19 -08:00
Luiz Amaral
813c5b75e6 pfsync: prepare code to accommodate AF_INET6 family
Work is ongoing to add support for pfsync over IPv6. This required some
changes to allow for differentiating between the two families in a more
generic way.

This patch converts the relevant ioctls to using nvlists, making future
extensions (such as supporting IPv6 addresses) easier.

Sponsored by:	InnoGames GmbH
Differential Revision:	https://reviews.freebsd.org/D36277
2022-11-09 21:06:07 +01:00
Kirk McKusick
460ed6106c Add support for managing UFS/FFS snapshots to fsck_ffs(8).
The kernel handles the managment of UFS/FFS snapshots. Since UFS/FFS
updates filesystem data (rather than always writing changes to new
locations like ZFS), the kernel must check every filesystem write
to see if the block being written is part of a snapshot. If it is
part of a snapshot, then the kernel must make a copy of the old
block value into a newly allocated block for the snapshot before
allowing the write to be done. Similarly, if a block is being freed,
the kernel must check to see if it is part of a snapshot and let
the snapshot claim the block rather than freeing it for future use.
When a snapshot is freed, its blocks need to be offered to older
snapshots and freed only if no older snapshots wish to claim them.

When snapshots were added to UFS/FFS they were integrated into soft
updates and just a small part of the management of snapshots needed
to be added to fsck_ffs(8) as soft updates minimized the set of
snapshot changes that might need correction. When journaling was
added to soft updates a much more complete knowledge of snapshots
needed to be added to fsck_ffs(8) for it to be able to properly
handle the filesystem changes that a journal rollback needs to do
(specifically the freeing and allocation of blocks). Since this
functionality was unavailable, the use of snapshots was disabled
when running with journaled soft updates.

This set of changes imports the kernel code for the management of
snapshots to fsck_ffs(8). With this code in place it will become
possible to enable snapshots when running with journalled soft
updates. The most immediate benefit will be the ability to use
snapshots to take consistent filesystem dumps on live filesystems.
Future work will be done to update fsck_ffs(8) to be able to use
snapshots to run in background on live filesystems running with
journaled soft updates.

Reviewed by:  kib
Tested by:    Peter Holm
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D36491
2022-11-09 10:46:31 -08:00
Kirk McKusick
f515a279f7 Clean up error output for extended attributes in fsck_ffs(8).
MFC after:    1 week
Sponsored by: The FreeBSD Foundation
2022-11-07 14:32:42 -08:00
Gordon Bergling
e0dfa1c4c4 shutdown.8: Add a note about needed priviledges to run the command
In order to use the shutdown command, the user must
have root privileges or be a member of the operator group.

PR:		266525
Reported by:	Zsolt Udvari <uzsolt at uzsolt hu>
Reviewed by:	pauamma
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D36688
2022-11-07 12:00:11 +01:00
Jose Luis Duran
d481443acb ping_test: Fix tests ping_46 and ping6_46
If no IPv4-host, IPv4-mcast-group or IPv6-host is passed, it will
display the usage.  The tests are passing because they are just checking
that the exit code is 1.

Fix the tests by checking the appropriate output message.

While here, change the description to match the output and add the
missing requirements.

Reviewed by:	markj
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D37250
2022-11-03 10:39:32 -04:00
Jose Luis Duran
fcae0b54d1 ping_test: Code cleanup
Mostly style fixes.

Reviewed by:	markj
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D37248
2022-11-03 10:39:32 -04:00
Jose Luis Duran
909e2e1b6c ping: Remove a vestigial notdef
It was once a function on 4.3BSD, pr_type() [1], used to convert an ICMP
"type" field to a printable string.  In 4.4BSD it was superseded by
pr_icmph() [2].

NetBSD [3] and OpenBSD [4] have already removed it.

[1]: https://minnie.tuhs.org/cgi-bin/utree.pl?file=4.3BSD/usr/src/etc/ping.c
[2]: https://minnie.tuhs.org/cgi-bin/utree.pl?file=4.4BSD/usr/src/sbin/ping/ping.c
[3]: 203dfd3486
[4]: 9bbbbbb75d

Reviewed by:	markj
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D37247
2022-11-03 10:39:32 -04:00
Jose Luis Duran
526e8a7d5d ping: main.c: Consistent use of white space/tabs
If a user has tabs set at a value other than 8, the output of the usage
may not be consistently aligned.

    % tabs -2

Before:
    % ping
    usage:
      ping [-4AaDdfHnoQqRrv] [-C pcp] [-c count] [-G sweepmaxsize]
          [-g sweepminsize] [-h sweepincrsize] [-i wait] [-l preload]
          [-M mask | time] [-m ttl] [-P policy] [-p pattern] [-S src_addr]
          [-s packetsize] [-t timeout] [-W waittime] [-z tos] IPv4-host
      ping [-4AaDdfHLnoQqRrv] [-C pcp] [-c count] [-I iface] [-i wait]
          [-l preload] [-M mask | time] [-m ttl] [-P policy] [-p pattern]
          [-S src_addr] [-s packetsize] [-T ttl] [-t timeout] [-W waittime]
                [-z tos] IPv4-mcast-group
      ping [-6AaDdfHnNoOquvyY] [-b bufsiz] [-c count] [-e gateway]
                [-I interface] [-i wait] [-k addrtype] [-l preload] [-m hoplimit]
                [-p pattern] [-P policy] [-S sourceaddr] [-s packetsize] [-t timeout]
          [-W waittime] [-z tclass] [IPv6-hops ...] IPv6-host

After:
    % ping
    usage:
      ping [-4AaDdfHnoQqRrv] [-C pcp] [-c count] [-G sweepmaxsize]
          [-g sweepminsize] [-h sweepincrsize] [-i wait] [-l preload]
          [-M mask | time] [-m ttl] [-P policy] [-p pattern] [-S src_addr]
          [-s packetsize] [-t timeout] [-W waittime] [-z tos] IPv4-host
      ping [-4AaDdfHLnoQqRrv] [-C pcp] [-c count] [-I iface] [-i wait]
          [-l preload] [-M mask | time] [-m ttl] [-P policy] [-p pattern]
          [-S src_addr] [-s packetsize] [-T ttl] [-t timeout] [-W waittime]
          [-z tos] IPv4-mcast-group
      ping [-6AaDdfHnNoOquvyY] [-b bufsiz] [-c count] [-e gateway]
          [-I interface] [-i wait] [-k addrtype] [-l preload] [-m hoplimit]
          [-p pattern] [-P policy] [-S sourceaddr] [-s packetsize] [-t timeout]
          [-W waittime] [-z tclass] [IPv6-hops ...] IPv6-host

Reviewed by:	markj
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D37246
2022-11-03 10:39:32 -04:00
Pau Amma
5cc5c9254d Make SYNOPSIS match DESCRIPTION.
While there, fix nits reported by igor and mandoc -T lint.

Differential Revision: https://reviews.freebsd.org/D35405

Reviewed by:	debdrup, gbe, gjb

Approved by:	gjb (mentor)

MFC after:	3 days
2022-11-03 00:20:12 +01:00
Kristof Provost
8a8af94240 pf: bridge-to
Allow pf (l2) to be used to redirect ethernet packets to a different
interface.

The intended use case is to send 802.1x challenges out to a side
interface, to enable AT&T links to function with pfSense as a gateway,
rather than the AT&T provided hardware.

Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D37193
2022-11-02 15:45:23 +01:00
Kristof Provost
9f8f3a8e9a ipsec: add support for CHACHA20POLY1305
Based on a patch by ae@.

Reviewed by:	gbe (man page), pauamma (man page)
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D37180
2022-11-02 14:19:04 +01:00
Ed Maste
6659516b1a mount_unionfs: remove jokey cautions from man page
There are known issues with unionfs, and the mount_unionfs man page has
a cautionary statement about its use.  The caution had additional
"humourous" statements like "BEWARE OF DOG" but they served only to
confuse the situation.  Remove them.

MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
2022-10-31 16:52:54 -04:00
Kristof Provost
444a77ca85 pf: expose syncookie active/inactive status
When syncookies are in adaptive mode they may be active or inactive.
Expose this status to users.

Suggested by:	Guido van Rooij
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2022-10-31 18:14:09 +01:00
Kirk McKusick
595746df6f Additional diagnostic output when running fsck_ffs with debugging flag (-d)
MFC after:    1 week
Sponsored by: The FreeBSD Foundation
2022-10-30 15:00:20 -07:00
Emmanuel Vadot
e7a5a60ed5 pkgbase: Put devmatch in its own package
devmatch is useful on standalone machine but not on jails.
Put devinfo(8) and libdevinfo there too.

Differential Revision:	https://reviews.freebsd.org/D36229
2022-10-26 19:46:38 +02:00