openbsd
3 years agoMake bioctl properly verify raidlevels specified via the -c option.
stsp [Mon, 8 Feb 2021 19:05:05 +0000 (19:05 +0000)]
Make bioctl properly verify raidlevels specified via the -c option.

Trailing characters in the option argument were ignored, such that
-cC1 (typo of -c1C) was interpreted as -cC instead of being rejected.

ok jsing@

3 years agoUpdate DTLS client hello due to ECC changes.
jsing [Mon, 8 Feb 2021 17:21:50 +0000 (17:21 +0000)]
Update DTLS client hello due to ECC changes.

3 years agoRemove bogus DTLS checks to disable ECC and OCSP.
jsing [Mon, 8 Feb 2021 17:20:47 +0000 (17:20 +0000)]
Remove bogus DTLS checks to disable ECC and OCSP.

ECC and OCSP can be used with DTLS, so remove bogus checks that currently
prevent it. These are long lasting remnants from the original OpenSSL code.

ok tb@

3 years agoEnforce read ahead with DTLS.
jsing [Mon, 8 Feb 2021 17:18:39 +0000 (17:18 +0000)]
Enforce read ahead with DTLS.

DTLS is largely broken/useless without read ahead being enabled, so enforce
it for DTLS. This behaviour matches both our documentation and OpenSSL.

ok tb@

3 years agoUse dtls1_retrieve_buffered_record() to load buffered application data.
jsing [Mon, 8 Feb 2021 17:17:02 +0000 (17:17 +0000)]
Use dtls1_retrieve_buffered_record() to load buffered application data.

Replace the current copy of dtls1_retrieve_buffered_record() with a call
to it instead.

ok tb@

3 years agoadd future 7.0 base key
deraadt [Mon, 8 Feb 2021 16:15:06 +0000 (16:15 +0000)]
add future 7.0 base key

3 years agoClean up kernel IPsec flows and security associations on shutdown.
tobhe [Mon, 8 Feb 2021 16:13:58 +0000 (16:13 +0000)]
Clean up kernel IPsec flows and security associations on shutdown.

Discussed with sthen@
ok patrick@

3 years agoAdd "pipe" variants of the "copy-pipe" commands which do not copy, from
nicm [Mon, 8 Feb 2021 14:46:53 +0000 (14:46 +0000)]
Add "pipe" variants of the "copy-pipe" commands which do not copy, from
Christian Zangl.

3 years agoStart refcounting interface groups with 1. if_creategroup() returns
bluhm [Mon, 8 Feb 2021 12:30:10 +0000 (12:30 +0000)]
Start refcounting interface groups with 1.  if_creategroup() returns
a new object that is already refcounted, so carp attach does not
reach into internal structures.  Add kasserts to detect counter
overflow or underflow.
OK mvs@

3 years agoAdd a RAID1C (raid1 + crypto) softraid(8) discipline.
stsp [Mon, 8 Feb 2021 11:21:53 +0000 (11:21 +0000)]
Add a RAID1C (raid1 + crypto) softraid(8) discipline.

The RAID1C discipline encrypts data like the CRYPTO discipline, and accepts
multiple chunks during creation and assembly like the RAID1 discipline.

To deal with failing disks a RAID1C volume may be assembled with a smaller
number of chunks than the volume was created with. The volume will then come
up in degraded state. If the volume is now detached and assembled again with
the correct number of chunks, any re-added chunks will require a rebuild.

Consequently, assembling RAID1C volumes requires careful attention to the
chunks passed via 'bioctl -l'.  If a chunk is accidentally omitted from the
command line during volume assembly, then this chunk will need to be rebuilt.

At least one known-good chunk is required in order to assemble the volume.

Like CRYPTO, RAID1C supports passphrase and key-disk authentication.
Key-disk based volumes are assembled automatically if the key disk is present
while the system is booting up.

Unlike CRYPTO and RAID1, there is no boot support for RAID1C yet.

RAID1C largely reuses existing code of RAID1 and CRYPTO disciplines.
At present RAID1C's discipline-specific data structure is shared with that
of the CRYPTO discipline to allow re-use of existing CRYPTO code. A custom
RAID1C data structure would require CRYPTO code to access struct sr_crypto
via a pointer instead of via a member field of struct sr_discipline.

ok jsing@

3 years agoAdd a RAID1C (raid1 + crypto) softraid(8) discipline.
stsp [Mon, 8 Feb 2021 11:20:03 +0000 (11:20 +0000)]
Add a RAID1C (raid1 + crypto) softraid(8) discipline.

