Commit graph

15564 commits

Author SHA1 Message Date
Richard Scheffenegger 8e7c2e14cf netstat: display c and C flags properly
Restructure c and C flag checks for string length to
work properly. Quickly bypass for non TCP protos too.

Reviewed By:		tuexen
Sponsored by:		NetApp, Inc.
Differential Revision:	https://reviews.freebsd.org/D40480
2023-06-09 23:58:00 +02:00
Xin LI d101656818 hexdump: Partial lines cannot be repetitions of earlier lines.
When checking for repetitions of earlier lines, we compare the
first nread bytes of the line against the saved line. However,
when we read a partial line, it should never be treated as a
repetition of an earlier line, even if the first bytes match.

This change fixes a bug where a partial line could be
incorrectly identified as a repetition of an earlier line.

Reported-by:	Mark Adler <madler@alumni.caltech.edu>
PR:		118723
Reviewed-by:	emaste
MFC-after:	2 weeks
Differential Revision: https://reviews.freebsd.org/D40471
2023-06-08 18:39:05 -07:00
Xin LI 1232c7884d od(1): Fix skip value handling
POSIX defines -j as the number of bytes that od(1) should skip over the
concatenated input files. The existing code tries to implement this behavior
by checking if the current address was smaller than the skip value. However,
this is not correct, because we adjust both the skip value and the address
at the same time when we do fseeko (when file is seekable) or getchar (when
file is not seekable).

This commit fixes the problem by expecting the skip value to be zero upon
return of next(). If the condition is not satisfied, a diagnostic message
will be issued.

Reported-by:	Mohamed Akram <mohd.akram@outlook.com>
Reviewed-by:	emaste
PR:		271832
MFC-after:	2 weeks
Differential Revision: https://reviews.freebsd.org/D40446
2023-06-07 18:06:07 -07:00
Dag-Erling Smørgrav fbc445addf xargs: Consistently use strtonum() to parse arguments.
MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	kevans
Differential Revision:	https://reviews.freebsd.org/D40425
2023-06-05 20:50:54 +02:00
Dag-Erling Smørgrav 6d777389e1 xargs: Fix typo in error message.
MFC after:	1 week
Sponsored by:	Klara, Inc.
2023-06-05 18:11:44 +02:00
Dag-Erling Smørgrav 7ba6119e22 ctags: Don't undercount lines when handling // comments.
MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	kevans
Differential Revision:	https://reviews.freebsd.org/D40374
2023-06-05 17:53:45 +02:00
Mateusz Piotrowski 979754a15a nfsstat.1: Add a missing argument to -w
MFC after:	3 days
Sponsored by:	Klara Inc.
2023-06-05 14:33:55 +02:00
Ben Harris 37e3f5b23b Enable support for printing 8-byte integers. For some reason, most of the
code for this was present, but disabled.
This is required for POSIX compliance on platforms with 8-byte longs.

Obtained-From:	NetBSD
PR:		238586
Reported-By:	Mohamed Akram <mohd.akram@outlook.com>
MFC after:	2 weeks
2023-06-04 19:23:35 -07:00
Jan Schaumann ac17fc816e split(1): add '-c' to continue creating files
Currently, split(1) will clobber any existing output files:

$ split file; ls
xaa xab xac xad
$ split second-file; ls
xaa xab xac xad xae xaf

This patch adds a flag "-c" (mnemonic "create, don't overwrite" or
"continue where you left off"):

$ split file; ls
xaa xab xac xad
$ split -c second-file; ls
xaa xab xac xad xae xaf xag xah xai xaj

Reviewed by:	christos
Approved by:	kevans
Different Revision:	https://reviews.freebsd.org/D38553
2023-05-30 16:13:16 +03:00
Jan Schaumann c4f7198f47 split(1): auto-extend suffix length if required
If the input cannot be split into the number of files resulting from the
default suffix length, automatically extend the suffix length rather
than bailing out with 'too many files'.

Suffixes are extended such that the resulting files continue to sort
lexically and "cat *" would reproduce the input. For example, splitting
a 1M lines file into (default) 1000 lines per file would yield files
named 'xaa', 'xab', ..., 'xyy', 'xyz', 'xzaaa', 'xzaab', ..., 'xzanl'.

If '-a' is specified, the suffix length is not auto-extended.

This behavior matches GNU sort(1) since around version 8.16.

