openbsd
2 years agoAdjust the signer test to link statically and work with hidden tls_signer
tb [Thu, 24 Mar 2022 15:58:57 +0000 (15:58 +0000)]
Adjust the signer test to link statically and work with hidden tls_signer
API.

2 years agosync
tb [Thu, 24 Mar 2022 15:57:44 +0000 (15:57 +0000)]
sync

2 years agoCrank major after symbol removal.
tb [Thu, 24 Mar 2022 15:57:04 +0000 (15:57 +0000)]
Crank major after symbol removal.

2 years agoHide the tls_signer from public visibility. It's not ready yet and
tb [Thu, 24 Mar 2022 15:56:34 +0000 (15:56 +0000)]
Hide the tls_signer from public visibility. It's not ready yet and
should not be used. It will be revisited after release.

ok beck inoguchi jsing

2 years agowhitespace niggle noticed during review
deraadt [Thu, 24 Mar 2022 14:39:08 +0000 (14:39 +0000)]
whitespace niggle noticed during review

2 years agoCheck function return value
inoguchi [Thu, 24 Mar 2022 14:07:08 +0000 (14:07 +0000)]
Check function return value

2 years agoCompare pointer value with NULL
inoguchi [Thu, 24 Mar 2022 13:47:55 +0000 (13:47 +0000)]
Compare pointer value with NULL

2 years agoAdd unit (milliseconds) to escape-time, show unset colours as "none"
nicm [Thu, 24 Mar 2022 12:07:25 +0000 (12:07 +0000)]
Add unit (milliseconds) to escape-time, show unset colours as "none"
rather than "invalid" and don't show the same text twice for user
options in customize mode.

2 years agoWrap long lines
inoguchi [Thu, 24 Mar 2022 12:00:17 +0000 (12:00 +0000)]
Wrap long lines

2 years agoRemove space between asterisk and variable name
inoguchi [Thu, 24 Mar 2022 11:40:07 +0000 (11:40 +0000)]
Remove space between asterisk and variable name

2 years agoConvert openssl(1) ts option handling
inoguchi [Thu, 24 Mar 2022 11:27:45 +0000 (11:27 +0000)]
Convert openssl(1) ts option handling

Apply new option handling to openssl(1) ts, and there is no functional
changes here.
usage strings are comes from manual page.

comments and ok jsing@

2 years agoAdd a capability for OSC 7 and use it similarly to how the title is set
nicm [Thu, 24 Mar 2022 09:05:57 +0000 (09:05 +0000)]
Add a capability for OSC 7 and use it similarly to how the title is set
(and controlled by the same set-titles option). GitHub issue 3127.

2 years agoPlus a small leak found by jmatthew; ok millert@
otto [Thu, 24 Mar 2022 07:37:19 +0000 (07:37 +0000)]
Plus a small leak found by jmatthew; ok millert@

2 years agoRevert previous. Breaks probing native IDE devices.
krw [Thu, 24 Mar 2022 00:30:51 +0000 (00:30 +0000)]
Revert previous. Breaks probing native IDE devices.

Problem reported by jungle Boogie via bugs@

2 years agoTrapping a riscv illegal instruction shouldn't print a console message
jca [Wed, 23 Mar 2022 23:48:30 +0000 (23:48 +0000)]
Trapping a riscv illegal instruction shouldn't print a console message

"Old debugging code obviously" deraadt@

2 years agoExport the ID_AA64ISARn_EL1 registers to userspace through sysctl(2) such
kettenis [Wed, 23 Mar 2022 23:36:35 +0000 (23:36 +0000)]
Export the ID_AA64ISARn_EL1 registers to userspace through sysctl(2) such
that we can detect which instruction set extensions are supported without
relying in catching SIGILL.

ok deraadt@

2 years agoDo not forget to install ar.1; ok robert
deraadt [Wed, 23 Mar 2022 22:44:01 +0000 (22:44 +0000)]
Do not forget to install ar.1; ok robert

2 years agoAdd subdir gnu/lib to regress.
bluhm [Wed, 23 Mar 2022 22:34:51 +0000 (22:34 +0000)]
Add subdir gnu/lib to regress.

2 years agoSimplify logic for skipping libexecinfo unwind test. It works on
bluhm [Wed, 23 Mar 2022 22:32:08 +0000 (22:32 +0000)]
Simplify logic for skipping libexecinfo unwind test.  It works on
clang archs except armv7.

2 years agoEnsure that pf regress anchor exists before clearing it.
bluhm [Wed, 23 Mar 2022 22:07:10 +0000 (22:07 +0000)]
Ensure that pf regress anchor exists before clearing it.

