Aaron LI [Tue, 31 Oct 2023 01:06:01 +0000 (09:06 +0800)]
socket: Implement the SO_USER_COOKIE option
This socket option allows to attach an arbitrary uint32_t value to a
socket as the user-defined cookie/metadata, and then the cookie can be
used in the kernel help manipulate the traffic of the socket.
For example, this socket option can be set by WireGuard and then matched
in IPFW to help control the WireGuard traffic.
This commit is mostly derived from FreeBSD, but I decided to also
support this option in getsockopt().
Note that the support of this option in IPFW (and PF and others) is
still need to be implemented. I'd like to do it in the future but it
may take quite some efforts. This commit alone doesn't achieve much
benefits, but it helps port the WireGuard code from FreeBSD, so commit
it first.
Bump __DragonFly_version.
Credit: https://github.com/freebsd/freebsd-src/commit/
d5e8d236f4009fc2611f996c317e94b2c8649cf5
Matthew Dillon [Tue, 23 Jan 2024 21:00:54 +0000 (13:00 -0800)]
kernel - Fix long-standing bug in kqueue backend for *poll*()
* The poll() family of system calls passes an fds[] array with a
series of descriptors and event requests. Our kernel implementation
uses kqueue but a long standing bug breaks situations where
more than one fds[] entry for the poll corresponds to the same
{ ident, filter } for kqueue, causing only the last such entry
to be registered with kqueue and breaking poll().
* Added feature to kqueue to supply further distinctions between
knotes beyond the nominal { kq, filter, ident } tuple, allowing
us to fix poll().
* Added a FreeBSD feature where poll() implements an implied POLLHUP
when events = 0. This is used by X11 and (perhaps mistakenly) also
by sshd. Our poll previous ignored fds[] entries with events = 0.
* Note that sshd can generate poll fds[] arrays with both an events = 0
and an events = POLLIN for the same descriptor, which broke sshd
when I initially added the events = 0 support due to the first bug.
Now with that fixed, sshd works properly. However it is unclear whether
the authors of sshd intended events = 0 to detect POLLHUP or not.
Reported-by: servik (missing events = 0 poll feature)
Testing: servik, dillon
Sascha Wildner [Wed, 17 Jan 2024 14:34:56 +0000 (15:34 +0100)]
config.8: Remove markup in the -width, also make it non-compact.
Aaron LI [Wed, 17 Jan 2024 05:21:31 +0000 (13:21 +0800)]
netproto/mpls: Fix 'cpuid' to be 'mycpuid' and thus fix build
The typo was made by me in commit
6823c302c37b3feda6c2c8b524a99daa1bcff11f.
After this fix, LINT64 builds fine.
Matthew Dillon [Tue, 16 Jan 2024 22:52:27 +0000 (14:52 -0800)]
dsynth - Adjust /boot mounts for chroot
* Fix issue where Intel microcode couldn't be installed within the
chroot due to trying to write into /boot.
* Replace /boot null-mount with a /boot tmpfs and mkdir /boot/modules.local.
Leave other /boot directories unpopulated for now (we'll fix that if we
hit problems). i.e. no /boot/kernel or anything else is in the chroot
any more.
* This also allows us to remove the /boot/modules.local tmpfs mount we had
before, improving performance slightly.
Reported-by: tuxillo
Matthew Dillon [Tue, 2 Jan 2024 04:57:00 +0000 (20:57 -0800)]
Add integrated dports build feature to build-all and install-all targets
When WITH_DPORTS=YES is used build-all and install-all, these targets will
also build the base set of ports and all of their dependencies using
configuration data and the "dragonfly/base" dport found in
"/usr/src/dports.base".
This feature is intended to be used by the nrelease build in an upcoming
commit, and may also be used manually.
The /usr/dports tree must exist and contains the dports repo to use as the
basis of the dports build. It will be null-mounted in the chroot and the
"/usr/src/dports.base/dragonfly" directory will be null-mounted under it
to provide the "dragonfly/base" meta-port. The DPORTSBASE make variable
may be used to override the location of the main dports repo.
The build-all and install-all targets use a sophisticated chrooted
environment to do a completely clean dports build with dsynth. It
It will actually "make installworld" plus a clean "make distribution"
inside the chroot environment to create the environment, and the host
system's /etc/resolv.conf will be copied in.
build-all - Augmented when used WITH_DPORTS=YES
install-all - Augmented when used WITH_DPORTS=YES
buildportschroot - Build a fresh chroot environment for dsynth
mountports - Do all null mounts and cp's needed for the env
buildports - Run dsynth build dragonfly/base in the env
installports - Install the built ports on the host system (see note)
umountports - Remove the null mounts
WITH_DPORTS=YES - executes buildportschroot, mountports, buildports,
and umountports when run from build-all.
executes mountports, installports, umountports
when run from install-all.
DPORTSBASE=path - Defaults to /usr/dports, may be used to override
the location where the main dports tree can be
found.
NOTE: Installports may require interactivity as the base system might already
have installed ports. Generally speaking it is best to not revert any
ports you might already have installed, so feel free to tell it not to
install anything.
* Added various make targets and augmented build-all and install-all
* /usr/local/sbin added and the stale /usr/pkg/bin removed from _HOSTPATH.
* Add /usr/src/dports.base infrastructure.
It contains the dsynth.ini and pkg.conf files that will be used for the
local dsynth operations. Some paths are replaced with SED when copied
to the chroot. The dsynth.ini is relative to the chroot.
It also contains the dragonfly/base dport which is the meta-port that
dsynth will be told to build.
All other dports related files and directories are null-mounted from
/usr/dports.
* Add /usr/distfiles.base to mtree/BSD.usr.dist. This directory is also
created by the build if it does not exist since the host system might
not have run a new installworld recently.
This directory will be used during build-all (buildports) to store the
distfiles required to build dragonfly/base, so they only need to be
fetched once.
* Add the "-C ConfigBase" option to dsynth to make running it from the
chrooted environment easier. This overrides the /etc/dsynth directory
and removes /etc/dsynth as a fallback.
* dsynth conditionalizes calling syscap_set() for backwards compatibility
with older host systems that might not have been upgraded to include the
feature yet.
Aaron LI [Sun, 14 Jan 2024 07:31:51 +0000 (15:31 +0800)]
atomic.9: Some small updates
- Add some more description obtained from FreeBSD.
- Uncomment the 64-bit variant contents.
- Minor wording tweaks.
Aaron LI [Sun, 14 Jan 2024 07:27:33 +0000 (15:27 +0800)]
atomic(9): Add relaxed load/store variants from FreeBSD
Obtained from FreeBSD. However, the original atomic_store_ptr() macro
was causing '-Wcast-qual' warnings, so I changed it based on the
NetBSD's atomic_store_relaxed().
Actually, I found NetBSD's version more clean, but we import the FreeBSD
version to help import code/drivers in the future.
Discussed-with: dillon
Aaron LI [Mon, 8 Jan 2024 10:35:41 +0000 (18:35 +0800)]
crypto/chachapoly: Allow output be NULL in decrypting empty plaintext
Don't distinguish the input cipher data from AD by checking whether the
output buffer is NULL, because it's actually valid to pass it as NULL
when to decrypt a message of empty plaintext. And it's really used by
WireGuard.
So separate the AD process code into a separate helper function named
_chacha20poly1305_update_ad(). Update the assertions to not blindly
assert 'out != NULL'. Also add a note about this special case to the
header file.
Aaron LI [Fri, 24 Nov 2023 05:39:56 +0000 (13:39 +0800)]
crypto: Implement chacha20poly1305 in-place process for mbuf chains
Implement the chacha20poly1305_{encrypt,decrypt}_mbuf() functions that
performs in-place encryption and decryption for data in an mbuf chain.
The in-kernel WireGuard will use these two functions to encrypt/decrypt
packets.
Aaron LI [Thu, 23 Nov 2023 09:56:45 +0000 (17:56 +0800)]
crypto: Refactor the chacha20poly1305 code to be more flexible
Introduce the 'chacha20poly1305_ctx' struct to hold the context, and
implement the _init()/_update()/_final() functions as the building
blocks to perform encryption/decryption in a more generic way.
The main intention is to help implement the in-place encryption and
decryption of data in an mbuf chain. That would reduce the unnecessary
memory allocations and data copies in packet manipulations, as needed by
the in-kernel WireGuard. This API will be done in a later commit.
Rewrite the original chacha20poly1305_{encrypt,decrypt}() functions
using the new blocks.
Aaron LI [Wed, 22 Nov 2023 01:39:42 +0000 (09:39 +0800)]
crypto: Add ChaCha20-Poly1305 and XChaCha20-Poly1305 AEAD
Derived from OpenBSD with significant modifications by me:
- Removed unused code to hook into the cryptosoft framework.
- Adjusted the interface to align with the IETF RFC document
(e.g., make the nonce a byte string other than a uint64_t),
so that the code becomes more generic.
References:
- RFC 8439: ChaCha20 and Poly1305 for IETF Protocols
- RFC draft: XChaCha: eXtended-nonce ChaCha and AEAD_XChaCha20_Poly1305
Aaron LI [Thu, 23 Nov 2023 09:34:00 +0000 (17:34 +0800)]
crypto: Add brief descriptions to every chacha20 public function
One important note is that chacha_encrypt_bytes() supports in-place
decryption/encryption. This point ensures that the chacha20poly1305
code also supports in-place operations.
Aaron LI [Tue, 21 Nov 2023 09:58:29 +0000 (17:58 +0800)]
crypto: Add hchacha20() for implementing XChaCha20-Poly1305 AEAD
Derived from OpenBSD. I changed memcpy() to multiple U32TO8_LITTLE()s,
so the output key is in the standard little-endian format.
Reference:
- RFC draft: XChaCha: eXtended-nonce ChaCha and AEAD_XChaCha20_Poly1305
Aaron LI [Fri, 17 Nov 2023 02:28:16 +0000 (10:28 +0800)]
crypto: Adjust curve25519 and hook to build
- Fix header inclusions.
- Add necessary '__inline' for '__always_inline' to fix build.
- Replace 'letoh32()' with 'le32toh()'.
- Adjust style a bit to be more consistent.
Aaron LI [Fri, 17 Nov 2023 01:26:03 +0000 (09:26 +0800)]
crypto: Import Curve25519 implementation from OpenBSD
Required by the in-kernel WireGuard VPN.
Aaron LI [Wed, 22 Nov 2023 02:26:07 +0000 (10:26 +0800)]
crypto: Some minor cleanups to poly1305
- Use 'uint8_t' instead of 'unsigned char', being more consistent with
other crypto code (e.g., chacha20)
- Add two more macros: POLY1305_KEY_SIZE, POLY1305_MAC_SIZE
Aaron LI [Fri, 17 Nov 2023 02:52:40 +0000 (10:52 +0800)]
crypto: Adjust poly1305 and hook to build
- Use all uppercase for macro constant (i.e., POLY1305_BLOCK_SIZE).
- Add 'inline' to two helper functions: U8TO32(), U32TO8()
Aaron LI [Fri, 17 Nov 2023 02:30:52 +0000 (10:30 +0800)]
crypto: Import Poly1305 implementation from OpenBSD
This hash algorithm is required to implement the Chacha20-Poly1305 AEAD
cipher as required by the in-kernel WireGuard VPN.
Aaron LI [Wed, 22 Nov 2023 05:35:47 +0000 (13:35 +0800)]
crypto: Remove unnecessary 'const' qualifiers in blake2s
Aaron LI [Fri, 17 Nov 2023 02:26:02 +0000 (10:26 +0800)]
crypto: Adjust blake2 and hook to build
Make necessary changes to make it build. Meanwhile, adjust the style a
bit to look more consistent.
Aaron LI [Fri, 17 Nov 2023 01:27:14 +0000 (09:27 +0800)]
crypto: Import BLAKE2s implementation from OpenBSD
Required by the in-kernel WireGuard VPN.
Aaron LI [Fri, 17 Nov 2023 01:13:27 +0000 (09:13 +0800)]
crypto: Adjust siphash a bit and hook to build
Aaron LI [Fri, 17 Nov 2023 00:43:37 +0000 (08:43 +0800)]
crypto: Import SipHash implementation from FreeBSD
Required by the in-kernel WireGuard VPN.
Aaron LI [Thu, 16 Nov 2023 07:56:31 +0000 (15:56 +0800)]
<sys/cdefs.h>: Add __min_size(x) macro
C99 allows to use the 'static' keyword in function array parameter
declarators, which helps the compiler better validate the passed
argument and optimize code. However, this syntax isn't allowed in C++.
This macro allows us both to use this C99 feature and to use the headers
in C++.
Obtained-from: FreeBSD
URL: https://reviews.freebsd.org/D8277
Aaron LI [Fri, 29 Dec 2023 01:26:33 +0000 (09:26 +0800)]
<sys/bitops.h>: Import ilog2(n) from NetBSD
And thus remove the local define from 'nvmm_os.h'.
Aaron LI [Fri, 22 Dec 2023 14:59:46 +0000 (22:59 +0800)]
objcache(9): Remove the unused ocflag arg from objcache_reclaimlist()
Aaron LI [Fri, 12 Jan 2024 04:08:41 +0000 (12:08 +0800)]
sockbuf: Improve sbcreatecontrol() parameter types to save casts
- Change 'caddr_t p' to 'const void *p' to save casts for the callers.
The 'const' qualifier is also added meanwhile.
- Change 'int size' to 'size_t size', given that callers generally pass
this parameter as sizeof().
- Update all relevant callers.
For the reference, OpenBSD also did this for sbcreatecontrol().
Aaron LI [Fri, 12 Jan 2024 00:50:32 +0000 (08:50 +0800)]
mbuf(9): Add assertions of off/len parameters for _m_copyback2()
Similar to the similar assertions in several other functions.
Aaron LI [Thu, 4 Jan 2024 00:23:47 +0000 (08:23 +0800)]
evdev: Translate KEY_102ND in evdev_scancode2key()
This is the extra key on AT 102/105-keys keyboards, located just on the
right of the Left Shift key. For instance on a French layout, this key
is used to type '<' and '>'.
This fixes an issue where the key fires no evdev event and thus remains
inactive in an evdev/libinput-enabled X.Org server. The issue only
occurred on an AT keyboard; the same key on a USB keyboard worked fine.
Reported-by: daftaupe
Tested-by: daftaupe, Kentish
Obtained-from: FreeBSD (https://reviews.freebsd.org/D12883)
Aaron LI [Wed, 3 Jan 2024 04:01:39 +0000 (12:01 +0800)]
mbuf(9): Add assertion of 'offset == 0' for m_devget()
As commented above the m_devget() function, the 'offset' argument is
ill-defined and unused; all callers should specify 0 for it. So add an
assertion for that.
Meanwhile, fix two callers that didn't satisfy this.
Aaron LI [Wed, 3 Jan 2024 03:58:08 +0000 (11:58 +0800)]
mbuf(9): Tweak a wrongly wrapped conditional in m_free()
Aaron LI [Wed, 3 Jan 2024 03:51:57 +0000 (11:51 +0800)]
mbuf(9): Fix a serious bug: remove extra pointer to caddr_t/c_caddr_t
The 'caddr_t' and 'c_caddr_t' types are already *pointer* to 'char' and
'const char', respectively, so no need and can't add one more pointer to
them.
This bug was my mistake in commit
ef09a3ed3479755d29ff48a4e81912847e96139a.
It broke the pointer arithmetic and caused some weird issues (e.g.,
system panic, SSH connection lost when transferring lots of data).
Aaron LI [Tue, 2 Jan 2024 02:25:22 +0000 (10:25 +0800)]
netbt: Add back m_len/m_pkthdr.len assignments in rfcomm_session_send_mcc()
Similar to the fix in the previous commit.
Aaron LI [Tue, 2 Jan 2024 01:54:51 +0000 (09:54 +0800)]
netbt: Add back m_len/m_pkthdr.len assignments in l2cap_send_signal()
In case the 'length' being zero, the m_len/m_pkthdr.len will not be
updated by m_copyback2() and hence are wrong. Fix it to match the
original behavior.
Aaron LI [Mon, 1 Jan 2024 13:56:58 +0000 (21:56 +0800)]
net: Remove unnecessary casts for m_copyback() in ip_mroute.c
It was missed in my previous commit
05d02a3813e2bef176c69d68035311fd2efbd031.
Aaron LI [Mon, 1 Jan 2024 13:44:50 +0000 (21:44 +0800)]
net: Update rt_msg_mbuf() to pre-allocate the required mbuf (chain)
Pre-calculate the required mbuf (chain) length and allocate it, and thus
just use m_copyback() instead of m_copyback2() as there is no longer
need to extend it.
Suggested-by: dillon
Aaron LI [Mon, 1 Jan 2024 13:25:24 +0000 (21:25 +0800)]
net: Fix my mistake in rt_msg_mbuf()
The given rtinfo->rti_info[] array can be empty, and hence no
m_copydata2() will be called to properly update the 'm_pkthdr.len' and
'm_len' fields. This was breaking WiFi (at least iwm, and very likely
others). Bring back the 'm_pkthdr.len' and 'm_len' assignments that was
removed in my previous commit
44647b48cc48ca54dc839a0c8652cd4960416c2b.
Reported-by: Kentish, noob237 (Gonzalo Nemmi)
Investigated-by: dillon
Aaron LI [Mon, 1 Jan 2024 13:09:16 +0000 (21:09 +0800)]
net: Fix my mistake in route_output()
The 'rtm' is created in this function and its message length (rtm_msglen)
can actually be smaller than the original mbuf length (m_pkthdr.len), so
the original m_adj() must be restored. It was erroneously removed in
my previous commit
44647b48cc48ca54dc839a0c8652cd4960416c2b. Fix it.
Aaron LI [Thu, 28 Dec 2023 06:17:26 +0000 (14:17 +0800)]
kernel: Remove unnecessary casts for updated mbuf(9) functions
Aaron LI [Thu, 28 Dec 2023 05:17:14 +0000 (13:17 +0800)]
mbuf(9): Various minor updates and style cleanups
- Fix the comment that MSIZE/MCLBYTES is defined in <sys/param.h>
instead of <machine/param.h>; update the man page accordingly.
- Adjust some type casts in mtod() to be more consistent.
- Add the '__unused' attribute to actually unused parameters.
- Remove unused NCL_INIT/NMB_INIT macros from 'uipc_mbuf.c'.
- Use '__func__' instead of hard-coding function names.
- Fix several typos.
- Various style cleanups, mainly whitesapce adjustments.
Aaron LI [Thu, 28 Dec 2023 03:31:06 +0000 (11:31 +0800)]
mbuf(9): Use 'void *' in several public APIs to save casts in callers
Update the following public APIs to use 'void *' or 'const void *'
instead of 'caddr_t'/'c_caddr_t'/'char *', so that callers no longer
need to do explicit casts:
- m_append()
- m_copyback()
- m_copyback2()
- m_copydata()
- m_devget()
- m_extadd()
Sascha Wildner [Wed, 27 Dec 2023 14:28:30 +0000 (15:28 +0100)]
Fix typos: uknown -> unknown
Aaron LI [Fri, 22 Dec 2023 07:59:49 +0000 (15:59 +0800)]
mbuf(9): Use 'c_caddr_t' (const) for m_copyback()/m_copyback2()
Aaron LI [Fri, 22 Dec 2023 07:45:25 +0000 (15:45 +0800)]
mbuf(9): Fix a code bug in m_dup_data()
Aaron LI [Thu, 21 Dec 2023 07:13:25 +0000 (15:13 +0800)]
opencrypto: Update crypto_copyback() to use m_copyback2(how=M_WAITOK)
crypto_copyback() has no return value and isn't expected to fail by the
caller, e.g., swcr_compdec(), so update it to use m_copyback2() with
how=M_WAITOK.
Note that caller swcr_compdec() uses 'M_INTWAIT' for kmalloc(), but that
doesn't make sense to mbuf functions, so use M_WAITOK instead for the
moment.
Discussed-with: dillon
Aaron LI [Thu, 21 Dec 2023 02:09:55 +0000 (10:09 +0800)]
kernel: Change some m_copyback() to m_copyback2()
For those require mbuf expansion, change m_copyback() to m_copyback2().
Aaron LI [Thu, 21 Dec 2023 01:44:28 +0000 (09:44 +0800)]
mbuf(9): Restrict m_copyback() to forbid mbuf expansion
Most uses of m_copyback() are in-place updates to a portion (e.g., the
header) of a packet, so no mbuf allocation is required. It's more clear
to make m_copyback() forbid mbuf expansion instead of let it implicitly
do allocation with how=M_NOWAIT. Due to the lack of a return value, the
caller is hard to identify an m_copyback() failure, so diagnostics info
will be printed to the console in that case.
Change the original m_copyback2() to be an inline function, and
implement both m_copyback() and m_copyback2() as wrappers of it.
Bump __DragonFly_version for this behavior change.
Discussed-with: dillon
Aaron LI [Fri, 22 Dec 2023 06:34:50 +0000 (14:34 +0800)]
mbuf(9): Improve m_copyback2() to use the trailing space
Make use of the trailing space of the last mbuf if available, both in
skipping the offset and in copying back the data.
As a side benefit of this change, the 'm0->m_len' field no longer needs
to be initialized and can simply be 0, as in a newly allocated mbuf.
Referred to both OpenBSD and FreeBSD; however, they only try to use the
trailing space in copying the data.
Aaron LI [Fri, 22 Dec 2023 05:45:20 +0000 (13:45 +0800)]
mbuf(9): Improve m_copyback2() to support mbuf clusters
Update to use m_getl() to allocate mbuf clusters whenever necessary.
Referred to OpenBSD.
Aaron LI [Fri, 22 Dec 2023 06:52:11 +0000 (14:52 +0800)]
mbuf(9): Minor cleanups to m_copyback2()
Aaron LI [Fri, 22 Dec 2023 06:51:49 +0000 (14:51 +0800)]
mbuf(9): Add m_copyback2() for a better m_copyback()
The existing m_copyback() may extends the mbuf chain if necessary, but
it doesn't return a value to indicate whether the allocation fails. In
addition, it doesn't allow to specify the M_WAITOK/M_NOWAIT flag for
mbuf allocation.
Extend m_copyback() and name it m_copyback2() that has the 'how'
parameter to specify M_WAITOK/M_NOWAIT flag and return an error code to
indication the success/failure.
Reimplement the original m_copyback() using m_copyback2() with
how=M_NOWAIT.
Referred-to: OpenBSD
Aaron LI [Fri, 22 Dec 2023 01:37:00 +0000 (09:37 +0800)]
kernel: Replace the deprecated m_copy() with m_copym()
Aaron LI [Thu, 21 Dec 2023 02:16:38 +0000 (10:16 +0800)]
net/ip_mroute: Remove unnecessary m_len/m_pkthdr.len assignments
The 'm_len' and 'm_pkthdr.len' are already set to 0 by m_gethdr().
Tomohiro Kusumi [Thu, 21 Dec 2023 10:13:07 +0000 (02:13 -0800)]
sys/vfs/hammer2: Remove obsolete comment on device buffer size
Remove a comment from
01eabad4d93a8dc8f0f01a6209b384b1e010bb8c in 2012.
A device buffer size is currently always 64KB regardless of chain bytes.
HAMMER2_MIN_ALLOC no longer exists.
Tomohiro Kusumi [Thu, 21 Dec 2023 09:23:13 +0000 (01:23 -0800)]
sys/vfs/hammer2: Remove obsolete comments on chain statistics
Remove comments for removed code from
b3659de2a6ee73b51bf3edb4babfb4653134813f in 2014.
Aaron LI [Mon, 18 Dec 2023 02:14:15 +0000 (10:14 +0800)]
sys/platform: Add missing copyright for two header files
Aaron LI [Thu, 30 Nov 2023 02:13:01 +0000 (10:13 +0800)]
queue(3): Simplify STAILQ_LAST() by using __containerof()
Note that it's necessary to use 'field.stqe_next' instead of 'field';
otherwise, __containerof() would warn about the type mismatch.
Obtained-from: FreeBSD
Aaron LI [Wed, 29 Nov 2023 07:39:38 +0000 (15:39 +0800)]
<sys/cdefs.h>: Add __containerof(x, s, m) macro
Obtained from FreeBSD.
Aaron LI [Tue, 19 Dec 2023 01:26:48 +0000 (09:26 +0800)]
ifconfig.8: More markup tweaks
The main change is replacing 'Sy' with 'Cm', since those symbols are
intended to be given on the command line as arguments.
Aaron LI [Thu, 14 Dec 2023 10:06:14 +0000 (18:06 +0800)]
ifconfig.8: Alphabetically sort the general parameters
Aaron LI [Thu, 14 Dec 2023 09:53:17 +0000 (17:53 +0800)]
ifconfig.8: Remove the legacy and commented eon(5) and OSI stuffs
The eon(5) seems to be related to RFC 986, "which appears to be a rough
ISO equivalent of the IPv6 6to4 transition mechanism." [0]
The "nsellength" thing seems to be related to OSI networking.
These commented contents has been there since 1996 in FreeBSD codebase.
I don't see a point to still keep them, so just remove these legacy
stuffs.
[0] https://gnats.netbsd.org/10500
Aaron LI [Thu, 14 Dec 2023 07:35:09 +0000 (15:35 +0800)]
ifconfig.8: Some more minor fixes/tweaks/cleanups
Aaron LI [Thu, 14 Dec 2023 07:34:07 +0000 (15:34 +0800)]
ifconfig.8: Replace some 'Fl' with 'Cm' for consistency
Aaron LI [Thu, 14 Dec 2023 05:28:40 +0000 (13:28 +0800)]
ifconfig.8: Various markup improvements to WLAN parameters
Referred-to: FreeBSD
Aaron LI [Thu, 14 Dec 2023 05:23:04 +0000 (13:23 +0800)]
ifconfig.8: Group all IPv6-only parameters to its own subsection
Referred-to: FreeBSD
Aaron LI [Thu, 14 Dec 2023 05:22:05 +0000 (13:22 +0800)]
ifconfig.8: Add subsection headers to group parameters
Referred-to: FreeBSD
Aaron LI [Thu, 14 Dec 2023 01:47:52 +0000 (09:47 +0800)]
ifconfig.8: Minor updates and cleanups to generic parameters
Aaron LI [Thu, 14 Dec 2023 01:36:46 +0000 (09:36 +0800)]
ifconfig.8: Remove legacy AppleTalk 'range' and 'phase' options
The AppleTalk code was already removed in commit
d22a69a46a0f55de79a4311db073809348bb5dd0 in 2011.
Aaron LI [Wed, 13 Dec 2023 10:44:29 +0000 (18:44 +0800)]
ifconfig.8: Rearrange options and perform various updates
- Move the general options from the bottom part to the beginning.
- Arrange the options in alphabetic order.
- Update and/or cleanup the option descriptions.
- Adjust various markups and styles.
- Fix some mistakes.
- Remove some obsolete information and commented content.
Mostly obtained from FreeBSD. Also referred to OpenBSD.
Aaron LI [Wed, 13 Dec 2023 02:18:48 +0000 (10:18 +0800)]
ifconfig(8): Use on-stack buffer for the new ifname
Don't bother to allocate the memory and then free it after ioctl().
Aaron LI [Wed, 13 Dec 2023 02:17:43 +0000 (10:17 +0800)]
ifconfig(8): Raise WARNS to 6 (the default)
Aaron LI [Wed, 13 Dec 2023 02:06:02 +0000 (10:06 +0800)]
ifconfig(8): Rename file-global 'ifmr' to avoid shadowing
get80211opmode() also uses a local variable named 'ifmr' which was
shadowing the file-global 'ifmr'.
Aaron LI [Wed, 13 Dec 2023 01:37:54 +0000 (09:37 +0800)]
ifconfig(8): Get rid of the global 'struct ifreq ifr'
Use on-stack 'struct ifreq' instead. Now it's much more clear to reason
about its usage.
Aaron LI [Wed, 13 Dec 2023 01:10:56 +0000 (09:10 +0800)]
ifconfig(8): Replace bzero()/bcopy() with memset()/memcpy()
The latter is also more frequently used in this code.
Aaron LI [Tue, 12 Dec 2023 10:18:30 +0000 (18:18 +0800)]
ifconfig(8): Add 'static' to local functions in ifcarp.c
Aaron LI [Tue, 12 Dec 2023 09:57:59 +0000 (17:57 +0800)]
ifconfig(8): Rename global 'name' to 'IfName' to avoid shadowing
Fix warnings of shadowed declarations with the parameter of some
functions.
Aaron LI [Tue, 12 Dec 2023 09:28:44 +0000 (17:28 +0800)]
ifconfig(8): Fix 'const' discarding warning in link_status()
Meanwhile, refactor the code a bit.
Aaron LI [Tue, 12 Dec 2023 09:26:28 +0000 (17:26 +0800)]
ifconfig(8): Fix warnings of shadowed declarations
Aaron LI [Tue, 12 Dec 2023 09:24:10 +0000 (17:24 +0800)]
ifconfig(8): Fix the 'FALLTHROUGH' comment to suppress the warning
Aaron LI [Tue, 12 Dec 2023 09:22:43 +0000 (17:22 +0800)]
ifconfig(8): Minor code simplifications and style cleanups
Aaron LI [Tue, 12 Dec 2023 09:08:36 +0000 (17:08 +0800)]
ifconfig(8): Fix numerious unused parameter warnings
Aaron LI [Tue, 12 Dec 2023 08:46:11 +0000 (16:46 +0800)]
ifconfig(8): Remove unnecessary type casts
Aaron LI [Tue, 12 Dec 2023 08:38:59 +0000 (16:38 +0800)]
ifconfig(8): Add 'static' to several non-extern global variables
Aaron LI [Sat, 25 Nov 2023 04:19:47 +0000 (12:19 +0800)]
ifconfig(8): Use constructor priority to define the orders
Originally all the modules use the same constructor priority (101) and
rely on the linking orders (set by the file orders in the Makefile) to
determine their initialization orders.
As described in the comment in Makefile, adjust the constructor
priorities of each module to define their orders.
Aaron LI [Mon, 11 Dec 2023 06:03:34 +0000 (14:03 +0800)]
netstat(1): Update route.c to get rid of some file-global variables
No functional changes.
Aaron LI [Mon, 11 Dec 2023 05:54:51 +0000 (13:54 +0800)]
netstat(1): Whitespace cleanups
Aaron LI [Fri, 24 Nov 2023 06:05:06 +0000 (14:05 +0800)]
net/radix: Various minor improvements and cleanups
- Change 'rn_bit' and 'rm_bit' from type 'short' to 'int', for
consistency with the other types. This doesn't change the structure
size because of the implicit padding. However, the userland netstat(1)
utility must be recompiled with the updated header.
- Rename variable 'b' to 'bit' for clarity.
- Adjust the parameter orders of rn_search_m() for consistency.
- Various style cleanups.
Aaron LI [Tue, 31 Oct 2023 00:49:36 +0000 (08:49 +0800)]
getsockopt.2: Improve manpage markups a bit
Obtained-from: FreeBSD
Matthew Dillon [Wed, 20 Dec 2023 03:14:23 +0000 (19:14 -0800)]
kernel - Fix umount -f related panic
* Adjust umount -f (forced unmount) logic to kill processes which
still hold references to the mount in question, due to being chrooted
or jailed in the mount, their current directory being on the mount,
or having any open file via the mount.
To be frank, it is hard to find a nice way to rip a mount out from under
processes as their behavior upon suddenly having file descriptors go bad
is completely non-deterministic. A forced unmount is not supposed to be
kind to the system. The best solution is to kill the processes.
* Fixes panics related to regular use of umount -f if the operation
happens to race active operations by processes on the mount.
Reported-by: marino
Roy Marples [Mon, 18 Dec 2023 16:10:46 +0000 (16:10 +0000)]
Merge branch 'vendor/DHCPCD'
Roy Marples [Mon, 18 Dec 2023 16:08:41 +0000 (16:08 +0000)]
Import dhcpcd-10.0.6 with the following changes:
* privsep: Stop proxying stderr to console and fix some detachment issues
* non-privsep: Fix launcher hangup
* DHCP6: Allow the invalid interface name - to mean don't assign an address from a delegated prefix
* DHCP6: Load the configuration for the interface being activated from prefix delegation
Tomohiro Kusumi [Tue, 12 Dec 2023 10:12:23 +0000 (02:12 -0800)]
sbin/hammer2/hammer2.8: Correct default vfs.hammer2.cluster_write value
The default is 0 since
f66cf3712cde69127a27daf2d8a805b7c7da52ce in 2018.
Matthew Dillon [Mon, 11 Dec 2023 18:46:36 +0000 (10:46 -0800)]
dhclient - Only clear arp table on specified interface
* When clearing the arp table after dhclient updates an interface,
only clear the arp entries on the interface and not all arp entries.
Tomohiro Kusumi [Mon, 11 Dec 2023 08:10:08 +0000 (00:10 -0800)]
sys/vfs/hammer2: Remove unused chain LRU related
Remove stuff leftover from
34fb48c236fd17fbe558c7b2cf21b4e50f38153e.
Michael Neumann [Thu, 7 Dec 2023 13:56:25 +0000 (14:56 +0100)]
Fix typos
Michael Neumann [Sat, 9 Dec 2023 01:46:00 +0000 (02:46 +0100)]
busdma - Remove filter functionality
- Remove filtfunc and filtarg arguments from bus_dma_tag_create() and
fix all callers. All callers use NULL today for both filterfunc and
filterarg with one exception: if_jme.
- Remove filter functionality internally and parent tag tracking.
Without filter functions, we do not need to keep track of tag
ancestry. All inheritance of the parent tag's parameters occurs when
creating the new child tag.
- rename run_filter() to addr_needs_bounce().
- FreeBSD keeps the filtfunc and filtarg arguments but requires them to
be NULL.
- Drop filterfunc usage from if_jme.
In case of "JMC260 chip full mask revision 2", which has a hardware bug
when it comes to DMA transfers crossing the 4 GB bounday, the parent
buffer tag already limits DMA memory to 32bit address space. As such it
should be safe to drop the filterfunc. The filterfunc was checking if
the lower 32bits of the physical address used for DMA are all 0. In case
of a 32bit address space, the only address where all lower 32-bits are
all zero is 0 itself and I am here assuming that the physical address 0
is not used for DMA transfers!
Mainly obtained from: FreeBSD (commits
7cb028de,
900907f4,
1228b93b,
3933ff56)
Matthew Dillon [Wed, 6 Dec 2023 07:03:01 +0000 (23:03 -0800)]
pf - Fix bug causing permissive TCP reset code
* Fix a bug that permissively allows TCP resets even if the sequence
number does not match due to an incorrect IP fragmentation check.
Reported-by: mjg
Taken-from: FreeBSD
6284d5f76d6bd2
Tomohiro Kusumi [Fri, 1 Dec 2023 08:01:23 +0000 (00:01 -0800)]
usr.sbin/makefs/hammer2: Properly support block device for image creation
Unlike regular file image, block device image creation fails
if estimated image size exceeds the device size.
Sparse file option is ignored. The block device blocks aren't
zero cleared.
Tomohiro Kusumi [Thu, 30 Nov 2023 08:12:13 +0000 (00:12 -0800)]
sys/vfs/hammer2: Remove unused local variable *pmp
No longer used since
34fb48c236fd17fbe558c7b2cf21b4e50f38153e.
makefs code warned on Linux.