Reviewed by:	christos
Approved by:	kevans
Different Revision:	https://reviews.freebsd.org/D38279
2023-05-30 15:55:38 +03:00
Kajetan Staszkiewicz 4bf98559d9 pf: make contents of struct pfsync_state configurable
Make struct pfsync_state contents configurable by sending out new
versions of the structure in separate subheader actions. Both old and
new version of struct pfsync_state can be understood, so replication of
states from a system running an older kernel is possible. The version
being sent out is configured using ifconfig pfsync0 … version XXXX. The
version is an user-friendly string - 1301 stands for FreeBSD 13.1 (I
have checked synchronization against a host running 13.1), 1400 stands
for 14.0.

A host running an older kernel will just ignore the messages and count
them as "packets discarded for bad action".

Reviewed by:	kp
Sponsored by:	InnoGames GmbH
Differential Revision:	https://reviews.freebsd.org/D39392
2023-05-30 14:28:56 +02:00
Baptiste Daroussin cb1fc924d2 genl: add new command to list genetlink(4)
This commands list genetlink protocols and its operations and
capabilities

Name: nlctrl
	ID: 0x10, Version: 00, header size: 2, max attributes: 10
	supported operations:
	 - ID: 0x3, Capabilities: 0xe (can modify; can get/dump;
has policy)
	multicast groups:
	 - ID: 0x30, Name: notify
Name: carp
	ID: 0x11, Version: 00, header size: 2, max attributes: 2
	supported operations:
	 - ID: 0x1, Capabilities: 0xe (can modify; can get/dump;
has policy)
	 - ID: 0x2, Capabilities: 0xb (requires admin permission;
can modify; has policy)

Reviewed by:		melifaro
Differential Revision:	https://reviews.freebsd.org/D40330
2023-05-30 13:36:43 +02:00
Enji Cooper 27234ad699 Fix the build post-dcf5d5603b3af8
I didn't compile test the prior code before committing.

MFC after:	1 week
MFC with:	dcf5d5603b
2023-05-27 19:18:43 -07:00
Enji Cooper dcf5d5603b Reduce ifdef soup by adding pre-3.0 compat support
This change creates a static inline function, BN_check_prime, for
pre-3.0 use which is implemented with the previous (1.1) compatible call
under the covers, `BN_is_prime_ex`.

The `nchecks` parameter value is maintained, even though it has no
noticable behavior change, given that the documentation clearly states
that at least 64 or 128 rounds are executed on the backend, depending on
how many bits there are in the given number being factored out.

MFC after:	1 week
Differential Revision:	 https://reviews.freebsd.org/D40305
2023-05-27 17:05:39 -07:00
Enji Cooper 537cd76643 factor: support OpenSSL 3
This change ports the BN APIs to an OpenSSL 3 compatible set of APIs.

This removes the need for requesting OpenSSL 1.1 compatible APIs.

MFC after:	1 week
Reviewed by:	emaste
Differential Revision:	https://reviews.freebsd.org/D40298
2023-05-27 11:11:44 -07:00
Enji Cooper c60be9ea6b Add simple factor/primes regression tests
This will help ensure that the change following this
one to support OpenSSL 3 is sane.

MFC after:	1 week
Reviewed by:	emaste
Differential Revision:	https://reviews.freebsd.org/D40297
2023-05-27 11:11:44 -07:00
Alexander V. Chernikov 656a39c1a0 netlink: use newly-added snl(3) array parsing for handling multipath
routes.

MFC after:	2 weeks
2023-05-27 11:13:14 +00:00
Mark Johnston e96ed17746 top: Use a cpuset_t to represent a CPU mask
The code attempts to detect holes in the CPU ID space, but previously
this would only work for up to sizeof(long)*8 CPUs.

MFC after:	2 weeks
2023-05-26 15:38:08 -04:00
Dmitry Chagin c2c9ac88c2 kdump: Add a facility to print numbers in decimal format always
To help grepping kdump output by pid or tid it makes sence to print
some numbers in decimal format always. Eg, process or thread identifier
at least, as they already printed in decimal format.
Switch to print pid/tid arguments of some Linux signal related syscalls
in decimal format.

Reviewed by:		jhb
Differential Revision:	https://reviews.freebsd.org/D40099
MFC after:		1 week
2023-05-26 19:35:08 +03:00
Dmitry Chagin 829f3d7d26 kdump: Decode linux_clone syscall flags
Reviewed by:		emaste
Differential Revision:	https://reviews.freebsd.org/D40151
MFC after:		1 week
2023-05-26 19:34:33 +03:00
Mark Johnston db289ababf posixshmcontrol.1: Document posixshmcontrol create -l
Reviewed by:	kib
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D40270
2023-05-25 18:09:55 -04:00
Pierre Pronchery fed03614bd factor: Request the OpenSSL 1.1 API
OPENSSL_API_COMPAT can be used to specify the OpenSSL API version in
use for the purpose of hiding deprecated interfaces and enabling
the appropriate deprecation notices.