2 years agoUse goto fail consistently to leave the giant switch in pfioctl().
bluhm [Wed, 23 Mar 2022 17:36:09 +0000 (17:36 +0000)]
Use goto fail consistently to leave the giant switch in pfioctl().
To terminate inner switches and loops, break is used.  This makes
it easier to reason whereto the code jumps.
no binary change; OK millert@ sashan@

2 years agoMove global variable ripsrc onto stack, it is only used once within
bluhm [Wed, 23 Mar 2022 17:22:28 +0000 (17:22 +0000)]
Move global variable ripsrc onto stack, it is only used once within
rip_input().
from dhill@

2 years agoRate limit router advertisements according to RFC 4861 6.2.6. In
florian [Wed, 23 Mar 2022 15:26:08 +0000 (15:26 +0000)]
Rate limit router advertisements according to RFC 4861 6.2.6. In
particular make sure to send at most one multicast advertisement every
three seconds.
input & OK deraadt

2 years agoopenssl cms: avoid NULL derefs on option parsing
tb [Wed, 23 Mar 2022 15:16:59 +0000 (15:16 +0000)]
openssl cms: avoid NULL derefs on option parsing

Two missing initializations in the new option handling cause a
segfault when -nodetach or -noindef is passed to openssl cms.

ok inoguchi jsing miod

2 years agoStart disentangling armv7 and aarch64 code
tb [Wed, 23 Mar 2022 15:13:31 +0000 (15:13 +0000)]
Start disentangling armv7 and aarch64 code

arm_arch.h and armcap.c are shared between armv7 and aarch64 which
results in an inscrutable #ifdef maze. Move copies of these files
into arch/{arm,aarch64}/ with appropriate names and some trivial
minor adjustments.

ok deraadt inoguchi kettenis

2 years agoRemove extra space at EOL in last commit.
millert [Wed, 23 Mar 2022 14:52:25 +0000 (14:52 +0000)]
Remove extra space at EOL in last commit.

2 years agoExpand the description of the LOGIN_SET* bits.
millert [Wed, 23 Mar 2022 14:51:42 +0000 (14:51 +0000)]
Expand the description of the LOGIN_SET* bits.
Specifically, describe the default behavior if the corresponding
login.conf fields are not present.  OK deraadt@

2 years agosetclasscontext: support LOGIN_SETRTABLE too
millert [Wed, 23 Mar 2022 14:39:52 +0000 (14:39 +0000)]
setclasscontext: support LOGIN_SETRTABLE too
Do not clear LOGIN_SETRTABLE if it is set in flags.
OK deraadt@

2 years agoWhen configuring a scsi_link that has passed dev_probe() but
krw [Wed, 23 Mar 2022 14:36:01 +0000 (14:36 +0000)]
When configuring a scsi_link that has passed dev_probe() but
fallen at one of the subsequent hurdles of scsi_probe_link()
don't partially replicate scsi_discard_link(). Just
call scsi_discard_link().  It now handles such partially configured
scsi_link's.

2 years agouse llvm-ranlib where llvm-ar is used so that they are in line with each
robert [Wed, 23 Mar 2022 14:23:44 +0000 (14:23 +0000)]
use llvm-ranlib where llvm-ar is used so that they are in line with each
other

2 years agoKASSERT() that an id read from a descriptor is valid before using it
jsg [Wed, 23 Mar 2022 13:03:36 +0000 (13:03 +0000)]
KASSERT() that an id read from a descriptor is valid before using it
as an index into an array.

Reported by Demi Marie Obenour of Invisible Things Lab.
feedback and ok jmatthew@

2 years agoImprove 802.11ac throughput on iwm(4) at a distance to the access point.
stsp [Wed, 23 Mar 2022 09:22:49 +0000 (09:22 +0000)]
Improve 802.11ac throughput on iwm(4) at a distance to the access point.

iwm(4) didn't attribute retries to the correct MCS, resulting in lower
MCS being punished unfairly when a higher MCS kept failing.

Tested by bket, florian, Uwe Werler, and myself.

ok bket

2 years agoFix a few bugs in the net80211 VHT rate adaptation code.
stsp [Wed, 23 Mar 2022 09:21:47 +0000 (09:21 +0000)]
Fix a few bugs in the net80211 VHT rate adaptation code.

Actually set rn->best_nss after deciding on a new best rate.
We are now switching between SISO and MIMO rates as intended.

When switching between ratesets, avoid switching directly to the highest
rate in the new rateset, which might be MCS 9 and not work at all from a
distance. Instead, use the most recently determined best rate in the set.