The RAID1C discipline encrypts data like the CRYPTO discipline, and accepts
multiple chunks during creation and assembly like the RAID1 discipline.

To deal with failing disks a RAID1C volume may be assembled with a smaller
number of chunks than the volume was created with. The volume will then come
up in degraded state. If the volume is now detached and assembled again with
the correct number of chunks, any re-added chunks will require a rebuild.

Consequently, assembling RAID1C volumes requires careful attention to the
chunks passed via 'bioctl -l'.  If a chunk is accidentally omitted from the
command line during volume assembly, then this chunk will need to be rebuilt.

At least one known-good chunk is required in order to assemble the volume.

Like CRYPTO, RAID1C supports passphrase and key-disk authentication.
Key-disk based volumes are assembled automatically if the key disk is present
while the system is booting up.

Unlike CRYPTO and RAID1, there is no boot support for RAID1C yet.

RAID1C largely reuses existing code of RAID1 and CRYPTO disciplines.
At present RAID1C's discipline-specific data structure is shared with that
of the CRYPTO discipline to allow re-use of existing CRYPTO code. A custom
RAID1C data structure would require CRYPTO code to access struct sr_crypto
via a pointer instead of via a member field of struct sr_discipline.

ok jsing@

3 years agoRevert the convertion of per-process thread into a SMR_TAILQ.
mpi [Mon, 8 Feb 2021 10:51:01 +0000 (10:51 +0000)]
Revert the convertion of per-process thread into a SMR_TAILQ.

We did not reach a consensus about using SMR to unlock single_thread_set()
so there's no point in keeping this change.

3 years agoExtend binary operators support, required for more filter features.
mpi [Mon, 8 Feb 2021 09:46:45 +0000 (09:46 +0000)]
Extend binary operators support, required for more filter features.

Improve debugging of filters and print operator names in debug output.

3 years agoAlso print the recently added caRepository URI alongside rpkiManifest
claudio [Mon, 8 Feb 2021 09:28:58 +0000 (09:28 +0000)]
Also print the recently added caRepository URI alongside rpkiManifest
and rpkiNotify SIA.

3 years agoExtract the 1.3.6.1.5.5.7.48.5 (caRepository) SIA from the certificate.
claudio [Mon, 8 Feb 2021 09:22:53 +0000 (09:22 +0000)]
Extract the 1.3.6.1.5.5.7.48.5 (caRepository) SIA from the certificate.
Make sure that the caRepository matches the start of the URI of rpkiManifest.
The MFT must be a file inside the caRepository.
OK tb@

3 years agoDo not hold onto the fdplock longer then needed. Release the lock after
claudio [Mon, 8 Feb 2021 09:18:30 +0000 (09:18 +0000)]
Do not hold onto the fdplock longer then needed. Release the lock after
the initial falloc() calls and then regrab it for the fdinsert() or
fdremove() calls respectiviely. Also move closef() outside of the lock.
This replaces the previously reverted lock order change that was reverted.
OK mvs@ visa@

3 years agoInclude "focused" in client flags, from Dan Aloni in GitHub issue 2558.
nicm [Mon, 8 Feb 2021 08:33:54 +0000 (08:33 +0000)]
Include "focused" in client flags, from Dan Aloni in GitHub issue 2558.

3 years agoSimplify sleep_setup API to two operations in preparation for splitting
mpi [Mon, 8 Feb 2021 08:18:45 +0000 (08:18 +0000)]
Simplify sleep_setup API to two operations in preparation for splitting
the SCHED_LOCK().

Putting a thread on a sleep queue is reduce to the following:

sleep_setup();
/* check condition or release lock */
sleep_finish();

Previous version ok cheloha@, jmatthew@, ok claudio@

3 years agoroute-to rules take ips, not interfaces with optional ips.
dlg [Sun, 7 Feb 2021 23:53:46 +0000 (23:53 +0000)]
route-to rules take ips, not interfaces with optional ips.

another gentle reminder by bluhm@ who pointed out i missed some

3 years agoi missed a dup-to when tweaking route-to things to takes ips, not ifaces.
dlg [Sun, 7 Feb 2021 23:53:00 +0000 (23:53 +0000)]
i missed a dup-to when tweaking route-to things to takes ips, not ifaces.

gentle reminded by bluhm@

3 years agoAbsorb ssl3_get_algorithm2() into ssl_get_handshake_evp_md().
jsing [Sun, 7 Feb 2021 15:26:32 +0000 (15:26 +0000)]
Absorb ssl3_get_algorithm2() into ssl_get_handshake_evp_md().

