openbsd
2 years agonet.inet6.icmp6.nd6_debug doesn't need to warn about RDNSS/DNSSL options
sthen [Sun, 7 Nov 2021 19:38:25 +0000 (19:38 +0000)]
net.inet6.icmp6.nd6_debug doesn't need to warn about RDNSS/DNSSL options
ok phessler@

3 years agoFall back to label if function is missing
kn [Sun, 7 Nov 2021 16:43:12 +0000 (16:43 +0000)]
Fall back to label if function is missing

The "label" property is obsolete and "function" should be used,
but devices like the Raspberry Pi 4b still use it.

Detect LEDs on such machines:

-gpioleds0 at mainbus0: no LEDs
+gpioleds0 at mainbus0: "led0", "led1"

OK patrick

3 years agoSimplify print logic
kn [Sun, 7 Nov 2021 16:40:30 +0000 (16:40 +0000)]
Simplify print logic

OK patrick

3 years agoEnable igc(4).
patrick [Sun, 7 Nov 2021 16:06:31 +0000 (16:06 +0000)]
Enable igc(4).

ok deraadt@

3 years agoConstify struct cfattach, not struct cfdriver.
patrick [Sun, 7 Nov 2021 15:59:09 +0000 (15:59 +0000)]
Constify struct cfattach, not struct cfdriver.

Fixes panic seen on the Pinebook Pro.

3 years agoIn X509_STORE_CTX, rename the X509_STORE store rather than ctx.
tb [Sun, 7 Nov 2021 15:52:38 +0000 (15:52 +0000)]
In X509_STORE_CTX, rename the X509_STORE store rather than ctx.

ok gnezdo jsing

3 years agoIn X509_STORE_CTX rename the misnamed last_untrusted to num_untrusted
tb [Sun, 7 Nov 2021 15:51:23 +0000 (15:51 +0000)]
In X509_STORE_CTX rename the misnamed last_untrusted to num_untrusted

ok jsing

3 years agoincrease ramdisk space for another driver
deraadt [Sun, 7 Nov 2021 15:50:15 +0000 (15:50 +0000)]
increase ramdisk space for another driver

3 years agonew manual pages
schwarze [Sun, 7 Nov 2021 15:29:01 +0000 (15:29 +0000)]
new manual pages
ASN1_item_digest(3), ASN1_item_sign(3), and ASN1_item_verify(3)

3 years agoFix handling of interrupts shared between multiple dwiic(4) devices.
stsp [Sun, 7 Nov 2021 14:07:43 +0000 (14:07 +0000)]
Fix handling of interrupts shared between multiple dwiic(4) devices.

Interrupt sharing did not work correctly when two dwiic(4) devices
share an interrupt line. We ended up with an interrupt storm.
One of the two interrupt handlers would see interrupt status bits set
to zero but claim the interrupt regardless. The second handler would
never get to run, and the interrupt condition on the second device was
not cleared as a result. Fix this by returning zero from dwiic_intr()
if the device's interrupt status bits read back as zero.

The storm occurred as soon as X11 was started. xenodm(1) never managed to
display its login prompt. Observed on the Thinkpad Helix2 which had been
unable to start X since dwiic(4) started to attach on this machine in 2018.
(I already saw the problem back then but never dug into it, and temporarily
lost access to helix2 hardware for a long time.)

With help from jcs@ who provided debugging hints already back in 2018.
ok kettenis@

3 years agoNuke unused file.
krw [Sun, 7 Nov 2021 13:15:10 +0000 (13:15 +0000)]
Nuke unused file.

3 years agoFix tpyo of ecma. Reported by Matthew (chohag at jtan dot com)
claudio [Sun, 7 Nov 2021 12:05:28 +0000 (12:05 +0000)]
Fix tpyo of ecma. Reported by Matthew (chohag at jtan dot com)

3 years agoSpeed up _rc_wait: only sleep 1/2 second between rc_check tries and make sure
ajacoutot [Sun, 7 Nov 2021 08:31:24 +0000 (08:31 +0000)]
Speed up _rc_wait: only sleep 1/2 second between rc_check tries and make sure
we have at least 1s for SIGTERM to do its job.

3 years agoUse built-in SECONDS instead of hand roller timer.
ajacoutot [Sun, 7 Nov 2021 08:26:12 +0000 (08:26 +0000)]
Use built-in SECONDS instead of hand roller timer.

with a tweak from kn@
ok sthen@

3 years agonm: add some .text.* support for symbols
semarie [Sun, 7 Nov 2021 08:09:04 +0000 (08:09 +0000)]
nm: add some .text.* support for symbols

.text.* are generated when using -ffunction-sections.

makes nm(1) to correctly identify the function symbols as N_TEXT.