The bit which corresponds to the current best MS will not be set in the
rn->probed_rates[] array while we are probing an MCS other than the best.
Checking for this bit was simply wrong and prevented us from probing the
next rateset unless we managed to successfully probe up all the way
to the highest MCS in the current set.

Also fix errors in debug output.

Tested by bket, florian, Uwe Werler, and myself.

ok bket@

2 years agoresurrect pf_consistency_lock as pfioctl_rw this time. pfioctl_rw
sashan [Wed, 23 Mar 2022 09:01:59 +0000 (09:01 +0000)]
resurrect pf_consistency_lock as pfioctl_rw this time. pfioctl_rw
serializes access to pf(4) from concurrent processes which
change/read firewall configuration.

OK bluhm@

2 years agoNow that libc setusercontext() handling of setrtable is repaired, su(8)
deraadt [Wed, 23 Mar 2022 02:18:22 +0000 (02:18 +0000)]
Now that libc setusercontext() handling of setrtable is repaired, su(8)
can set LOGIN_SETRTABLE once again.
ok millert

2 years agoFor raw IPv6 packets rip6_input() traverses the loop of all PCBs.
bluhm [Wed, 23 Mar 2022 00:16:07 +0000 (00:16 +0000)]
For raw IPv6 packets rip6_input() traverses the loop of all PCBs.
From there it calls sbappendaddr() while holding the raw6 table
mutex.  This ends in sorwakeup() where we finally grab the kernel
lock while holding a mutex.  Witness detects this misuse.
Use the same solution as for PCB notify.  Collect the affected PCBs
in a temporary list.  The list is protected by exclusive net lock.
Reported-by: syzbot+5b2679ee9be0895d26f9@syzkaller.appspotmail.com
OK claudio@

2 years agoCall tls_close() in libevent TLS wrapper of syslogd when the other
bluhm [Tue, 22 Mar 2022 22:58:00 +0000 (22:58 +0000)]
Call tls_close() in libevent TLS wrapper of syslogd when the other
side terminates the TLS connection.  It results in a proper shutdown
and the TLS peer has a chance to detect errors.  This is expecially
important for the client side.  Due to the reduced TLS 1.3 handshake,
errors might be undetected and log messages dropped silently.  By
doing a matching TLS shutdown on his side, the client can receive
the error.
Instead of checking socket writability and calling tls_close()
repeatedly, syslogd calls it only once.  As the other side has
closed the connection anyway it is our turn to write the shutdown
message.  Do not care about errors here and avoid complexity.
OK tb@

2 years agominor KNF cleanups during a re-read
deraadt [Tue, 22 Mar 2022 20:36:49 +0000 (20:36 +0000)]
minor KNF cleanups during a re-read

2 years agoExtract the type from the ICMP6 header before looping over Raw IPv6
bluhm [Tue, 22 Mar 2022 18:27:21 +0000 (18:27 +0000)]
Extract the type from the ICMP6 header before looping over Raw IPv6
PCBs.  This make mutex and error handling easier.
OK claudio@

2 years agoFor raw IP packets rip_input() traverses the loop of all PCBs. From
bluhm [Tue, 22 Mar 2022 18:17:30 +0000 (18:17 +0000)]
For raw IP packets rip_input() traverses the loop of all PCBs.  From
there it calls sbappendaddr() while holding the raw table mutex.
This ends in sorwakeup() where we finally grab the kernel lock while
holding a mutex.  Witness detects this misuse.
Use the same solution as for PCB notify.  Collect the affected PCBs
in a temporary list.  The list is protected by exclusive net lock.
syzbot+ebe3f03a472fecf5e42e@syzkaller.appspotmail.com
OK claudio@

2 years agoFix whitespace.
bluhm [Tue, 22 Mar 2022 18:02:54 +0000 (18:02 +0000)]
Fix whitespace.

2 years agoNuke increasingly pointless comment. Shorten a line and
krw [Tue, 22 Mar 2022 16:29:58 +0000 (16:29 +0000)]
Nuke increasingly pointless comment. Shorten a line and
compare pointer to NULL instead of 0.

No functional change.

2 years agoPolish the bits that copy the firmware in place on Apple systems a bit more.
kettenis [Tue, 22 Mar 2022 15:38:27 +0000 (15:38 +0000)]
Polish the bits that copy the firmware in place on Apple systems a bit more.
This mostly adds some checks to make sure that if for some reason the firmware
files aren't present on the EFI System Partition the users doesn't see
several error messages.

ok deraadt@