The mess that is ssl_get_algorithm2() only exists to upgrade the handshake
MAC of a pre-TLSv1.2 cipher suite to SHA256 when used with TLSv1.2. We can
readily do this in ssl_get_handshake_evp_md(), which is far more readable.

ok tb@

3 years agoCorrect handshake MAC/PRF for various TLSv1.2 cipher suites.
jsing [Sun, 7 Feb 2021 15:12:52 +0000 (15:12 +0000)]
Correct handshake MAC/PRF for various TLSv1.2 cipher suites.

For some reason various TLSv1.2 cipher suites were added with the default
handshake MAC and PRF, rather than the SHA256 handshake MAC and PRF. This
gets patched up in ssl3_get_algorithm2(), hence goes unnoticed.

ok tb@

3 years agoFactor out the legacy stack version checks.
jsing [Sun, 7 Feb 2021 15:04:10 +0000 (15:04 +0000)]
Factor out the legacy stack version checks.

Also check for explicit version numbers, rather than just the major version
value.

ok tb@

3 years agoEnable auto DHE and disable session tickets for some tests.
jsing [Sun, 7 Feb 2021 14:52:17 +0000 (14:52 +0000)]
Enable auto DHE and disable session tickets for some tests.

This allows us to drop the server messages that we intend on dropping.

3 years agoOnly probe for DNS64 presence when we know that we can talk to the slaacd
florian [Sun, 7 Feb 2021 13:35:41 +0000 (13:35 +0000)]
Only probe for DNS64 presence when we know that we can talk to the slaacd
provided nameservers, i.e. the stub resolver check succeeded.
Previously we would only probe DNS64 on network change but would not
reschedule when it failed. Sometimes (most of the time?) this failes
because our address is still tentative or a default route has
not yet been installed.
OK phessler

3 years agosync
deraadt [Sun, 7 Feb 2021 01:24:39 +0000 (01:24 +0000)]
sync

3 years agoFree X509_STOREs in ca_shutdown().
tobhe [Sun, 7 Feb 2021 00:56:06 +0000 (00:56 +0000)]
Free X509_STOREs in ca_shutdown().

3 years agoFix address leaks in expand_flows().
tobhe [Sun, 7 Feb 2021 00:51:53 +0000 (00:51 +0000)]
Fix address leaks in expand_flows().

ok patrick@

3 years agowhile learning (teachgammon(1)) you might want to save your game so "{w,c}path"
mestre [Sat, 6 Feb 2021 21:42:30 +0000 (21:42 +0000)]
while learning (teachgammon(1)) you might want to save your game so "{w,c}path"
pledge(2) permissions are required

3 years agoswitch clang to -fno-common by default
naddy [Sat, 6 Feb 2021 21:40:59 +0000 (21:40 +0000)]
switch clang to -fno-common by default

Common variables will be flagged as errors by default.  This can
be overridden with -fcommon.

Cherry-pick this change that will be part of LLVM11.  We bring it
forward so we can finish fixing the fallout in the ports tree.

ok deraadt@ sthen@ mglocker@

3 years ago6.9-beta
deraadt [Sat, 6 Feb 2021 21:26:19 +0000 (21:26 +0000)]
6.9-beta

3 years agoRevert delayed opening of trust anchor file. The code was somewhat
florian [Sat, 6 Feb 2021 18:01:02 +0000 (18:01 +0000)]
Revert delayed opening of trust anchor file. The code was somewhat
ugly and the underlying problem (dhclient and unwind playing well
together) should be solved differently.
Final straw was jca reporting that it breaks his setup.

3 years agoSimplex interface sends packet back without hardware checksum
bluhm [Sat, 6 Feb 2021 13:15:37 +0000 (13:15 +0000)]
Simplex interface sends packet back without hardware checksum
offloading.  The checksum must be calculated in software.  Use the
same condition in ether_resolve() to send the broadcast packet back
to the stack and in in_ifcap_cksum() to force software checksumming.
This fixes regress/sys/kern/sosplice/loop.
OK procter@

3 years agoIn the end UTF-8 did not become a terminal feature, should not be listed
nicm [Sat, 6 Feb 2021 13:02:52 +0000 (13:02 +0000)]
In the end UTF-8 did not become a terminal feature, should not be listed
in man page.

3 years agoMention Netgear ProSecure UTM25.
visa [Sat, 6 Feb 2021 09:33:41 +0000 (09:33 +0000)]
Mention Netgear ProSecure UTM25.