This change is a NFC while we're still using OpenSSL 1.1.1 but will
avoid deprecation warnings upon the switch to OpenSSL 3.0.

A future change should migrate to use the OpenSSL 3.0 APIs.

PR:		271615
Reviewed by:	emaste
Event:		Kitchener-Waterloo Hackathon 202305
Sponsored by:	The FreeBSD Foundation
2023-05-25 16:52:52 -04:00
Dag-Erling Smørgrav 9f35eb8f96 ctags: Recognize __attribute__ in function declarations.
MFC after:	1 week
Obtained from:	NetBSD
Sponsored by:	Klara, Inc.
Reviewed by:	kevans
Differential Revision:	https://reviews.freebsd.org/D40264
2023-05-25 18:02:24 +00:00
John Baldwin 555b62e1c8 less: Re-enable -Wdeprecated-non-prototype warnings.
These were fixed in the most recent update to contrib/less.
2023-05-25 09:16:20 -07:00
Dag-Erling Smørgrav 430d064ba5 ctags: Support writing to stdout instead of a file.
* Understand "-" to mean stdout as per convention.
* Check that the output is a regular file and ignore -u if not, otherwise we might try to rm /dev/stdout.
* As a bonus, if -u was specified but the output file does not exist, proceed as if -u had not been specified instead of erroring out.

MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	cracauer, debdrup
Differential Revision:	https://reviews.freebsd.org/D40237
2023-05-25 13:22:18 +00:00
Dag-Erling Smørgrav 5afab0e5e5 ldns: Upgrade to 1.8.3.
Merge commit 'cf3e3d5bd0a1fae39c74c7db5a4e8b10732d0766'

Reviewed by:	emaste
Differential Revision:	https://reviews.freebsd.org/D40226
2023-05-24 15:50:18 +00:00
Dag-Erling Smørgrav 5063211781 ctags: Error out if writing to stdout failed.
MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	cracauer, allanjude
Differential Revision:	https://reviews.freebsd.org/D40200
2023-05-23 17:31:28 +02:00
Simon J. Gerraty 477f6e3c96 sys.dirdeps.mk use ?= for OBJTOP
This broke bmake's after-import step.
2023-05-13 10:46:24 -07:00
Simon J. Gerraty e0e24ae5d6 bmake forloop test was removed 2023-05-13 10:12:08 -07:00
Warner Losh b61a573019 spdx: The BSD-2-Clause-NetBSD identifier is obsolete, drop -NetBSD
The SPDX folks have obsoleted the BSD-2-Clause-NetBSD identifier. Catch
up to that fact and revert to their recommended match of BSD-2-Clause.

Discussed with:		pfg
MFC After:		3 days
Sponsored by:		Netflix
2023-05-12 10:44:04 -06:00
Warner Losh 4d846d260e spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD
The SPDX folks have obsoleted the BSD-2-Clause-FreeBSD identifier. Catch
up to that fact and revert to their recommended match of BSD-2-Clause.

Discussed with:		pfg
MFC After:		3 days
Sponsored by:		Netflix
2023-05-12 10:44:03 -06:00
Dag-Erling Smørgrav 09aee57098 tsort: Add unit tests.
MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D40043
2023-05-10 15:45:44 +02:00
Dag-Erling Smørgrav b55bc49e86 tsort: Replace bcopy() with memcpy().
Also fix an indentation error I introduced in the previous commit.

Fixes:		cb46f47c79
MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D40042
2023-05-10 15:45:38 +02:00
Dag-Erling Smørgrav cb46f47c79 tsort: Error out if writing to stdout failed.
MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	kevans, imp
Differential Revision:	https://reviews.freebsd.org/D39959
2023-05-04 18:51:11 +00:00
Dag-Erling Smørgrav 5903d9c00b ncal: Error out if writing to stdout failed.
MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	kevans, imp
Differential Revision:	https://reviews.freebsd.org/D39958
2023-05-04 18:51:10 +00:00
Xin LI d713e0891f MFV: less v632.
MFC after:	2 weeks
2023-05-01 20:43:57 -07:00
Simon J. Gerraty 090e9752d7 Additions to targets/pseudo/host-tools
More tools needed to be built for Linux.
These are the ones that "just work".
2023-04-27 14:16:49 -07:00
Eugene Grosbein 83fd35b3f3 logger(1): fix timestamps in case of long run
An example:

( echo test; sleep 2; echo test2 ) | logger -h /var/run/log

Before fix, logger assigned same timestamp to both records.