2 years agoAdjust test after the change to TAILQ in struct prefix.
claudio [Tue, 22 Mar 2022 10:57:08 +0000 (10:57 +0000)]
Adjust test after the change to TAILQ in struct prefix.

2 years agoSwitch from a LIST to TAILQ for the structure to store prefixes on a
claudio [Tue, 22 Mar 2022 10:53:08 +0000 (10:53 +0000)]
Switch from a LIST to TAILQ for the structure to store prefixes on a
rib_entry. Mostly mechanical, this simplifies prefix_insert() and
prefix_remove() since the redo queue can now just use TAILQ_INSERT_TAIL().
rde_softreconfig_sync_reeval() needs to use TAILQ_CONCAT() to move
the list of prefixes over to the local TAILQ_HEAD to reapply them later.
OK tb@

2 years agoCopy the FDT into a larger buffer such that we have space to add additional
kettenis [Tue, 22 Mar 2022 10:33:50 +0000 (10:33 +0000)]
Copy the FDT into a larger buffer such that we have space to add additional
nodes and properties to it like we do on arm64 and armv7.

ok patrick@

2 years agoAfter copying the FDT into a new larger buffer, adjust the FDT size to
kettenis [Tue, 22 Mar 2022 10:32:10 +0000 (10:32 +0000)]
After copying the FDT into a new larger buffer, adjust the FDT size to
reflect the size of the new buffer like we do on arm64.

ok patrick@

2 years agoMake sure kernel longjmp always returns 1 rather than what turns out to be
miod [Tue, 22 Mar 2022 06:51:12 +0000 (06:51 +0000)]
Make sure kernel longjmp always returns 1 rather than what turns out to be
in a register at call-time.
with & ok jsg@

2 years agoFix wrong comment in sendsig(), and remove unused dumpframe()
miod [Tue, 22 Mar 2022 06:49:25 +0000 (06:49 +0000)]
Fix wrong comment in sendsig(), and remove unused dumpframe()
ok jsg@

2 years agoDo not bother initializing a0 with a special value in setregs, that's a
miod [Tue, 22 Mar 2022 06:48:36 +0000 (06:48 +0000)]
Do not bother initializing a0 with a special value in setregs, that's a
FreeBSDism we have no need for.
ok jsg@

2 years agoChange VM_MIN_ADDRESS to PAGE_SIZE to forbid mapping anything at virtual
miod [Tue, 22 Mar 2022 06:47:38 +0000 (06:47 +0000)]
Change VM_MIN_ADDRESS to PAGE_SIZE to forbid mapping anything at virtual
address zero, as done on all other platforms.
ok deraadt@ kettenis@

2 years agoDo not pretend there exist MD code for byte swapping yet provide copies
miod [Tue, 22 Mar 2022 06:46:45 +0000 (06:46 +0000)]
Do not pretend there exist MD code for byte swapping yet provide copies
of the MI fallback code; ok deraadt@ jsg@

2 years agoFor multicast and broadcast packets udp_input() traverses the loop
bluhm [Mon, 21 Mar 2022 23:37:09 +0000 (23:37 +0000)]
For multicast and broadcast packets udp_input() traverses the loop
of all UDP PCBs.  From there it calls udp_sbappend() while holding
the UDP table mutex.  This ends in sorwakeup() where we finally
grab the kernel lock while holding a mutex.  Witness detects this
misuse.
Use the same solution as for PCB notify.  Collect the affected PCBs
in a temporary list.  The list is protected by exclusive net lock.
Reported-by: syzbot+7596cb96fb9f3c9d6f4f@syzkaller.appspotmail.com
OK sashan@

2 years agoReduce dmesg spam by nor printing the "Apple" firmware name.
kettenis [Mon, 21 Mar 2022 19:46:56 +0000 (19:46 +0000)]
Reduce dmesg spam by nor printing the "Apple" firmware name.

ok patrick@

2 years agoFix whitespace. Wrap long lines. Adjust outdated comment.
bluhm [Mon, 21 Mar 2022 19:39:56 +0000 (19:39 +0000)]
Fix whitespace.  Wrap long lines.  Adjust outdated comment.

2 years agoConstify struct {audio,midi,radio,video}_hw_if. No functional change.
miod [Mon, 21 Mar 2022 19:22:39 +0000 (19:22 +0000)]
Constify struct {audio,midi,radio,video}_hw_if. No functional change.

ok mpi@ ratchov@ "More const is good" deraadt@

