The divert(4) is not a protocol of IPv4. It is a socket to
intercept packets from ipfw(4) to userland and re-inject them
back. It can divert and re-inject IPv4 and IPv6 packets today,
but potentially it is not limited to these two protocols. The
IPPROTO_DIVERT does not belong to known IP protocols, it
doesn't even fit into u_char. I guess, the implementation of
divert(4) was done the way it is done basically because it was
easier to do it this way, back when protocols for sockets were
intertwined with IP protocols and domains were statically
compiled in.
Moving divert(4) out of inetsw accomplished two important things:
1) IPDIVERT is getting much closer to be not dependent on INET.
This will be finalized in following changes.
2) Now divert socket no longer aliases with raw IPv4 socket.
Domain/proto selection code won't need a hack for SOCK_RAW and
multiple entries in inetsw implementing different flavors of
raw socket can merge into one without requirement of raw IPv4
being the last member of dom_protosw.
Differential revision: https://reviews.freebsd.org/D36379
The target modifiers (-g, -p, -u) may occur in any position except
between -n and its argument; furthermore, we support both the old
absolute form (without -n) and the modern relative form (with -n).
Sponsored by: Klara, Inc.
Replace the quoted printable code with one that respects RFC2045
Add tests about this parsers and encoders, using examples from the
wikipedia page.
Reviewed by: pstef
Differential Revision: https://reviews.freebsd.org/D36314
The minigzip(1) was initially introduced as a minimal replacement
of GNU gzip(1). We have replaced the GNU gzip(1) with the zlib
based, GPL-free implementation, and minigzip(1) is not being used
anywhere in the base system, so just remove it.
Relnotes: yes
Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D35979
If the -c flag is used, then we can set it with ICONV_SET_DISCARD_ILSEQ;
otherwise, leave it alone. The user may have specified //IGNORE in the
'to' codeset specification, there's no reason we can't allow that but
we'll currently turn it off.
Reviewed by: thj
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D34342
- new sentence, new line
- unknown AT&T UNIX version: At v7
- no blank before trailing delimiter
- reference the ASCII(8) manual page
MFC after: 5 days
The single line comment indicator '//' is only detected at the
beginning of a line or when following white space to allow URLs
in calendar entries.
MFC after: 3 days
Given the way bmake/unit-tests is visited, when doing 'test'
MK_AUTO_OBJ=yes will not be effective.
So create the objdir before running the sub-make.
Also ensure MAKEOBJDIR is passed to opt-m-include-dir
Reviewed by: deo
nl actually first was available with System III, not System Vr2. Updated
based on discussion on TUHS mailing list (archive recently moved so this
message isn't get available in the archive).
Suggested by: segalogo (Matt G)
Commit e7fd9688ea changed vtfontcvt's command line parsing, but did
not correctly update the usage (it omitted the new -o flag).
Fixes: e7fd9688ea ("Move font related data structured to...")
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Replace struct timeval in header with struct timespec.
To differentiate header formats, add a new KTR_VERSIONED flag
set in the header type field similar to the existing KTRDROP flag.
To make it easier to extend ktrace headers in the future,
extend the existing header with a version field (version 0 is
reserved for older records without KTR_VERSIONED) as well as
new fields holding the thread ID and CPU ID.
Reviewed by: jhb, pauamma
Differential Revision: https://reviews.freebsd.org/D35774
MFC after: 2 weeks
The reason is that in order to protect a process procctl(2) needs
the PRIV_VM_MADV_PROTECT privilege, which is currently denied in jails
(see kern_jail.c).
MFC after: 1 week
This allows for easy copy-and-paste of a unix(4) peer name for lookup.
With current implementation it is guaranteed that a peer listed could be
found in the output.
Differential revision: https://reviews.freebsd.org/D35727
Kernel provides us with enough information to display all possible
connections between UNIX sockets.
o Store unp_conn, xu_firstref and xu_nextref in the faddr of a UNIX sock.
o Build tree of file descriptors, indexed by the socket pointer.
o In displaysock() print out all possible information:
1) if socket is bound, print name of this socket
2) if socket has connected to a peer with a name, print peers name
3) if socket has connected to a peer without a name, print [pid fd]
4) if a bound socket has received connections, print list of them
as [pid fd]
Previously, only 1) either 2) were printed.
Reviewed by: tuexen
Differential revision: https://reviews.freebsd.org/D35726
Three digit file descriptors are very common these days. So let the
columns not break with them.
Reviewed by: tuexen
Differential revision: https://reviews.freebsd.org/D35725
o Use tree to lookup by socket kvaddr. The size of hash is too big for a
small virtual machine and at the same time too little for a large
production server. A tree would better fit here.
o For those pcbs, that don't have a socket associated, use a list.
o Provide a second tree to lookup by pcb kvaddr. These removes full hash
traversal when printing every unix(4) socket.
Reviewed by: tuexen
Differential revision: https://reviews.freebsd.org/D35724
The field for interface names for netstat -i was 5 characters by
default, which is no longer sufficient with names like "vlan1234"
and "vtnet0". netstat -iW computed the necessary field width, but
also enlarged the address field by a lot (especially with IPv6 enabled).
Make netstat -i compute the field width for interface names with or
without -W. Note that the existing default output does not fit in
80 columns in any case. Update the man page accordingly, documenting
the remaining effect of -W with -i. Also add -W to the list of
General Options, as there are numerous pointers to this.
Reported by: Chris Ross
Reviewed by: melifaro, rgrimes, cy
Differential Revision: https://reviews.freebsd.org/D35703
MFC after: 1 week
If the line with replacement cannot be constructed xargs should
terminate as documented in the man page
We encounter this error, but gnu/xargs doesn't because they have a much
larger limit for created outputs (~10000 lines).
Reviewed by: oshogbo
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D35574
This avoids the need for dealing with converting lwpinfo for alternate
ABIs in gcore itself.
Reviewed by: markj
MFC after: 2 weeks
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D35667
These are no longer needed after commit 4965ac059d which used
PT_GETREGSET to fetch NT_PRSTATUS and NT_FPREGSET.
Reviewed by: markj, emaste
MFC after: 2 weeks
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D35665
named(8) hasn't been in base for some time. Remove all references to it in
manual pages.
Approved by: manpages (Pau Amma)
Differential Revision: https://reviews.freebsd.org/D35586
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
print_cmsg() was assuming that the control message chain is well-formed,
but that isn't necessarily the case for sendmsg(2). In particular, if
cmsg_len is zero, print_cmsg() will loop forever. Check for truncated
headers and try to recover if possible.
Reviewed by: tuexen
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D35476
This version adds support for command line editing and history using
the libedit or readline libraries in addition to the line editing
features available in previous versions.
The version in the base system is configured to use libedit.
This allows to choose between emacs and vi line editing commands and
to use command overrides via a ~/.editrc file.
Merge commit 'bd54318046bfee055b140705a5cfd4148e78da07'
PR: 264010
MFC after: 2 weeks
This is needed when building natively as a cross-tool on hosts such as
Linux using more recent versions of libstdc++.
Co-authored-by: Alexander Richardson <arichardson@FreeBSD.org>
Obtained from: CheriBSD
This ensures read-only PT_LOAD segments are not marked as writable in
the phdr flags.
Reviewed by: markj
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D35398
Mbufs leak when manually removing incomplete NDP records with pending packet via ndp -d.
It happens because lltable_drop_entry_queue() rely on `la_numheld`
counter when dropping NDP entries (lles). It turned out NDP code never
increased `la_numheld`, so the actual free never happened.
Fix the issue by introducing unified lltable_append_entry_queue(),
common for both ARP and NDP code, properly addressing packet queue
maintenance.
Reviewed By: melifaro
Differential Revision: https://reviews.freebsd.org/D35365
MFC after: 2 weeks
`setvar` is a non-conformant feature that looks slightly neater but is
not portable to other /bin/sh implementations. Making the script
portable is straightforward, so let's do it.
Tests are added to make sure that I didn't break anything major in the
process.
Reviewed by: bapt (previous version), jilles
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D35275
Commit 5218d82c81 added a new NFSv4.1/4.2 procedure called
AppendWrite that uses a Verify to avoid a separate Getattr RPC
for the common case where the client knows the correct file
size for O_APPEND writes.
This patch modifies nfsstat so that it displays a count of
these new RPCs for the "-E -c" option.
With M_EXTPG mbufs these two counters already do not represent the
reality. As we are moving towards protocol independent socket buffers,
which may not even use mbufs at all, the counters become less and less
relevant. The only userland seeing them was 'netstat -x'.
PR: 264181 (exp-run)
Reviewed by: markj
Differential revision: https://reviews.freebsd.org/D35334
This is an initial commit for RDMA FreeBSD driver for Intel(R) Ethernet
Controller E810, called irdma. Supporting both RoCEv2 and iWARP
protocols in per-PF manner, RoCEv2 being the default.
Testing has been done using krping tool, perftest, ucmatose, rping,
ud_pingpong, rc_pingpong and others.
Signed-off-by: Eric Joyner <erj@FreeBSD.org>
Reviewed by: #manpages (pauamma_gundo.com) [documentation]
MFC after: 1 week
Relnotes: yes
Sponsored by: Intel Corporation
Differential Revision: https://reviews.freebsd.org/D34690
As an example:
printf 'We don=27t know what to do with other=20worlds.=0D=0A' \
| bintrans qp -u
Differential Revision: https://reviews.freebsd.org/D34933
Reviewed by: debdrup (manpage)
o ignore '.POSIX:' if not in first non-comment line
of Makefile as specified by POSIX.
add unit-tests for above.
Merge commit '92bfae0e6bd53a7a0d6fe55e70a916d86cf26e8b'
When invoked by inetd, ctlstat -P will now produce output suitable for
ingestion into Prometheus.
It's a drop-in replacement for https://github.com/Gandi/ctld_exporter,
except that it doesn't report the number of initiators per target, and
it does report time and dma_time.
MFC after: 2 weeks
Sponsored by: Axcient
Relnotes: yes
Reviewed by: bapt, bcr
Differential Revision: https://reviews.freebsd.org/D29901
diff3 in -m mode generates a complete file with changes bracketed with
conflict markers. This adds support for diff3 to generate version
control style three way merge output.
The output format was inferred from looking at the gnu diff3 output on a
selection of test files as a specification of what diff3 -m should
output is not available. It is likely there are cases where the -m
output differs from other tools and I am happy to update diff3 to
address these.
Discussed with: pstef, kevans
Sponsored by: Klara, Inc.
Diff3 in -A mode generates an ed script to show how the 3 files and
brackets changes that conflict. The ed script generated should when
applied leave familiar merge conflict markers in a patched file.
Diff3 output is not documented, this feature has been arrived at by
comparing bsd diff3 output to gnu diff3 output until they were made to
agree. There are likely to still be differences between these formats.
The gnu diff3 guide is actually quite good at explaining how diff3
output should appear, but it doesn't cover every form of output from
diff3.
https://www.gnu.org/software/diffutils/manual/diffutils.html#Comparing-Three-Files
Discussed with: pstef, kevans
Sponsored by: Klara, Inc.
Replace the edscript code that tracked and printed lines using byte
offsets with code that can work from line offsets.
This tidies up the reduces duplication in the edscript output code. It
also fixes the usage of the de struct so that it only tracks diffs as
line offsets rather than the usage changing from line offsets to byte
offsets during the lifetime of diff3.
Large files with large numbers of ranges will probably suffer in
performance here, but as we don't use diff3 yet this isn't a regression.
Include a warning for future hackers so they have a place to start
hacking from.
Reviewed by: pstef
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D34941
This test cannot run without an unprivileged_user being specified
anyways, so just run as the unprivileged user. Revoking read permisions
works just as well if you're guaranteed non-root.
Reviewed by: pstef
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D34950
Various scripts expect the base64 command to be present. We've had the
code and it's been exposed as b64encode/b64decode, but it wasn't widely
known under these names and the syntax is much different.
Reviewed by: delphij
Differential Revision: https://reviews.freebsd.org/D32945
This functionality is present in GNU base64 and I find it useful when
I want to generate random, ASCII-clean data of specific width.
Reviewed by: delphij
Differential Revision: https://reviews.freebsd.org/D32944
The program will be installed as bintrans, uuencode, uudecode,
b64encode, and b64decode and will be responsible for running the coders
according to their historical behavior.
Additionally, bintrans will be able to take a parameter designating
the coder and accept all its options in this form:
bintrans <coder> [options]
and the behavior should be the same as if
<coder> [options]
was invoked.
This has the advantage that adding coders won't require installing them
as binaries.
Move uudecode files to uuencode since the latter is the one that
provides the manual page.
Reviewed by: delphij (previous version)
Differential Revision: https://reviews.freebsd.org/D32943
diff3 with the -e (ed script flag) can generate line deletions, add
support for deletions and add a test case to exercise this behaviour.
This functionality was unearthed through comparison of bsd diff3 and gnu
diff3 output.
Reviewed by: pstef
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D34912
Fix a typo, and move a sentence onto a new line in accordance with
mdoc(7) syntax.
While here, also remember to bump .Dd accordingly, as it was missed in
the prior commit.
Reported by: maxim@
Improve discoverability of the functionality by mentioning in the
userland tool manual. Add a SEE ALSO entry to rc.conf(5) where more
details are provided.
Sponsored by: Fudo Security (a.wolk)
Differential Revision: https://reviews.freebsd.org/D30334
Add PS_MODE_NO_KINFO_PROC cmd modifier that indicates that neither
process list should be queried from the kernel, nor list of pids or `-a`
switch provided on the command line to filter the output.
This is intended for use by commands that query information not
neccessary attributed to specific process.
Reviewed by: markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D34834
Some of the lists were not displaying correctly. Fix that.
Also, address linters errors.
Fixes: 22054f8891 Report I/O stats from the CAM_IOSCHED_DYNAMIC extension
MFC after: 1 week
This more clearly differentiates system call arguments from integer
registers and return values. On current architectures it has no effect,
but on architectures where pointers are not integers (CHERI) and may
not even share registers (CHERI-MIPS) it is necessiary to differentiate
between system call arguments (syscallarg_t) and integer register values
(register_t).
Obtained from: CheriBSD
Reviewed by: imp, kib
Differential Revision: https://reviews.freebsd.org/D33780
This register set contains the values of the fsbase and gsbase
registers. Note that these registers can already be controlled
individually via ptrace(2) via MD operations, so the main reason for
adding this is to include these register values in core dumps. In
particular, this will enable looking up the value of TLS variables
from core dumps in gdb.
The value of NT_X86_SEGBASES was chosen to match the value of
NT_386_TLS on Linux. The notes serve similar purposes, but FreeBSD
will never dump a note equivalent to NT_386_TLS (which dumps a single
segment descriptor rather than a pair of addresses) and picking a
currently-unused value in the NT_X86_* range could result in a future
conflict.
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D34650
This register set exposes the per-thread TLS register. It matches the
layout used by Linux on arm64. Linux does not implement this note for
32-bit arm.
Reviewed by: andrew, markj
Sponsored by: University of Cambridge, Google, Inc.
Differential Revision: https://reviews.freebsd.org/D34595
This includes adding support for NT_ARM_VFP for 32-bit binaries
running under aarch64 kernels both for ptrace(), and coredumps via the
kernel and gcore.
Reviewed by: andrew, markj
Sponsored by: University of Cambridge, Google, Inc.
Differential Revision: https://reviews.freebsd.org/D34448
The PID of the logger process is always recorded along with the move from RFC
3164 to RFC 5424.
Indicate the -i flag is a no-op now in logger(1).
Related to a similary change in syslog.3
Reported by: danfe@
Approved by: manpages (0mp)
Fixes: 94eb6c42ab
Differential Revision: https://reviews.freebsd.org/D34578
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
The boot time entry doesn't have a tty specified, so don't check it.
While here, make ttystat handle that case.
Approved by: kevans (src)
Differential Revision: https://reviews.freebsd.org/D34524
If fstat(2) fails the close(2) won't be called, which will leak the
file descriptor.
The idea was borrowed from OpenBSD, where similar patch
was applied for futimens(2).
MFC after: 1 week
Add a elf_putregnote() helper to build the ELF note for a register
set. Once nice result of this approach is that this reuses the
kernel's support for generating 32-bit register sets for 32-bit
processes avoiding the need to duplicate that logic in elf32core.c.
Reviewed by: markj
Sponsored by: University of Cambridge, Google, Inc.
Differential Revision: https://reviews.freebsd.org/D34447
Add support for --help and --version to be compatible with gnu diff.
gnu diff --help writes to stdout, do the same to be compatible
Reviewed by: bapt, pstef, debrup, Pau Amma
Sponsored by: Klara Inc.
Differential Revision: https://reviews.freebsd.org/D34508
script -r is useful for recording time-stamps of when output
happened. With -T, rather than playback the script in real-time
we simply print the time-stamps to show when the output happened.
This is very useful for example, for analyzing boot time activity.
If the fmt provided contains no % characters the default
%n@ %s [%Y-%m-%d %T]
is used, which lends itself to analysis by tools as well as humans.
Sponsored by: Juniper Networks, Inc.
Reviewed by: allanjude
Differential Revision: https://reviews.freebsd.org/D34511
In b5541f456d when flags were converted to
be boolean, the setting of cflag as an integer was removed, but no
boolean set was added.
This effects the output format of dates, but the context type was set to
D_CONTEXT so other functionality worked.
Reviewed by: bapt
Sponsored by: Klara Inc.
Differential Revision: https://reviews.freebsd.org/D34481