3 years agoRevise kernel's ld.script on octeon
visa [Sat, 6 Feb 2021 09:31:47 +0000 (09:31 +0000)]
Revise kernel's ld.script on octeon

This allows more control over the structure of the linked kernel image.
Now the ELF .openbsd.randomdata segment can be omitted from BOOT kernel.
The segment has caused trouble with broken firmware when the firmware
tries to load it on top of the actual kernel segment.

Discussed with and OK deraadt@

3 years agoOnly hexdump packets/messages on higher debug levels.
jsing [Sat, 6 Feb 2021 07:34:34 +0000 (07:34 +0000)]
Only hexdump packets/messages on higher debug levels.

3 years agoTest reads and writes between the client and server.
jsing [Sat, 6 Feb 2021 07:33:27 +0000 (07:33 +0000)]
Test reads and writes between the client and server.

3 years agoUse message_set() instead of direct assignment to curr_message
tb [Sat, 6 Feb 2021 06:19:28 +0000 (06:19 +0000)]
Use message_set() instead of direct assignment to curr_message
to avoid leaking the current help text.

from Anindya Mukherjee

3 years agoRoll back the hostname->uname change in rev 1.10. It turns out
dtucker [Fri, 5 Feb 2021 22:03:40 +0000 (22:03 +0000)]
Roll back the hostname->uname change in rev 1.10.  It turns out
uname -n doesn't do what we need for some platforms in portable,
so we'll fix the original problem (that some other platforms don't
have hostname at all) by providing wrapper function to implement
it.

3 years agodisable autovol by default and set default volume to 127
jcs [Fri, 5 Feb 2021 17:59:33 +0000 (17:59 +0000)]
disable autovol by default and set default volume to 127

The previous behavior of automatically decreasing playback volume
when new programs start playing can be achieved with '-w on'.

ok ratchov, patrick

3 years agoFix whitespace.
bluhm [Fri, 5 Feb 2021 16:47:48 +0000 (16:47 +0000)]
Fix whitespace.

3 years agosync
deraadt [Fri, 5 Feb 2021 16:24:55 +0000 (16:24 +0000)]
sync

3 years agoRemove the terrible_ping_kludge() workaround. We have committed a fix to
mglocker [Fri, 5 Feb 2021 14:19:21 +0000 (14:19 +0000)]
Remove the terrible_ping_kludge() workaround.  We have committed a fix to
the USB stack in the meantime for uhidev(4) and ugen(4) to resolve the data
toggle issue in relation to xhci(4).

ok gnezdo@, djm@

3 years agoSetup two pair(4) and one lo(4) interface in different routing
bluhm [Fri, 5 Feb 2021 14:12:17 +0000 (14:12 +0000)]
Setup two pair(4) and one lo(4) interface in different routing
domains and with different interface MTU.  Test that packet flow
and TCP path MTU discovery works.

3 years agoSend Unicode directional isolate characters around horizontal pane
nicm [Fri, 5 Feb 2021 12:29:18 +0000 (12:29 +0000)]
Send Unicode directional isolate characters around horizontal pane
borders if the terminal support UTF-8 and an extension terminfo(5)
capability "Bidi" is present. On terminals with BiDi support (ie, VTE)
this seems to be enough to display right-to-left text acceptably enough
to be usable (with some caveats about the mouse position). Requested by
and with help from Mahmoud Elagdar in GitHub issue 2425.

3 years agoRemove the not so periodic stats from rpki-client. The output is not very
claudio [Fri, 5 Feb 2021 12:26:52 +0000 (12:26 +0000)]
Remove the not so periodic stats from rpki-client. The output is not very
useful and the way it works is a bit strange.
OK job@ tb@

3 years agoAdd a -S flag to new-window to make it select the existing window if one
nicm [Fri, 5 Feb 2021 12:23:49 +0000 (12:23 +0000)]
Add a -S flag to new-window to make it select the existing window if one
with the given name already exists rather than failing with an error.
Also add a format to check if a window or session name exists which
allows the same with other commands. Requested by and discussed with
kn@.

3 years agoIntroduce a transaction id. This is currently mostly a dummy-variable, but
martijn [Fri, 5 Feb 2021 10:30:45 +0000 (10:30 +0000)]
Introduce a transaction id. This is currently mostly a dummy-variable, but
will later on be needed for when we reintroduce agentx master support.

feedback and OK dlg@, rob@