2 years agoRemove the active prefix cache in struct rib_entry. I need the space
claudio [Mon, 21 Mar 2022 17:35:56 +0000 (17:35 +0000)]
Remove the active prefix cache in struct rib_entry. I need the space
and it also makes less sense to track this with ECMP or add-path.
Replace the re->active access with prefix_best(re) which does the
check on the spot.
Feedback and OK tb@

2 years agoPrevent crash of unprivileged engine process (pledged stdio).
florian [Mon, 21 Mar 2022 16:25:47 +0000 (16:25 +0000)]
Prevent crash of unprivileged engine process (pledged stdio).

The length field of a DNS label in the DNS search list option is an 8
bit unsigned value. parse_dnssl() treats the search list option as an
array of char, which are signed on most archs. When we read this value
into an int variable it gets sign extended, allowing it to bypass
sanity checks and eventually we pass it as the length to memcpy which
treats it as a huge unsigned value leading to a heap overflow.

An easy fix would be change the signature of parse_dnssl to
parse_dnssl(uint8_t* data, int datalen).

However, the DNS search list option is unused and the function fails
to check if the parsed value is a valid domain name. The function is
also getting in the way of future work so it's best to just delete it.

The problem was found and reported by qualys, thanks!

OK bluhm

2 years agoDisplay the supported media list in a similar way to the other drivers,
miod [Mon, 21 Mar 2022 14:56:16 +0000 (14:56 +0000)]
Display the supported media list in a similar way to the other drivers,
without angle brackets.

ok jmc@

2 years agoUpdate hw.power whenever we refresh the AC state. This makes sure the state
kettenis [Mon, 21 Mar 2022 13:38:34 +0000 (13:38 +0000)]
Update hw.power whenever we refresh the AC state.  This makes sure the state
doesn't get out of sync with what apm(8) reports if power is plugged or
unplugged when a machine is suspended.  Which in turn makes sure the machine
properly goes into a low CPU P-state when requested.

ok deraadt@, florian@

2 years agoAdjust how RIB are reloaded when their flags (esp. no evaluate) changes.
claudio [Mon, 21 Mar 2022 13:33:20 +0000 (13:33 +0000)]
Adjust how RIB are reloaded when their flags (esp. no evaluate) changes.
First flush all affected Adj-RIB-Out and then in a second step re-evaluate
the RIB itself. The no evaluate case becomes simpler. Fix the way
prefixes are re-evaluated, the list remove needs to be explict and not
part of prefix_evaluate() as in most other cases since this list is not
part of the rib_entry.
OK tb@

2 years agoWhitespace tweaks.
krw [Mon, 21 Mar 2022 12:57:46 +0000 (12:57 +0000)]
Whitespace tweaks.

2 years agoAdd support for XBox One gamecontroller, including report descriptor.
thfr [Mon, 21 Mar 2022 12:18:52 +0000 (12:18 +0000)]
Add support for XBox One gamecontroller, including report descriptor.
Based on previous XBox 360 controller code and NetBSD's implementation.

Tested by me and solene@.
Input by solene@ and stsp@.
ok stsp@ phessler@
ok solene@ for an earlier version.

2 years agoMake sure that the string generated by pretty_key_id() is always properly
claudio [Mon, 21 Mar 2022 10:39:51 +0000 (10:39 +0000)]
Make sure that the string generated by pretty_key_id() is always properly
NUL terminated.
Diff by Martin Vahlensieck <openbsd () academicsolutions ! ch>
OK tb@

2 years agoAdjust to renaming of F_CTL_ACTIVE/F_PREF_ACTIVE to F_CTL_ACTIVE/F_PREF_BEST
claudio [Mon, 21 Mar 2022 10:16:23 +0000 (10:16 +0000)]
Adjust to renaming of F_CTL_ACTIVE/F_PREF_ACTIVE to F_CTL_ACTIVE/F_PREF_BEST
OK tb@

2 years agoRename F_CTL_ACTIVE and F_PREF_ACTIVE to the more correct
claudio [Mon, 21 Mar 2022 10:15:34 +0000 (10:15 +0000)]
Rename F_CTL_ACTIVE and F_PREF_ACTIVE to the more correct
F_CTL_BEST and F_PREF_BEST. This is used to mark the one
best path in bgpctl. When ECMP support is added then more
then one path can be active.
OK tb@

2 years agoHeader netinet/in_pcb.h includes sys/mutex.h now. Recommit mutex
bluhm [Mon, 21 Mar 2022 09:12:34 +0000 (09:12 +0000)]
Header netinet/in_pcb.h includes sys/mutex.h now.  Recommit mutex
for PCB tables.  It does not break userland build anymore.