found while debugging librsvg build error, where some symbols where not found by libtool(1) (which is using nm(1)).

ok gkoehler@

3 years agoMake `unp_msgcount' and `unp_file' atomic. Introduce `unp_rights_mtx'
mvs [Sat, 6 Nov 2021 17:35:14 +0000 (17:35 +0000)]
Make `unp_msgcount' and `unp_file' atomic. Introduce `unp_rights_mtx'
mutex(9) to protect `unp_rights'.

This removes global rwlock(9) from unp_internalize() and unp_externalize()
normal paths and leaves it in the unp_externalize() error path only. Also
we don't need to simultaneously hold fdplock() and `unp_lock' within
unp_internalize().

The `unp_rights' can't be atomic. Otherwise the thread which exceeding the
limit will break all other not-exceeding threads until it decrements
`unp_rights'. That why the mutex(9) used for protection.

It's safe to call fptounp() without `unp_lock' held. We always got this
file descriptor by fd_getfile(9) so we always have the extra reference
and this descriptor can't be closed by concurrent thread. Some sockets
could be destroyed through 'PRU_ABORT' path but they don't have
associated file descriptor and they are not accessible in the
unp_internalize() path.

The `unp_file' access without `unp_lock' held is also safe. Each socket
could have the only associated file descriptor and each file descriptor
could have the only associated socket. We only assign `unp_file' in the
unp_internalize() path where we got the socket by fd_getfile(9). This
descriptor has the extra reference and couldn't be closed concurrently.
We could override `unp_file' but with the same address because the
associated file descriptor can't be changed so the address will be also
the same. While unp_gc() concurrently runs the dereference of
non-NULL `unp_file' is always safe.

Discussed with kettenis@ and mpi@.

ok mpi@

3 years agoImprove formatting. The line breaks in the lists of methods were very ugly.
schwarze [Sat, 6 Nov 2021 15:00:25 +0000 (15:00 +0000)]
Improve formatting.  The line breaks in the lists of methods were very ugly.
While here, put descriptions right after the prototypes they describe.
No content change.

3 years agoStop URL encoding the tilde character
kn [Sat, 6 Nov 2021 14:27:45 +0000 (14:27 +0000)]
Stop URL encoding the tilde character

RFC 1738 Uniform Resource Locators (URL) lists tilde as unsafe character.
RFC 2396 Uniform Resource Identifiers (URI): Generic Syntax updates it to

The tilde "~" character was added to those in the "unreserved" set,
since it is extensively used on the Internet in spite of the
difficulty to transcribe it with some keyboards.

In theory, this shouldn't make a difference, but some servers do not decode
"%7e" and thus erroneously serve a 404.

RFC 2396 2.4.2. When to Escape and Unescape says:

In some cases, data that could be represented by an unreserved
character may appear escaped; for example, some of the unreserved
"mark" characters are automatically escaped by some systems.  If the
given URI scheme defines a canonicalization algorithm, then
unreserved characters may be unescaped according to that algorithm.
For example, "%7e" is sometimes used instead of "~" in an http URL
path, but the two are equivalent for an http URL.

Update ftp(1) to RFC 2396 by no longer treating "~" as unsafe character.
This is effectively a one-character diff;  update comments accordingly as
well as the order of characters to ease code-to-standard comparison.

This matches curl(1) and wget(1) behaviour wrt. encoding of "~".

OK sthen

3 years agoAlways run _rc_rm_runfile when process is sent a SIGKILL or rc_post fails (at
ajacoutot [Sat, 6 Nov 2021 13:33:10 +0000 (13:33 +0000)]
Always run _rc_rm_runfile when process is sent a SIGKILL or rc_post fails (at
this point the process has been terminated).

3 years agoStart cleaning up X509_STORE_get1_issuer()
tb [Sat, 6 Nov 2021 12:31:40 +0000 (12:31 +0000)]
Start cleaning up X509_STORE_get1_issuer()

Get rid of the last X509_OBJECT_free_contents() call by moving the object
from the stack to the heap. I deliberately kept the obj variable to keep
obj and pobj separate.  Rename the out parameter from issuer to out_issuer
to ensure that we only assign it when we have acquired a reference that we
can return. Add a new X509 *issuer. In the first part of the function,
acquire an extra reference before check_issuer/check_time.

In the second part of the function, acquire a reference inside the lock to
avoid a race.  Deal with ret only in one place.

ok jsing

3 years agoIn X509_STORE_get1_issuer() do not call the verify callback from
tb [Sat, 6 Nov 2021 12:27:05 +0000 (12:27 +0000)]
In X509_STORE_get1_issuer() do not call the verify callback from
x509_check_cert_time(). Matches a change made in OpenSSL 70dd3c65.

ok jsing

3 years agoDrop uneeded sleep.
ajacoutot [Sat, 6 Nov 2021 11:02:53 +0000 (11:02 +0000)]
Drop uneeded sleep.

3 years agoAllow passing a different signal than SIGTERM in the default rc_stop()
ajacoutot [Sat, 6 Nov 2021 10:38:04 +0000 (10:38 +0000)]
Allow passing a different signal than SIGTERM in the default rc_stop()
function. This will allow to simplify some rc.d script that cook there own
function to gracefully stop a process (e.g. web servers). There are other use
cases as well.
And do the same for rc_reload because it's cheap and can also simplify a
handful of rc.d scripts.

Behave like shutdown and if the process is still not down after daemon_timeout
(configurable; default to 30s), then send a SIGKILL.

While here, factorise pkill invocations into a _rc_sendsig() function that can
potentially be used by rc.d scripts instead of cooking pkill lines; this will
benefit from the configured routing table etc.

tested & ok robert@

3 years agoPlug a couple of minor mem leaks. From beldmit at gmail.com via github
dtucker [Sat, 6 Nov 2021 10:13:39 +0000 (10:13 +0000)]
Plug a couple of minor mem leaks. From beldmit at gmail.com via github
PR#283, ok markus@

3 years agoFix indent.
jsing [Sat, 6 Nov 2021 07:52:22 +0000 (07:52 +0000)]
Fix indent.

3 years agoRefactor X509_STORE_get1_certs()
tb [Sat, 6 Nov 2021 07:18:18 +0000 (07:18 +0000)]
Refactor X509_STORE_get1_certs()

Split the retrieval of the certs in the store's cache that match the
desired subject into a separate function. This greatly simplifies
locking, error handling and the flow of the function.

with/ok jsing

3 years agoMake kqread event filter MP-safe
visa [Sat, 6 Nov 2021 05:48:47 +0000 (05:48 +0000)]
Make kqread event filter MP-safe

Use the monitored kqueue's kq_lock to serialize kqueue and knote access.

Typically, the "object lock" would cover also the klist, but that is not
possible with kqueues. knote_activate() needs kq_lock of the monitoring
kqueue, which would create lock order troubles if kq_lock was held when
calling KNOTE(&kq->kq_sel.si_note). Avoid this by using a separate klist
lock for kqueues.

The new klist lock is system-wide. Each kqueue instance could have
a dedicated klist lock. However, the efficacy of dedicated versus
system-wide lock is somewhat limited because the current implementation
activates kqueue knotes through a single thread.

OK mpi@

3 years agoAllocate socket and initialize so_lock in one place
visa [Sat, 6 Nov 2021 05:26:33 +0000 (05:26 +0000)]
Allocate socket and initialize so_lock in one place

This makes witness(4) use a single lock type for tracking so_lock.
Previously, so_lock was covered by two distinct lock types because there
were separate rw_init() initializers in socreate() and sonewconn().

OK kettenis@

3 years agoAdd missing newline to fix markup
kn [Sat, 6 Nov 2021 01:37:02 +0000 (01:37 +0000)]
Add missing newline to fix markup

3 years agoAdd "install.site" and "upgrade.site" as additional manual names
kn [Sat, 6 Nov 2021 01:32:10 +0000 (01:32 +0000)]
Add "install.site" and "upgrade.site" as additional manual names

This makes "man upgrade.site" work, which is quite convenient for what is
sort of a configuration/script file -- similar to boot.conf(8) which lives
in boot.8 as additional Nm.

3 years agoAdd site(8), OpenBSD installation and upgrade customization
kn [Sat, 6 Nov 2021 01:24:37 +0000 (01:24 +0000)]
Add site(8), OpenBSD installation and upgrade customization

This is practically https://www.openbsd.org/faq/faq4.html#site
"Customizing the Install Process"++ with practical examples and references
to/from relevant manuals.

Prodding/first diff from Aaron Poffenberger <akp AT hypernote DOT com>
"I didn't know about it and now I'm using it on all my systems." florian
Feedback semarie afresh1
OK afresh1

3 years agoClarify iface option.
tobhe [Fri, 5 Nov 2021 22:51:56 +0000 (22:51 +0000)]
Clarify iface option.

3 years agotypo: a static objects -> a static object
tb [Fri, 5 Nov 2021 22:03:25 +0000 (22:03 +0000)]
typo: a static objects -> a static object

3 years agoFirst pass of streamlining X509_STORE_get1_{certs,crls}()
tb [Fri, 5 Nov 2021 21:39:45 +0000 (21:39 +0000)]
First pass of streamlining X509_STORE_get1_{certs,crls}()

These functions are quite messy. On top of the tricky logic querying the
cache, then refreshing the cache (unconditionally or not), then querying
again, then extracting a list of certs/crls and bumping their refcounts,
things are intermixed with locking and needlessly early allocations that
then need to be cleaned up again.

Use X509_STORE_CTX_get_obj_by_subject() to avoid using an object on the
stack and defer allocation of the returned stack of certs to later.
Flatten the logic a bit and prepare for further refactoring.

ok jsing

3 years agoTrade an abort() neutered by a comment for a blank line elsewhere.
tb [Fri, 5 Nov 2021 20:35:14 +0000 (20:35 +0000)]
Trade an abort() neutered by a comment for a blank line elsewhere.

3 years agoCorrect auto table entry for /var: it's 4G plus 2x physmem
otto [Fri, 5 Nov 2021 19:54:08 +0000 (19:54 +0000)]
Correct auto table entry for /var: it's 4G plus 2x physmem

3 years agoPerform stricter checking on the version string (which RFC 7230 says
benno [Fri, 5 Nov 2021 19:01:02 +0000 (19:01 +0000)]
Perform stricter checking on the version string (which RFC 7230 says
must be "HTTP" "/" DIGIT "." DIGIT), and answer 505 version not
supported when the number is outside of what we support, and 400 bad
request when the version format is wrong.
from Ross L Richardson, thanks!
ok claudio@

3 years agoMake sure that the configuration file is always read, even when
schwarze [Fri, 5 Nov 2021 18:03:00 +0000 (18:03 +0000)]
Make sure that the configuration file is always read, even when
running with the -M option or with a MANPATH environment variable
that has neither a leading or trailing ":" nor any "::".  If -M or
MANPATH override the configuration file rather than adding to it,
just ignore any "manpath" directives while processing the configuration
file.

This fixes a bug reported by Jan Stary <hans at stare dot cz>
on misc@.

3 years agoClean up X509_STORE_add_{cert,crl}().
tb [Fri, 5 Nov 2021 17:15:05 +0000 (17:15 +0000)]
Clean up X509_STORE_add_{cert,crl}().

Add a X509_STORE_add_object() function that adds an X509 object to the
store and takes care of locking and cleaning up. This way we can set up
an X509_OBJECT for both the cert and CRL case and hand over to the new
function.

There is one intentional change of behavior: if there is an attempt to
add an object which is already present in the store, succeed instead of
throwing an error. This makes sense and is also the OpenSSL behavior.

As pointed out by jsing, this is a partial fix for the long standing
GH issue #100 on libtls where connections would fail if the store
contains duplicate certificates.

Also: remove the internal X509_OBJECT_dec_ref_count(), which is no
longer used.

ok jsing

3 years agoUnify variable names in X509_STORE_{free,up_ref,add_lookup}().
tb [Fri, 5 Nov 2021 17:13:14 +0000 (17:13 +0000)]
Unify variable names in X509_STORE_{free,up_ref,add_lookup}().
simplify the flow of X509_add_lookup().

ok jsing

3 years agoRename the ret variable in X509_OBJECT_new() to obj..
tb [Fri, 5 Nov 2021 17:11:28 +0000 (17:11 +0000)]
Rename the ret variable in X509_OBJECT_new() to obj..

ok jsing

3 years agoGarbage collect the unused skip member of X509_LOOKUP and
tb [Fri, 5 Nov 2021 17:09:36 +0000 (17:09 +0000)]
Garbage collect the unused skip member of X509_LOOKUP and
the unused cache member of X509_STORE.

ok jsing

3 years agoUse calloc() to remove the need of silly zeroing of most members.
tb [Fri, 5 Nov 2021 17:08:12 +0000 (17:08 +0000)]
Use calloc() to remove the need of silly zeroing of most members.
Check for allocation failures and if one happens push an error on
the stack and clean up using X509_STORE_free().

ok jsing

3 years agoStreamline and shorten x509_object_cmp() a bit.
tb [Fri, 5 Nov 2021 17:06:42 +0000 (17:06 +0000)]
Streamline and shorten x509_object_cmp() a bit.

ok jsing

3 years agoDrop a bunch of unnecesary parentheses and unify the order in which
tb [Fri, 5 Nov 2021 17:05:52 +0000 (17:05 +0000)]
Drop a bunch of unnecesary parentheses and unify the order in which
callbacks are called.

ok jsing

3 years agoCleanup X509_LOOKUP_new()
tb [Fri, 5 Nov 2021 17:03:15 +0000 (17:03 +0000)]
Cleanup X509_LOOKUP_new()

Switch from malloc() to calloc() and drop a bunch of initializations
to 0.  Call the returned object lu instead of the generic ret.

ok jsing

3 years agoNewer i.MX device trees store the skew information in the PHY's node, which
patrick [Fri, 5 Nov 2021 15:18:24 +0000 (15:18 +0000)]
Newer i.MX device trees store the skew information in the PHY's node, which
we can access through the phy-handle.  If there's no reference, keep doing
what we have been doing so far.

ok kettenis@

3 years agoShow the attribute name like in the other non conforming attribute errors
claudio [Fri, 5 Nov 2021 14:30:53 +0000 (14:30 +0000)]
Show the attribute name like in the other non conforming attribute errors
for snapshost and delta files.
OK deraadt@

3 years agoZap unused variables
kn [Fri, 5 Nov 2021 13:08:58 +0000 (13:08 +0000)]
Zap unused variables

OK martijn

3 years agoConstify struct cfattach.
mpi [Fri, 5 Nov 2021 11:38:51 +0000 (11:38 +0000)]
Constify struct cfattach.

3 years agoConstify struct cfattach.
mpi [Fri, 5 Nov 2021 11:38:29 +0000 (11:38 +0000)]
Constify struct cfattach.

3 years agoSimplify how IP addresses and AS numbers are passed between processes.
claudio [Fri, 5 Nov 2021 10:50:41 +0000 (10:50 +0000)]
Simplify how IP addresses and AS numbers are passed between processes.
Since they are stored in an array just blast the full array in and out
of the io buffers at once instead of iterating element by element.
It also allows to remove a lot of extra code.
OK benno@ job@

3 years agoFix bootorder string for disk
jan [Fri, 5 Nov 2021 10:18:50 +0000 (10:18 +0000)]
Fix bootorder string for disk

ok mlarkin@

3 years agoNewer i.MX device trees retriee the USB phy using the more generic property
patrick [Fri, 5 Nov 2021 09:36:30 +0000 (09:36 +0000)]
Newer i.MX device trees retriee the USB phy using the more generic property
name "phys". To handle those, make sure that we look it up and in case it's
not there fall back to "fsl,usbphy".

ok kettenis@

3 years agoAdd getmonotime() to test-http.c so that the test compiles again.
claudio [Fri, 5 Nov 2021 08:20:36 +0000 (08:20 +0000)]
Add getmonotime() to test-http.c so that the test compiles again.
Noticed as ususal by anton@

3 years agoGarbage collect xobj->data.{ptr,pkey}
tb [Fri, 5 Nov 2021 07:25:36 +0000 (07:25 +0000)]
Garbage collect xobj->data.{ptr,pkey}

Both these are essentially unused. Remove the last use of data.ptr
by initializing and copying the X509_OBJECT using memset() and
struct assignment in X509_STORE_CTX_get_subject_by_name() and add
a missing error check for X509_OBJECT_up_ref_count() while there.

ok beck

3 years agomove cert_filter_principals() to earlier in the file for reuse;
djm [Fri, 5 Nov 2021 03:10:58 +0000 (03:10 +0000)]
move cert_filter_principals() to earlier in the file for reuse;
no code change

3 years agoCache sha512 hash and parsed not_before and not_after with X509 cert.
beck [Thu, 4 Nov 2021 23:52:34 +0000 (23:52 +0000)]
Cache sha512 hash and parsed not_before and not_after with X509 cert.

Replace sha1 hash use with sha512 for certificate comparisons internal
to the library. use the cached sha512 for the validator's verification
cache.

Reduces our recomputation of hashes, and heavy use of time1 time
conversion functions noticed bu claudio@ in rpki client.

ok jsing@ tb@

3 years agoCleanup some old XXX needed comments. cert_parse() returns a referenced
claudio [Thu, 4 Nov 2021 18:26:48 +0000 (18:26 +0000)]
Cleanup some old XXX needed comments. cert_parse() returns a referenced
x509 object from the call and that reference needs to be freed. There is
a second inside of struct cert but that reference is still held.
So the  X509_free() calls are indeed needed and by moving them up a bit
the code gets a bit simpler too.
With and OK tb@

3 years agoOn errors related to the pipes to the childs don't error out right away.
claudio [Thu, 4 Nov 2021 18:00:07 +0000 (18:00 +0000)]
On errors related to the pipes to the childs don't error out right away.
Instead exit the main event loop and use waitpid to know why a child
went away. This should make it hopefully more clear when shit hits the fan.
OK tb@ deraadt@

3 years agoFix broken "boot device cdrom" feature after a fix in seabios.
jan [Thu, 4 Nov 2021 17:50:05 +0000 (17:50 +0000)]
Fix broken "boot device cdrom" feature after a fix in seabios.

seabios fixes wrong LUN handling upstream.  Thus, we have to adapt the LUN
of our cdrom bootorder string, too.

ok brynet@, dv@

3 years agoInstead of creating a struct repo for each unique caRepository URI
claudio [Thu, 4 Nov 2021 17:35:09 +0000 (17:35 +0000)]
Instead of creating a struct repo for each unique caRepository URI
use the rsync URI (a base version of caRepository) and the notify URI
to identify repositories. If both rsync URI and notify URI are the same
then the repo is the same. The notify URI is optional and can be NULL
so the lookup needs to be a bit careful.
This reduces the number of struct repos from 26k to around 50.
OK tb@

3 years agoThe authenticator is removed elsewhere.
tobhe [Thu, 4 Nov 2021 14:45:07 +0000 (14:45 +0000)]
The authenticator is removed elsewhere.

ok patrick@

3 years agoMove and promote getmonotime() to an internal API function.
claudio [Thu, 4 Nov 2021 14:24:41 +0000 (14:24 +0000)]
Move and promote getmonotime() to an internal API function.

3 years agoUse the same spacing for all defines.
claudio [Thu, 4 Nov 2021 14:21:19 +0000 (14:21 +0000)]
Use the same spacing for all defines.

3 years agoFix mandoc HTML rendering for command aliases
kn [Thu, 4 Nov 2021 13:15:13 +0000 (13:15 +0000)]
Fix mandoc HTML rendering for command aliases

Replace hand-rolled parentheses with the proper mdoc(7) macro,
otherwise the closing ")" ends up inside the command description.

Reported by Josh Rickmar, thanks!

3 years agorevert rev 1.30 of ttm_bo_util.c
jsg [Thu, 4 Nov 2021 12:52:37 +0000 (12:52 +0000)]
revert rev 1.30 of ttm_bo_util.c

Laurence Tratt reported firefox would hard lock a machine
with polaris12 with the ttm change from linux 5.10.77.
robert@ also hit the same problem.

3 years agoInstead of passing tal descriptions around just pass a tal id and
claudio [Thu, 4 Nov 2021 11:32:55 +0000 (11:32 +0000)]
Instead of passing tal descriptions around just pass a tal id and
use a small lookup table to print the description in the output path.
OK tb@

3 years agoTweaks (improve previous commit)
yasuoka [Thu, 4 Nov 2021 04:20:14 +0000 (04:20 +0000)]
Tweaks (improve previous commit)

from jmc

3 years agoClarify "aes" will accept keys which length is in 128:256 bits. Also
yasuoka [Thu, 4 Nov 2021 03:53:57 +0000 (03:53 +0000)]
Clarify "aes" will accept keys which length is in 128:256 bits.  Also
correct "cast" in ipsec.conf.5 to "cast128", add missing
"chacha20-poly1305", and sync iked.conf.5 and ipsec.conf.5 some
places.

ok jmc sthen

3 years agoMany downstreams expect ssh to compile as non-C99...
deraadt [Wed, 3 Nov 2021 22:00:56 +0000 (22:00 +0000)]
Many downstreams expect ssh to compile as non-C99...

3 years agolog the interface along with the neighbour ID in various ospfd/ospf6d
sthen [Wed, 3 Nov 2021 21:40:03 +0000 (21:40 +0000)]
log the interface along with the neighbour ID in various ospfd/ospf6d
messages.  ok remi@ benno@

if a neighbour is reachable over multiple network links, some problems
may be related to the link itself rather than the neighbour, so knowing
the interface can be important when trying to locate the source of a
problem.

3 years agoadjust for perfpolicy being auto by default; ok deraadt
jmc [Wed, 3 Nov 2021 19:54:28 +0000 (19:54 +0000)]
adjust for perfpolicy being auto by default; ok deraadt

3 years agoWhen handling CRLF and nulling out the optional CR, point nl at the
tb [Wed, 3 Nov 2021 18:10:12 +0000 (18:10 +0000)]
When handling CRLF and nulling out the optional CR, point nl at the
right NUL so that valid_url() and the .cer check work.

Tweaked version of a diff by claudio.

ok claudio

3 years agoAdd a test tal that has comments and also comes with CRLF
claudio [Wed, 3 Nov 2021 17:30:13 +0000 (17:30 +0000)]
Add a test tal that has comments and also comes with CRLF

3 years agodocument d2i_X509_ALGORS(3) and i2d_X509_ALGORS(3)
schwarze [Wed, 3 Nov 2021 15:02:14 +0000 (15:02 +0000)]
document d2i_X509_ALGORS(3) and i2d_X509_ALGORS(3)

3 years agoLimit the number of rsync processes being spawned by stopping to accept
claudio [Wed, 3 Nov 2021 14:59:37 +0000 (14:59 +0000)]
Limit the number of rsync processes being spawned by stopping to accept
new requests when over the limit. Use a generous limit of 16.
OK deraadt@

3 years agowhitespace observed during a read-through
deraadt [Wed, 3 Nov 2021 14:42:12 +0000 (14:42 +0000)]
whitespace observed during a read-through

3 years agoFix five bugs in X509_REQ_to_X509(3):
schwarze [Wed, 3 Nov 2021 14:36:21 +0000 (14:36 +0000)]
Fix five bugs in X509_REQ_to_X509(3):
* memory leak in X509_set_subject_name(ret, X509_NAME_dup(xn));
* memory leak in X509_set_issuer_name(ret, X509_NAME_dup(xn));
* memory leak in X509_set_pubkey(ret, X509_REQ_get_pubkey(r));
* missing return value check of X509_REQ_get_pubkey(r);
* missing return value check of X509_set_pubkey(...);
Some of these bugs have survived for twenty-five years.

I noticed the first two bugs while documenting the function,
then found that a commit in the OpenSSL 1.1.1 branch, which is
still under a free license, fixed all of them in 2016.

In the function X509_REQ_to_X509(3), merge everything worth merging
from OpenSSL 1.1.1, in particular the relevant parts of:
222561fe Apr 30 17:33:59 2015 -0400 (err: label cleanup)
0517538d Mar 17 00:15:48 2016 +0100 (the bugfix)
c5137473 Apr 3  23:37:32 2016 +0200 (code simplification)

While here, delete some commented out code that is wrong in
multiple ways and untouched since the SSLeay era.

One code tweak for readability by tb@, and OK tb@.

3 years agouse some sizeof, rather than INADDRSZ/IN6ADDRSZ; ok claudio
deraadt [Wed, 3 Nov 2021 13:48:46 +0000 (13:48 +0000)]
use some sizeof, rather than INADDRSZ/IN6ADDRSZ; ok claudio

3 years agoFix ASN1_TIME_diff() with NULL times
tb [Wed, 3 Nov 2021 13:44:15 +0000 (13:44 +0000)]
Fix ASN1_TIME_diff() with NULL times

The ASN1_TIME_diff() API accepts NULL ASN1_TIMEs and interprets them
as "now". This is used in sysutils/monit, as found by semarie with a
crash after update. Implement this behavior by porting a version of
ASN1_TIME_to_tm() to LibreSSL and using it in ASN1_TIME_diff().

Tested by semarie

ok beck jsing semarie

3 years agoAdd a cursor-style option, from Alexis Hildebrandt in GitHub issue 2960.
nicm [Wed, 3 Nov 2021 13:37:17 +0000 (13:37 +0000)]
Add a cursor-style option, from Alexis Hildebrandt in GitHub issue 2960.

3 years agoPrint the name of the non conforming attribute in the XML parse error.
claudio [Wed, 3 Nov 2021 13:30:56 +0000 (13:30 +0000)]
Print the name of the non conforming attribute in the XML parse error.
OK beck@

3 years agoFor chunked encoding on switch to STATE_RESPONSE_CHUNKED_TRAILER when
claudio [Wed, 3 Nov 2021 13:29:28 +0000 (13:29 +0000)]
For chunked encoding on switch to STATE_RESPONSE_CHUNKED_TRAILER when
the full chunk was fetched. If the chunk size is bigger than
HTTP_BUF_SIZE iosz will be not zero and STATE_RESPONSE_DATA should
be used to fetch another buffer full of data.
OK beck@

3 years agoSome cleanup in X509_REQ_get_extensions(3), no functional change.
schwarze [Wed, 3 Nov 2021 13:27:28 +0000 (13:27 +0000)]
Some cleanup in X509_REQ_get_extensions(3), no functional change.

In this function, merge everything that is worth merging
from the OpenSSL 1.1.1 branch, which is still under a free license,
mostly the relevant part of commit 9b0a4531 Mar 14 23:48:47 2015 +0000
to use X509_ATTRIBUTE_get0_type(3) rather than re-implementing it.

While here,
* use d2i_X509_EXTENSIONS(3) rather than ASN1_item_d2i(3);
* test pointers explicitly against NULL, not with '!', as suggested by tb@;
* drop some useless parentheses as suggested by tb@.

OK tb@

3 years agoTest adding extensions to certification requests.
schwarze [Wed, 3 Nov 2021 13:08:57 +0000 (13:08 +0000)]
Test adding extensions to certification requests.
Related to the bugfixes in x509_req.c rev. 1.25.
OK tb@.

3 years agoFix two bugs in X509_REQ_add_extensions_nid(3)
schwarze [Wed, 3 Nov 2021 12:53:25 +0000 (12:53 +0000)]
Fix two bugs in X509_REQ_add_extensions_nid(3)
that i noticed while documneting the function:
* missing return value check for ASN1_item_i2d(3) and
* missing return value check for OBJ_nid2obj(3).

In the function X509_REQ_add_extensions_nid(3), merge everything
that is worth merging from the OpenSSL 1.1.1 branch, which is still
under a free license; that's mostly parts of the commit 9b0a4531
Mar 14 23:48:47 2015 +0000 (containing the bugfix, even though the
OpenSSL commit message did not mention the bugs) and some minor
stylistic changes from 0f113f3e and 26a7d938.

While here, use i2d_X509_EXTENSIONS(3) instead of the layer-violating
call to ASN1_item_i2d(3), and include a few stylistic tweaks from tb@.

OK tb@, and jsing@ agreed on the general direction.

3 years agoIn addition to the WEP key(s) being set at device initialization with
krw [Wed, 3 Nov 2021 11:52:59 +0000 (11:52 +0000)]
In addition to the WEP key(s) being set at device initialization with
'nwid'/'nwkey', the keys will be set at random times when 'join'/'nwkey' is
used. So also stop trying to set IEEE80211_CIPHER_NONE keys on that path.

James Hastings confirms this fixes his '(null node)' panics on run(4). Thanks!

ok stsp@

3 years agoMove the MAX_CERT_DEPTH to extern.h and adjust the comments of all limits
claudio [Wed, 3 Nov 2021 10:50:18 +0000 (10:50 +0000)]
Move the MAX_CERT_DEPTH to extern.h and adjust the comments of all limits
a bit.

3 years agoIn proc_parser_roa() adjust the expiry calculation to walk all of
claudio [Wed, 3 Nov 2021 10:19:22 +0000 (10:19 +0000)]
In proc_parser_roa() adjust the expiry calculation to walk all of
the auth tree (including the TA) and be more careful to not dereference
NULL pointers. Both valid_ski_aki() and get_crl() can return NULL
pointers. In these situations X509_verify_cert() should fail and
the affected code should be not reachable but better be prepared.
With and OK tb@

3 years agoAdd missing copyright statement. Reminded by deraadt@
claudio [Wed, 3 Nov 2021 08:30:14 +0000 (08:30 +0000)]
Add missing copyright statement. Reminded by deraadt@

3 years agoClarify that ANY can be used for several parameters of IPsec transform.
yasuoka [Wed, 3 Nov 2021 05:59:25 +0000 (05:59 +0000)]
Clarify that ANY can be used for several parameters of IPsec transform.

ok jmc sthen

3 years agodrm/amdgpu: fix out of bounds write
jsg [Wed, 3 Nov 2021 02:37:48 +0000 (02:37 +0000)]
drm/amdgpu: fix out of bounds write

From Thelford Williams
eb3b6805e3e9d98b2507201fd061a231988ce623 in linux 5.10.y/5.10.77
5afa7898ab7a0ec9c28556a91df714bf3c2f725e in mainline linux

3 years agodrm/ttm: fix memleak in ttm_transfered_destroy
jsg [Wed, 3 Nov 2021 02:33:46 +0000 (02:33 +0000)]
drm/ttm: fix memleak in ttm_transfered_destroy

From Christian Koenig
c21b4002214c1c7e7b627b9b53375612f7aab6db in linux 5.10.y/5.10.77
0db55f9a1bafbe3dac750ea669de9134922389b5 in mainline linux

3 years agoZap swapips remnants
kn [Wed, 3 Nov 2021 02:02:36 +0000 (02:02 +0000)]
Zap swapips remnants

There since 1998, probably dead long before.

"I am sure swabips died before you were born." deraadt

3 years agomention hw.power
jsg [Wed, 3 Nov 2021 00:48:08 +0000 (00:48 +0000)]
mention hw.power
ok deraadt@

3 years agofix previous
kn [Tue, 2 Nov 2021 23:39:27 +0000 (23:39 +0000)]
fix previous

3 years agoReturn non-zero on failed "nwkey" command
kn [Tue, 2 Nov 2021 23:36:43 +0000 (23:36 +0000)]
Return non-zero on failed "nwkey" command

Fail early and exit non-zero immediately instead of indicating success and
possibly carrying the next ifconfig command.

Found at install when wifi interfaces are reset with "-nwid -nwkey -wpa":

Which network interface do you wish to configure? (or 'done') [bse0] bwfm0
ifconfig: SIOCS80211NWKEY: Operation not supported by device
Access point? (ESSID, 'any', list# or '?') [any] 2
Security protocol? (O)pen, (W)EP, WPA-(P)SK [O]

bwfm(4) currently does not support WEP.

OK stsp

3 years agoRemove trailing whitespace
mlarkin [Tue, 2 Nov 2021 23:30:15 +0000 (23:30 +0000)]
Remove trailing whitespace

3 years agocrank SSH_SK_VERSION_MAJOR to match recent change in usr/bin/ssh
djm [Tue, 2 Nov 2021 22:57:27 +0000 (22:57 +0000)]
crank SSH_SK_VERSION_MAJOR to match recent change in usr/bin/ssh