Fixes:		65547fb33d
Reported by:	Vadim Goncharov
MFC after:	1 week
2023-04-27 23:43:16 +07:00
Yuri Pankov 01007472ea getconf(1): add DEALLOC_PRESENT
Allow getconf to query _PC_DEALLOC_PRESENT pathconf(2) variable
added in 0dc332bff2.

Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D39796
2023-04-26 13:13:36 +02:00
Simon J. Gerraty cb3c414f2f bmake does not need libegacy 2023-04-24 16:55:45 -07:00
Simon J. Gerraty 8c973ee23d Merge bmake-20230414
Merge commit '51d8a8b4ac1dd7265e891149e470a803906de2a7'
2023-04-24 16:50:16 -07:00
Simon J. Gerraty 976ba7f02a Enable building tar for non-FreeBSD host
For DIRDEPS_BUILD we need Makefile.depend.options to
force libegacy to be built on older FreeBSD and non-FreeBSD hosts.

Add readpassphrase to libegacy to avoid the need for libbsd on Linux

src.opts.mk disable TESTS for host if MK_host_egacy is yes

Reviewed by:	imp
Sponsored by:	Juniper Networks, Inc.
Differential Revision:	https://reviews.freebsd.org/D39766
2023-04-24 10:20:17 -07:00
John Baldwin 4640fd28a1 netstat: Use valid prototypes for function declarations with no arguments.
Reviewed by:	emaste
Differential Revision:	https://reviews.freebsd.org/D39731
2023-04-24 08:53:50 -07:00
Konstantin Belousov 043e24bdb0 posixshmcontrol(1): silently ignore inaccessible segments when listing
PR:	271038
Reported by:	rau8344@gmail.com
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2023-04-24 02:38:48 +03:00
Simon J. Gerraty 188bf8876f Build host tools on non-FreeBSD host with DIRDEPS_BUILD
Add Makefile.depend.options to libnetbsd, mkimg and makefs
to ensure libegacy is build if needed.

targets/pseudo/stage/Makefile avoid the need for mtree
the staging process creates target dirs as needed anyway.

Reviewed by:	stevek
Sponsored by:	Juniper Networks, Inc.
Differential Revision:	https://reviews.freebsd.org/D39757
2023-04-22 13:13:22 -07:00
Cameron Katri 81fa5c4a82 llvm-strings: Install as strings when WITH_LLVM_BINUTILS=YES
Reviewed by:	emaste
Differential Revision:	https://reviews.freebsd.org/D32065
2023-04-21 16:13:40 -04:00
Ed Maste 41df1d60e3 llvm: fix some llvm-* tool links when WITH_LLVM_BINUTILS is set
A few Makefiles overrode LINKS and MLINKS when WITH_LLVM_BINUTILS was
set, which caused some llvm- prefixed tools to disappear.  One such case
was llvm-ranlib, which some ports invoke explicitly.

Use += when adding to LINKS and MLINKS under WITH_LLVM_BINUTILS.

PR:		270955, 270956, 270959
Submitted by:	jbeich
Reviewed by:	arichardson
Fixes: 021385aba5 ("Add WITH_LLVM_BINUTILS to install LLVM binuti...")
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D39747
2023-04-21 12:49:05 -04:00
Warner Losh e63690e885 truss: Kill dead code
If it doesn't exist, we don't need it in the table...

Sponsored by:		Netflix
2023-04-21 10:24:26 -06:00
Michael Tuexen ddf24a507c netstat: cleanup
protopr does not support reading from a core anymore.
So don't state that it can.

Reviewed by:		glebius, rscheff, rrs
MFC after:		1 week
Sponsored by:		Netflix, Inc.
Differential Revision:	https://reviews.freebsd.org/D39688
2023-04-20 23:52:19 +02:00
Gleb Smirnoff 8e813d07c6 netstat: fix printing of TCP pcbs with -A
This change touches both kernel and netstat(1), but either of the changes
will fix printing pcb addresses with -A.

The thing is that historically netstat(1) treated TCP differently, and
printed tcpcb address instead of inpcb address.  This is not documented
anywhere!  With e68b379244 these two addresses became the same.  It is
highly likely they will be the same for a long time, but it might be they
will start to differ again in a far future.  My proposal is to stop
treating TCP differently with netstat(1) and right now is a good opportunity
to do that, since there will be no behavior change at all.  The kernel
change to tcp_inptoxtp() will go into stable/14 to make it compatible with
netstat(1) binary from stable/13.  We can drop it later, probably together
with in_ppcb pointer from inpcb.  The in_ppcb in xinpcb will stay for size
compatibility.

Reviewed by:		tuexen, rrs
Differential Revision:	https://reviews.freebsd.org/D39736
2023-04-20 12:42:42 -07:00