pf_socket_lookup() calls in_pcbhashlookup() in the PCB layer.  To
run pf in parallel, make parts of the stack MP safe.  Protect the
list and hashes in the PCB tables with a mutex.
Note that the protocol notify functions may call pf via tcp_output().
As the pf lock is a sleeping rw_lock, we must not hold a mutex.  To
solve this for now, collect these PCBs in inp_notify list and protect
it with exclusive netlock.
OK sashan@

2 years agoRemove unused files which serve no purpose in OpenBSD; with and ok jsg@
miod [Mon, 21 Mar 2022 06:48:00 +0000 (06:48 +0000)]
Remove unused files which serve no purpose in OpenBSD; with and ok jsg@

(works better with `cvs rm' prior to commit...)

2 years agoRemove unused files which serve no purpose in OpenBSD; with and ok jsg@
miod [Mon, 21 Mar 2022 06:45:50 +0000 (06:45 +0000)]
Remove unused files which serve no purpose in OpenBSD; with and ok jsg@

2 years agoRemove data dependency barrier from atomic_load_* functions
visa [Mon, 21 Mar 2022 05:45:52 +0000 (05:45 +0000)]
Remove data dependency barrier from atomic_load_* functions

This makes the atomic_load_* functions relaxed in terms of memory
ordering. Now it should be acceptable to use these functions in
assertions.

The need of the data dependency barrier is conditioned to usage.
The barrier is unnecessary for the control decisions that cond_wait()
and refcnt_finalize() make. READ_ONCE() and SMR_PTR_GET() use the
barrier so that loaded pointers would work as excepted in lock-free
contexts (some Alpha CPUs have a data cache design that can cause
unusual load-load reordering if not synchronized properly).

OK bluhm@

2 years agodefault the conffile variable to the default file name instead of NULL.
dlg [Mon, 21 Mar 2022 04:35:41 +0000 (04:35 +0000)]
default the conffile variable to the default file name instead of NULL.

this avoids having to test for NULL and swap the right name in place
in a bunch of places. it also avoids having NULL passed to format
strings in the parser.

the only place where it actually matters if we're using the default
or not is when we're parsing the config. if you don't specify a
config, and the default file doesnt exist, that's ok.

ok florian@

2 years agocall in_pcbselsrc from rip_output so route sourceaddr can take effect.
dlg [Mon, 21 Mar 2022 04:00:56 +0000 (04:00 +0000)]
call in_pcbselsrc from rip_output so route sourceaddr can take effect.

previously things that used sendto or similar with raw sockets would
ignore any configured sourceaddr. this made it inconsistent with
other traffic, which in turn makes things confusing to debug if
you're using ping or traceroute (which use raw sockets) to figure
out what's happening to other packets.

the ipv6 equiv already does this too.

ok sthen@ claudio@

2 years agotreat 255.255.255.255 like an mcast address in in_pcbselsrc.
dlg [Mon, 21 Mar 2022 03:51:09 +0000 (03:51 +0000)]
treat 255.255.255.255 like an mcast address in in_pcbselsrc.

this allows the IP_MULTICAST_IF sockopt to specify which address
you want to send a limited broadcast (255.255.255.255) packet out
of.

requested by and ok claudio@

2 years agoNo point in calling scsi_link_shutdown() if link->pool is NULL.
krw [Mon, 21 Mar 2022 00:20:40 +0000 (00:20 +0000)]
No point in calling scsi_link_shutdown() if link->pool is NULL.

Ditto config_detach() if link->device_softc is NULL.

Currently just some extra paranoia, but will allow simplification
of exit logic in scsi_probe_link() and other future uses of
scsi_detach_link() on partially configured links.

No intentional functional change.

2 years agosetusercontext: only call setrtable(2) if "rtable" set explicitly.
millert [Sun, 20 Mar 2022 23:24:03 +0000 (23:24 +0000)]
setusercontext: only call setrtable(2) if "rtable" set explicitly.
When LOGIN_SETRTABLE is set in flags, only call setrtable(2) if
there is an "rtable" entry in login.conf.  Previously, a default
value of 0 was used if the capability was missing.  That had the
effect of resetting the rtable for every program that uses
setusercontext(3), even if a different rtable was chosen by, e.g.,
"route -T exec command".  OK deraadt@ matthieu@

2 years agoInclude sys/mutex.h from netinet/in_pcb.h. Struct mutex will be
bluhm [Sun, 20 Mar 2022 19:16:29 +0000 (19:16 +0000)]
Include sys/mutex.h from netinet/in_pcb.h.  Struct mutex will be
needed to make inpcb in kernel MP safe.  To build sysctl and libkvm
based programs, we have to export it to userland.
OK claudio@

2 years agoMove/group i2d_ASN1_OBJECT() and d2i_ASN1_OBJECT().
jsing [Sun, 20 Mar 2022 13:27:23 +0000 (13:27 +0000)]
Move/group i2d_ASN1_OBJECT() and d2i_ASN1_OBJECT().

2 years agoAlways check if softraid0 is NULL before dereferencing it.
krw [Sun, 20 Mar 2022 13:14:02 +0000 (13:14 +0000)]
Always check if softraid0 is NULL before dereferencing it.

Avoids panic on reboot when softraid has been disabled.

Discovered by, diagnosed, first diff from & fix tested by Scott
Nicholas.

ok bluhm@

2 years agoIntroduce an alternative mechanism for wifi drivers to communicate
stsp [Sun, 20 Mar 2022 12:01:58 +0000 (12:01 +0000)]
Introduce an alternative mechanism for wifi drivers to communicate
the channel on which a frame was received.

ieee80211_inputm() was expecting that ic->ic_bss->ni_chan would correspond
to the channel which is currently being scanned. This dates back to older
devices which are manually tuned to the next channel by the driver during
SCAN->SCAN state transitions.

However, this approach is very awkward for drivers which scan across a
whole range of channels in firmware. Such drivers had an ugly workaround
in place which tweaked ni_chan for each received frame.

Introduce a channel number field in the Rx info struct which drivers
can use to indicate the channel on which a frame was received.
If this field is set, net80211 will use it instead of using the current
channel of ic_bss. Use this new mechanism in all affected drivers.

Tested by jmc@, sthen@, and myself on iwm(4) and iwx(4).
Changes to iwn(4) and bwfm(4) are the same mechanical changes to get rid
of the ni_chan tweak, and are therefore expected to work.

ok sthen@ dlg@

2 years agoDon't announce VHT caps on 2GHz channels during iwm(4) and iwx(4) scans.
stsp [Sun, 20 Mar 2022 11:59:39 +0000 (11:59 +0000)]
Don't announce VHT caps on 2GHz channels during iwm(4) and iwx(4) scans.

VHT capabilities were written into the "common" secion of the firmware
probe request frame template. This section is used on 2GHz and 5GHz bands.
Announcing VHT capabilities on 2GHz makes no sense.
Move them into the 5GHz-only section.

ok sthen@

2 years agosync
sthen [Sun, 20 Mar 2022 10:54:43 +0000 (10:54 +0000)]
sync

2 years agodon't leak argument list; bz3404, reported by Balu Gajjala
djm [Sun, 20 Mar 2022 08:52:17 +0000 (08:52 +0000)]
don't leak argument list; bz3404, reported by Balu Gajjala
ok dtucker@

2 years agomake addargs() and replacearg() a little more robust and improve error
djm [Sun, 20 Mar 2022 08:51:21 +0000 (08:51 +0000)]
make addargs() and replacearg() a little more robust and improve error
reporting

make freeargs(NULL) a noop like the other free functions

ok dtucker as part of bz3403

2 years agoMake background scans pick up APs on 2GHz channels while in 11ac mode.
stsp [Sun, 20 Mar 2022 07:50:32 +0000 (07:50 +0000)]
Make background scans pick up APs on 2GHz channels while in 11ac mode.

found by landry@

2 years agoEnable interrupt moderation, targeting around 20k interrupts per second.
jmatthew [Sun, 20 Mar 2022 00:01:33 +0000 (00:01 +0000)]
Enable interrupt moderation, targeting around 20k interrupts per second.
There are separate timers for rx and tx interrupts, so we can use longer
timeouts for tx since that doesn't affect packet processing latency.

ok dlg@

2 years agoRemove three useless tests files
tb [Sat, 19 Mar 2022 18:19:24 +0000 (18:19 +0000)]
Remove three useless tests files

The asn1test depends on asn1_mac.h which had a date with the bitbucket a
few years back (and the test "isn't meant to run particularly, it's just
to test type checking"). methtest.c tests an API that was never present
in OpenSSL's git history. r160test.c is nothing but a licence.

"nuke away" jsing

2 years agoProvide t2i_ASN1_OBJECT_internal() and use it for OBJ_txt2obj()
jsing [Sat, 19 Mar 2022 17:49:32 +0000 (17:49 +0000)]
Provide t2i_ASN1_OBJECT_internal() and use it for OBJ_txt2obj()

The current OBJ_txt2obj() implementation converts the text to ASN.1
object content octets, builds a full DER encoding from it, then feeds
the entire thing back through the DER to ASN.1 object conversion. Rather
than doing this crazy dance, provide an t2i_ASN1_OBJECT_internal() function
that converts the text to ASN.1 object content octets, then creates a new
ASN1_OBJECT and attaches the content octets to it.

ok inoguchi@ tb@

2 years agoRevise regress for ascii/text to ASN.1 object conversion rewrite.
jsing [Sat, 19 Mar 2022 17:37:10 +0000 (17:37 +0000)]
Revise regress for ascii/text to ASN.1 object conversion rewrite.

2 years agoRewrite ascii/text to ASN.1 object conversion.
jsing [Sat, 19 Mar 2022 17:35:52 +0000 (17:35 +0000)]
Rewrite ascii/text to ASN.1 object conversion.

Rewrite the ascii/text to ASN.1 object conversion code using CBB/CBS,
while also addressing some of the bizarre behaviour (such as allowing
mixed separators and treating '..' as a zero value).

ok inoguchi@ tb@

2 years agoremove unused Pp;
jmc [Sat, 19 Mar 2022 17:12:31 +0000 (17:12 +0000)]
remove unused Pp;

2 years agoAdd another invalid separator test case.
jsing [Sat, 19 Mar 2022 16:23:17 +0000 (16:23 +0000)]
Add another invalid separator test case.

2 years agoFix wrongly implemented check for 5GHz access point RSSI threshold.
stsp [Sat, 19 Mar 2022 15:21:13 +0000 (15:21 +0000)]
Fix wrongly implemented check for 5GHz access point RSSI threshold.

This check was wrong for drivers which report RSSI as a percentage,
such as iwm(4) and iwx(4). Such drivers will now prefer 5GHz with
50% or greater RSSI, as was intended.

ok phessler@

2 years agoGive 11n and 11ac networks a higher score during SSID selection.
stsp [Sat, 19 Mar 2022 15:20:32 +0000 (15:20 +0000)]
Give 11n and 11ac networks a higher score during SSID selection.

ok phessler@

2 years agoFix wrong logic in a check in iwm_vht_single_rate_control() to match
stsp [Sat, 19 Mar 2022 15:19:51 +0000 (15:19 +0000)]
Fix wrong logic in a check in iwm_vht_single_rate_control() to match
what was intended.

ok phessler@

2 years agoFix attach of multiple iwm(4) or iwx(4) interfaces in the same machine.
stsp [Sat, 19 Mar 2022 14:50:01 +0000 (14:50 +0000)]
Fix attach of multiple iwm(4) or iwx(4) interfaces in the same machine.

ok kettenis@, jca@

2 years agoRemove the paragraph about 802.11ac from CAVEATS in the iwm(4) man page.
stsp [Sat, 19 Mar 2022 10:43:01 +0000 (10:43 +0000)]
Remove the paragraph about 802.11ac from CAVEATS in the iwm(4) man page.

2 years agoDo not define RA_DEBUG; pointed out by miod@
stsp [Sat, 19 Mar 2022 10:28:44 +0000 (10:28 +0000)]
Do not define RA_DEBUG; pointed out by miod@

2 years agobackout r1.86 "login class routing table should be honored when doing
sthen [Sat, 19 Mar 2022 10:28:38 +0000 (10:28 +0000)]
backout r1.86 "login class routing table should be honored when doing
a full login with su -l", it breaks rc.d(8) daemon_rtable

2 years agoAdd initial 802.11ac support to the iwm(4) driver.
stsp [Sat, 19 Mar 2022 10:26:52 +0000 (10:26 +0000)]
Add initial 802.11ac support to the iwm(4) driver.

VHT MCS and 80MHz channels can now be used.
Other 11ac features such as larger aggregates are left for later work.

Tested:
3160: stsp
7260: florian, jmatthew
7265: rfreeman, mlarkin, landry, Peter J. Philip
8260: bket
8265: jturner, Marcus MERIGHI, stsp
9260: florian, matthieu, stsp
9650: kmos, sthen

ok sthen@

2 years agoAdd 11ac/VHT Tx rate adaptation support to net80211.
stsp [Sat, 19 Mar 2022 10:25:09 +0000 (10:25 +0000)]
Add 11ac/VHT Tx rate adaptation support to net80211.

Based on our existing RA module for 11n.
The main difference is in dealing with 11ac-specific ratesets.
Tx rate selection heuristics remain identical.

Only supports 80MHz channels, for now. 160MHz is left for future work.

ok sthen@