3 years agoPrevent that when ugen(4) tries to set an alternative configuration
mglocker [Fri, 5 Feb 2021 08:17:22 +0000 (08:17 +0000)]
Prevent that when ugen(4) tries to set an alternative configuration
descriptor (usually doesn't happen), that we continue to use an outdated
cdesc pointer which still refers to the previous cdesc.  Instead update
the cdesc pointer to the new configuration descriptor.

Reported by Thomas Jeunet <cleptho AT gmail DOT com>

ok phessler@

3 years agohostname is not specified by POSIX but uname -n is, so use the latter for
dtucker [Fri, 5 Feb 2021 06:01:58 +0000 (06:01 +0000)]
hostname is not specified by POSIX but uname -n is, so use the latter for
portability.  Patch from Geert Hendrickx via github PR#208.

3 years agoRemove debug message from sigchld handler. While this works on OpenBSD
dtucker [Fri, 5 Feb 2021 02:20:23 +0000 (02:20 +0000)]
Remove debug message from sigchld handler.  While this works on OpenBSD
it can cause problems on other platforms.  From kircherlike at outlook.com
via bz#3259, ok djm@

3 years agoarm_intr_establish_fdt() has long been renamed to fdt_intr_establish().
patrick [Fri, 5 Feb 2021 00:42:25 +0000 (00:42 +0000)]
arm_intr_establish_fdt() has long been renamed to fdt_intr_establish().

3 years agoFix CVS tag.
patrick [Fri, 5 Feb 2021 00:25:19 +0000 (00:25 +0000)]
Fix CVS tag.

3 years agoFix whitespace.
patrick [Fri, 5 Feb 2021 00:13:37 +0000 (00:13 +0000)]
Fix whitespace.

3 years agoRename probe/attach functions to fit our regular naming scheme. Replace
patrick [Fri, 5 Feb 2021 00:08:26 +0000 (00:08 +0000)]
Rename probe/attach functions to fit our regular naming scheme.  Replace
&armv7_bs_tag with fdt_cons_bs_tag, which is our early console bus tag
for both arm64 and armv7.  On armv7, it points to &armv7_bs_tag.  With
this we can get rid of the armv7var.h include.  Reduce a bit of diff to
imxuart(4).

ok kettenis@

3 years agoMove exuart(4) to sys/dev/fdt so it can be shared between arm64 and armv7.
patrick [Fri, 5 Feb 2021 00:05:20 +0000 (00:05 +0000)]
Move exuart(4) to sys/dev/fdt so it can be shared between arm64 and armv7.

ok kettenis@

3 years agoexuart(4) does not need to include exclockvar.h. The header seems to only
patrick [Thu, 4 Feb 2021 23:36:31 +0000 (23:36 +0000)]
exuart(4) does not need to include exclockvar.h.  The header seems to only
provide a function for the I2C clock frequency, used by exiic(4).

3 years agoTedu exuartvar.h, which has not been needed since we switched to the "new
patrick [Thu, 4 Feb 2021 23:28:20 +0000 (23:28 +0000)]
Tedu exuartvar.h, which has not been needed since we switched to the "new
way" of attaching the console.

3 years agoAdd missing CVS tag.
patrick [Thu, 4 Feb 2021 23:23:23 +0000 (23:23 +0000)]
Add missing CVS tag.

3 years agosync
patrick [Thu, 4 Feb 2021 22:40:45 +0000 (22:40 +0000)]
sync

3 years agoTedu unnecessary imxuartvar.h.
patrick [Thu, 4 Feb 2021 22:40:04 +0000 (22:40 +0000)]
Tedu unnecessary imxuartvar.h.

ok kettenis@

3 years agoremove the suggestion to permit pkg_add with doas "nopass" when doing
sthen [Thu, 4 Feb 2021 22:12:03 +0000 (22:12 +0000)]
remove the suggestion to permit pkg_add with doas "nopass" when doing
ports dev work.

if you are able to run pkg_add as root without a password, your account
is root-equivalent.

typing the password multiple times is a pain but if somebody is going to
choose to weaken their local security in this way, it should be their
own decision and not something they have read in a manpage.

ok tb@ thfr@

3 years agoit's fine to route-to to a table.
dlg [Thu, 4 Feb 2021 21:28:44 +0000 (21:28 +0000)]
it's fine to route-to to a table.

i think this should have been tweaked a while back.

3 years agoroute-to rules take ips now, not interfaces with optional ips.
dlg [Thu, 4 Feb 2021 21:27:18 +0000 (21:27 +0000)]
route-to rules take ips now, not interfaces with optional ips.

reminded by bluhm@

3 years agoroute-to rules take ips, not interfaces with optional ips.
dlg [Thu, 4 Feb 2021 21:26:02 +0000 (21:26 +0000)]
route-to rules take ips, not interfaces with optional ips.

reminded by bluhm@

3 years agoroute-to rules take an ip now, not an interface with optional ip.
dlg [Thu, 4 Feb 2021 21:20:24 +0000 (21:20 +0000)]
route-to rules take an ip now, not an interface with optional ip.

they now also only work on keep state rules, so there's even more
errors from the parser to expect.

reminded by bluhm@

3 years ago'struct group' is now called 'struct dh_group'.
tobhe [Thu, 4 Feb 2021 20:45:13 +0000 (20:45 +0000)]
'struct group' is now called 'struct dh_group'.

3 years agoRename 'struct group' to 'struct dh_group' for more clarity and
tobhe [Thu, 4 Feb 2021 20:38:26 +0000 (20:38 +0000)]
Rename 'struct group' to 'struct dh_group' for more clarity and
to avoid name clashes.

ok patrick@

3 years agoEC_POINT_get_affine_coordinates_GFp() and EC_POINT_get_affine_coordinates_GF2m()
tobhe [Thu, 4 Feb 2021 20:15:02 +0000 (20:15 +0000)]
EC_POINT_get_affine_coordinates_GFp() and EC_POINT_get_affine_coordinates_GF2m()
do the same thing.  Remove redundant check and always use the _GFp() variant.

discussed with tb@
ok patrick@

3 years agoUpgrade to OpenSSL 1.1 compatible crypto API. Add additional
tobhe [Thu, 4 Feb 2021 19:59:15 +0000 (19:59 +0000)]
Upgrade to OpenSSL 1.1 compatible crypto API. Add additional
checks where needed.

ok markus@ patrick@

3 years agoReferece trpt(8) from the SO_DEBUG section of getsockopt(2).
bluhm [Thu, 4 Feb 2021 18:51:01 +0000 (18:51 +0000)]
Referece trpt(8) from the SO_DEBUG section of getsockopt(2).
OK claudio@ visa@

3 years agoImplement the nc(1) -D socket debug option also in tcpbench(1).
bluhm [Thu, 4 Feb 2021 18:46:25 +0000 (18:46 +0000)]
Implement the nc(1) -D socket debug option also in tcpbench(1).
This allows to analyse TCP connections.
OK claudio@

3 years agosync
anton [Thu, 4 Feb 2021 16:28:07 +0000 (16:28 +0000)]
sync

3 years agoAdd uhidpp(4), a driver for Logitech HID++ devices. Currently limited to
anton [Thu, 4 Feb 2021 16:25:38 +0000 (16:25 +0000)]
Add uhidpp(4), a driver for Logitech HID++ devices. Currently limited to
exposing battery sensors for HID++ 2.0 devices. Most of the code is
derived from the hid-logitech-hidpp Linux driver.

Thanks to Ville Valkonen <weezeldinga at gmail dot com> for testing.

ok mglocker@

3 years agoAdd uhidev_set_report_dev() allowing usb drivers to early on install a
anton [Thu, 4 Feb 2021 16:18:34 +0000 (16:18 +0000)]
Add uhidev_set_report_dev() allowing usb drivers to early on install a
handler for a specific report id. Needed by an upcoming driver in order
to communicate with the device already in the attach routine.

ok mglocker@ as part of a larger diff

3 years agoHandle Netgear ProSecure UTM25
visa [Thu, 4 Feb 2021 16:16:10 +0000 (16:16 +0000)]
Handle Netgear ProSecure UTM25

This makes the system recognize and configure Netgear ProSecure UTM25.
Of the network ports, LAN1-4 and WAN1 are functional. WAN2 does not work
for some reason. Even though WAN1 has a separate link to the SoC, the
connection appears to go through the same switch that the LAN ports use.
At the moment, the system relies on U-Boot to set up the switch so that
the LAN and WAN segments stay separate.

Initial diff and input from Thaison Nguyen, thank you!

3 years agoThe uri parameter of struct entity is actually a local file path.
claudio [Thu, 4 Feb 2021 14:32:01 +0000 (14:32 +0000)]
The uri parameter of struct entity is actually a local file path.
Rename field to reduce confusion about what is what.
OK tb@

3 years agoRedraw status line and borders on pane enable/disable, GitHub issue 2554.
nicm [Thu, 4 Feb 2021 14:02:24 +0000 (14:02 +0000)]
Redraw status line and borders on pane enable/disable, GitHub issue 2554.

3 years agoDefine the msgbuf queues globably. Clean up the code since rsyncq and procq
claudio [Thu, 4 Feb 2021 13:38:27 +0000 (13:38 +0000)]
Define the msgbuf queues globably. Clean up the code since rsyncq and procq
no longer need to be passed all the way down anymore. Shuffle code a bit
to bring it into more order.
OK tb@

3 years agoRevert previous commit. The vnode returned by ptm_vn_open() is open and
claudio [Thu, 4 Feb 2021 13:32:33 +0000 (13:32 +0000)]
Revert previous commit. The vnode returned by ptm_vn_open() is open and
can not simply be vrele()-ed on error. The code currently depends on
closef() to do the cleanup.

Reported-by: syzbot+b0e18235e96adf81883d@syzkaller.appspotmail.com
3 years agoFix an overly long line
claudio [Thu, 4 Feb 2021 09:57:37 +0000 (09:57 +0000)]
Fix an overly long line

3 years agoEventhough most openssl includes include everything try to be a bit more
claudio [Thu, 4 Feb 2021 08:58:19 +0000 (08:58 +0000)]
Eventhough most openssl includes include everything try to be a bit more
explicit about what is used where. Seems to be the least worst solution.

3 years agoRemove openssl includes and fcntl.h neither of those are used in main.c.
claudio [Thu, 4 Feb 2021 08:21:50 +0000 (08:21 +0000)]
Remove openssl includes and fcntl.h neither of those are used in main.c.
Add errno.h since this code makes direct use of errno.

3 years agoCleanup openssl includes a bit. Use x509.h instead of x509v3.h, add asn1.h
claudio [Thu, 4 Feb 2021 08:13:57 +0000 (08:13 +0000)]
Cleanup openssl includes a bit. Use x509.h instead of x509v3.h, add asn1.h
and remove evp.h. First two suggested by tb@
Compiler agrees

3 years agoShuffle code around, move all the bits of proc_parser into parser.c.
claudio [Thu, 4 Feb 2021 08:10:24 +0000 (08:10 +0000)]
Shuffle code around, move all the bits of proc_parser into parser.c.
OK tb@

3 years agoPrevent a lock order issue by shuffling code around. Instead of allocating
claudio [Thu, 4 Feb 2021 07:54:51 +0000 (07:54 +0000)]
Prevent a lock order issue by shuffling code around. Instead of allocating
the file descriptors early do it late. This way the fdplock is not held
during the VFS operations.
OK mvs@

3 years agoUnconditionally allocate a buffer big enough to hold a struct
anton [Thu, 4 Feb 2021 06:57:19 +0000 (06:57 +0000)]
Unconditionally allocate a buffer big enough to hold a struct
usb_ctl_report.

Limiting the size of the buffer to the size of the requested report can
cause the ioctl(USB_GET_REPORT) command to fail with EFAULT as the
kernel will always copy sizeof(struct usb_ctl_report) bytes from the
address passed from user space. That is when the given address +
sizeof(struct usb_ctl_report) crosses a page boundary and the adjacent
page is not mapped.

ok mglocker@

3 years agoRemove last remnants of ASU ac_flag from accounting.
rob [Thu, 4 Feb 2021 02:03:53 +0000 (02:03 +0000)]
Remove last remnants of ASU ac_flag from accounting.

OK deraadt@, bluhm@

3 years agomake if_pfsync.c a better friend with PF_LOCK
sashan [Thu, 4 Feb 2021 00:55:41 +0000 (00:55 +0000)]
make if_pfsync.c a better friend with PF_LOCK

The code delivered in this change is currently disabled. Brave souls
may enable the code by adding -DWITH_PF_LOCK when building customized
kernel. Big thanks goes to Hrvoje@ for providing test equipment and
testing.

As soon as we enter the next release cycle, the WITH_PF_LOCK will be
defined as default option for MP kernels.

OK dlg@

3 years agoAdd SIOCAIFADDR_IN and SIOCDIFADDR_IN to the wroute pledge
tobhe [Wed, 3 Feb 2021 22:46:55 +0000 (22:46 +0000)]
Add SIOCAIFADDR_IN and SIOCDIFADDR_IN to the wroute pledge
to allow setting and removing IPv4 addresses.
Needed for future iked(8) improvements.

Discussed with sthen@ and florian@
ok bluhm@ deraadt@

3 years agoFail early in legacy exporter if master secret is not available
tb [Wed, 3 Feb 2021 15:14:44 +0000 (15:14 +0000)]
Fail early in legacy exporter if master secret is not available

The exporter depends on having a master secret. If the handshake is
not completed, it is neither guaranteed that a shared ciphersuite was
selected (in which case tls1_PRF() will currently NULL deref) or that
a master secret was set up (in which case the exporter will succeed
with a predictable value). Neither outcome is desirable, so error out
early instead of entering the sausage factory unprepared. This aligns
the legacy exporter with the TLSv1.3 exporter in that regard.

with/ok jsing

3 years agounbreak getline() conversion in disklabel
naddy [Wed, 3 Feb 2021 14:41:40 +0000 (14:41 +0000)]
unbreak getline() conversion in disklabel

3 years agoTurns off the direct ACK on every other segment
jan [Wed, 3 Feb 2021 13:40:06 +0000 (13:40 +0000)]
Turns off the direct ACK on every other segment

The kernel uses a huge amount of processing time for sending ACKs to the sender
on the receiving interface.  After receiving a data segment, we send out two
ACKs.  The first one in tcp_input() direct after receiving.  The second ACK is
send out, after the userland or the sosplice task read some data out of the
socket buffer.  Thus, we save some processing time and improve network
performance.

Longer tested by sthen@
OK claudio@

3 years agoAdding a hard-trap instruction after the __threxit syscall instruction
kurt [Wed, 3 Feb 2021 13:00:39 +0000 (13:00 +0000)]
Adding a hard-trap instruction after the __threxit syscall instruction
broke pthreads on hppa. Reverting. Ok deraadt@

3 years agoAdd OID for draft-ietf-opsawg-finding-geofeeds
job [Wed, 3 Feb 2021 12:52:05 +0000 (12:52 +0000)]
Add OID for draft-ietf-opsawg-finding-geofeeds

https://tools.ietf.org/html/draft-ietf-opsawg-finding-geofeeds describes
a mechanism to authenticate RFC 8805 Geofeed data files through the RPKI.

OpenSSL counterpart https://github.com/openssl/openssl/pull/14050

OK tb@ jsing@

3 years agoAfter the rev. 1.108 commit we see some issues with ugen(4) behaviour,
mglocker [Wed, 3 Feb 2021 11:34:24 +0000 (11:34 +0000)]
After the rev. 1.108 commit we see some issues with ugen(4) behaviour,
which finally makes umb(4) fail, since ugen(4) attaches to one of the
umb(4) interfaces, fails, and marks the whole device dying.  Therefore
make usbd_device2interface_handle() backwards compatible again.

Problem reported by Mikolaj Kucharski.

ok edd@

3 years agoRemove rsync.c from the test tool builds, nothing depends on that anymore
claudio [Wed, 3 Feb 2021 10:45:12 +0000 (10:45 +0000)]
Remove c from the test tool builds, nothing depends on that anymore

3 years agoUse mkpath() == -1 to check for failure. No functional change.
claudio [Wed, 3 Feb 2021 09:29:22 +0000 (09:29 +0000)]
Use mkpath() == -1 to check for failure. No functional change.

3 years agochange pf_route so pf only runs when packets enter and leave the stack.
dlg [Wed, 3 Feb 2021 07:41:12 +0000 (07:41 +0000)]
change pf_route so pf only runs when packets enter and leave the stack.

before this change pf_route operated on the semantic that pf runs
when packets go over an interface, so when pf_route changed which
interface the packet was on it would run pf_test again. this change
changes (restores) the semantic that pf is only supposed to run
when packets go in or out of the network stack, even if route-to
is responsibly for short circuiting past the network stack.

just to be clear, for normal packets (ie, those not touched by
route-to/reply-to/dup-to), there isn't a difference between running
pf when packets enter or leave the stack, or having pf run when a
packet goes over an interface.

the main reason for this change is that running the same packet
through pf multiple times creates confusion for the state table.
by default, pf states are floating, meaning that packets are matched
to states regardless of which interface they're going over. if a
packet leaving on em0 is rerouted out em1, both traversals will end
up using the same state, which at best will make the accounting
look weird, or at worst fail some checks in the state and get
dropped.

another reason for this commit is is to make handling of the changes
that route-to makes consistent with other changes that are made to
packet. eg, when nat is applied to a packet, we don't run pf_test
again with the new addresses.

the main caveat with this diff is you can't have one rule that
pushes a packet out a different interface, and then have a rule on
that second interface that NATs the packet. i'm not convinced this
ever worked reliably or was used much anyway, so we don't think
it's a big concern.

discussed with many, with special thanks to bluhm@, sashan@ and
sthen@ for weathering most of that pain.
ok claudio@ sashan@ jmatthew@