1
0
mirror of https://github.com/openbsd/src.git synced 2025-01-04 15:25:38 -08:00
Commit Graph

29934 Commits

Author SHA1 Message Date
claudio
ba04a0e746 Check in bgpctl show rib commands if the table / rib passed is
Adj-RIB-Out and in that case set F_CTL_ADJ_OUT on the request.
With this 'bgpctl show rib out' and 'bgpctl show rib table Adj-RIB-Out'
return the same results.
OK tb@
2024-12-02 16:31:51 +00:00
claudio
aaaf7e1f15 Remove the ASPA imsg size workaround now that imsg are large enough to
handle MAX_ASPA_SPAS_COUNT (10k) entries.
OK tb@
2024-12-02 15:13:57 +00:00
claudio
5bf6f54305 Bump imsg size like bgpd just did.
OK tb@
2024-12-02 15:03:46 +00:00
claudio
04e124822c Bump imsg size up to MAX_BGPD_IMSGSIZE (128k) to support extended messages
and more.
OK tb@
2024-12-02 15:03:17 +00:00
job
bf5a499ba8 If AS0 TALs are provided, by default omit VRPs derived from such AS0 TALs
AS0 TALs represent unmitigated operational risks: what if the RIR by
accident marks some IP space as 'unassigned'?

APNIC notes in their limitation of liability statement:

    """
    Depending on router configuration, errors in the AS0 ROA could
    cause unintended interruption to routing with other networks.
    For this reason, it is strongly recommended that the AS0 ROA is
    used for advisory and/ or alerting purposes only, and not for
    automatic filtering of BGP routes.
    """
    https://www.apnic.net/community/security/resource-certification/apnic-limitations-of-liability-for-rpki-2/

Guard usage of AS0 TALs behind new '-0' option

OK deraadt@ tb@
2024-12-02 14:55:02 +00:00
claudio
3417aeaedd Remove global queue_buf which is no longer used.
OK compiler
2024-12-02 13:46:11 +00:00
kn
347b73737b -o[arg] must not have spaces between option and argument; OK jmc
getopt(3) says so and, e.g. 'mrouted -d 1' must be 'mrouted -d1' to work.
dhcpd(8) and sed(1) got this right, our multicast programs did not.
2024-12-01 09:58:15 +00:00
yasuoka
266241f92e Fix radiusd_ipcp module to check whether the type of the ipcp_address
is for pool when selecting a random address from the pools, and tweak
the code for easier understanding.  Also,  check whether the left
value of an address range configuration is smaller than the right
value.
2024-11-28 11:51:45 +00:00
yasuoka
1669612dd9 Fix warnings from gcc. found by deraadt 2024-11-28 10:42:16 +00:00
kirill
8fbe85f50d vmd/vioblk: add missed break
There's no value in that log message in that specific condition.

OK dv@ kn@
2024-11-27 22:32:14 +00:00
tb
a0b977827c zap trailing whitespace from previous 2024-11-27 15:19:26 +00:00
claudio
9509a1e638 Adjust the msgbuf parser callbacks in bgpd to the new API.
OK tb@
2024-11-26 13:59:54 +00:00
claudio
929d2bb2d4 Adapt the rpki-client message reader to the new msgbuf_new_reader callback.
This is mostly stolen from the imsg handler and should probably be cleaned up
further.

OK tb@
2024-11-26 13:59:09 +00:00
job
475ff8375c Workaround for compatibility issue with some libcrypto implementations
Historically, CMS_get1_crls() returned NULL if the CMS is an
unsupported content type or contained zero CRLs. Nowadays, if
the CMS contains zero CRLs, some implementations will return a
pointer to a STACK of CRLs with zero objects.

OK tb@
2024-11-26 13:35:48 +00:00
mpi
bb6b0345de Generate a single event when timers advance for more than one tick.
Also report the number of events missed due to recursions or skipped ticks
to btrace(8).

From Christian Ludwig.
2024-11-26 10:28:27 +00:00
afresh1
78b9b1e61a Make fw_update -d behave like the manual says
The manual says without -a or any drivers specified, fw_update -d
will delete all firmware not required by a driver, and now it does.

While here, slightly improve function name.
2024-11-24 21:27:04 +00:00
kn
4e55220c92 simpler ifaliasreq sockaddr filling
Rather than setting the destination struct member's size in an
AF-specific way only to read from and then overwrite it with
memcpy, use the destination size directly.

OK mlarkin
2024-11-24 10:44:59 +00:00
claudio
882428cdbd Handle radiusd and npppd, they are different but nothing stands out.
OK tb@
2024-11-21 13:43:10 +00:00
claudio
545b6e3145 sasyncd is another unexpected imsg user that is in the end not that special
OK tb@
2024-11-21 13:42:49 +00:00
claudio
bf921b2a26 In smtpd enable fdpassing on all imsgbufs apart from the one in mproc.c
that was specially handled before. On the control socket fdpassing needs
to be enabled when a IMSG_CTL_SMTP_SESSION message is received.

OK tb@
2024-11-21 13:42:22 +00:00
claudio
0a9d031fce Convert vmd over to check for imsgbuf_init failure and sprinkle a lot of
imsgbuf_allow_fdpass() since vmd and vmctl pass fds left and right.

OK tb@
2024-11-21 13:39:34 +00:00
claudio
81e9819965 ldapd is also different to other imsg daemons.
OK tb@
2024-11-21 13:39:07 +00:00
claudio
6676295ff1 Convert various reyk proc.c daemons over to new imsgbuf_init and
imsgbuf_allow_fdpass.

OK tb@
2024-11-21 13:38:45 +00:00
claudio
f1b790a573 Convert simple stuff in usr.sbin over to new imsgbuf_init behaviour
OK tb@
2024-11-21 13:38:14 +00:00
claudio
af27b3cce1 At least make this rotting version of lpd compile again.
OK tb@
2024-11-21 13:34:51 +00:00
claudio
6a3db2bab8 Convert session.c to use the new msgbuf reader API.
OK tb@
2024-11-21 13:34:30 +00:00
claudio
eaff30a2cd Teach mrt_dump_bgp_msg() to use ibufs
OK tb@
2024-11-21 13:34:01 +00:00
claudio
c9c4d4e441 Pass the message to bgp_fsm as argument instead of stashing it in rptr.
This fixes many XXX in the parser functions since we now pass ibufs around.

OK tb@
2024-11-21 13:33:41 +00:00
claudio
9e5228dde3 Kill the bgp_msg struct and instead pass the type to session_sendmsg()
OK tb@
2024-11-21 13:33:14 +00:00
claudio
22b46a1fed Convert rtr_proto to use new msgbuf reader API.
OK tb@
2024-11-21 13:32:50 +00:00
claudio
b5fa5d51bd Rewrite the rpki-client io read handling using the new ibuf_read API.
OK tb@
2024-11-21 13:32:27 +00:00
claudio
c7d6dea4c8 Remove the imsgbuf_read_nofd() hack since the imsgbuf API
rquires the caller to enable fdpassing.

OK tb@
2024-11-21 13:32:02 +00:00
claudio
98435822fc Replace imsgbuf_read_nofd() hack with the new imsgbuf API.
OK tb@
2024-11-21 13:31:37 +00:00
claudio
25d36c5c0e Adjust rpki-client to new msgbuf API
OK tb@
2024-11-21 13:30:17 +00:00
claudio
05453d673c Adjust bgpd to the new msgbuf API
The tricky bit here is the fact that the peer wbuf needs to be allocated
and freed in the right places (when a peer is setup and when it is freed).
During lifetime we just flush the msgbuf with msgbuf_clear().
mrt has a similar issue. I think that freeing the msgbuf in mrt_clean is right.

OK tb@
2024-11-21 13:29:52 +00:00
claudio
3bba10cf94 Adjust ldpd to the msgbuf change that turns the struct opaque
OK tb@
2024-11-21 13:29:28 +00:00
claudio
a6a6bc2cfd Adjust rpki-client to the new msgbuf_write api
OK tb@
2024-11-21 13:28:54 +00:00
claudio
bb5614127f Adjust bgpd to the new msgbuf_write / ibuf_write API
OK tb@
2024-11-21 13:28:34 +00:00
claudio
a66ca8dacd Adjust to new msgbuf_write/ibuf_write API and use ibuf_write since
there is no need to support fd passing.

OK tb@
2024-11-21 13:28:03 +00:00
claudio
cfaf74104d Do not abuse struct ibuf_read instead define local struct with the same fields.
All of this will die in the end. This is just a step towards that.
OK tb@
2024-11-21 13:27:40 +00:00
claudio
26889e1dd8 Do not abuse struct ibuf_read for internal bits. Just define an own struct.
OK tb@
2024-11-21 13:27:13 +00:00
claudio
fa353a8f9b s/ibuf_add_buf/ibuf_add_ibuf/
OK tb@
2024-11-21 13:26:49 +00:00
claudio
ef2e27a145 Unify error reporting in various control programs.
Just use "read error" since the code also uses "write error" for the
imsg_flush case.

OK tb@
2024-11-21 13:26:25 +00:00
claudio
4dca706eb9 Only ldapd tried to handle fd exhaustion during imsg fd passing.
Move the getdtablecount check back into ldapd.

OK tb@
2024-11-21 13:25:56 +00:00
claudio
d12ef5f337 Convert vmd over to new imsgbuf_read behaviour and fix some lurking
issues by introducing imsg_read_one().

This code is still a bit strange since it uses imsg_flush() on
non-blocking sockets. A possible fix would be to replace imsg_flush()
with a new imsg_write_one() that uses poll like atomicio.
This is what imsg_read_one() does here.

OK tb@
2024-11-21 13:25:30 +00:00
claudio
f3f62f4d0f Try to handle the dumpster fire called constraint.c a bit better.
The imsg handling in here is not quite right. It works but more by luck.
- use imsgbuf_read_one (similar code as found in a few other places)
  to read the one message we expect.
- do not call imsgbuf_flush() without a child running to read the data.
  With large enough requests imsgbuf_flush() may be locked forever since
  there is no reader on the other side of the pipe.

OK tb@
2024-11-21 13:25:01 +00:00
claudio
f6bd242ebe Simple bits of converting ntpd over to the new imsgbuf_read behaviour.
OK tb@
2024-11-21 13:24:39 +00:00
claudio
4f3fb1ff82 Convert radiusd to new imsgbuf_read behaviour.
OK tb@
2024-11-21 13:23:37 +00:00
claudio
ba4450f46b Convert npppd and npppctl over to new imsgbuf_read behaviour.
OK tb@
2024-11-21 13:23:13 +00:00
claudio
035f931039 No need to handle EAGAIN anymore.
OK tb@
2024-11-21 13:22:48 +00:00
claudio
16b0c81bb5 bgpd and smtpd include their own imsgbuf_read_nofd() implementation.
Adjust that one as well apart from that the conversion to the new
imsgbuf_read read behaviour is trivial.

OK tb@
2024-11-21 13:22:21 +00:00
claudio
668e5ba9d8 Convert the common imsgbuf_read calls to the post EAGAIN world.
OK tb@
2024-11-21 13:21:33 +00:00
claudio
b82d3e10b9 Use msgbuf_queuelen() where approriate
OK tb@
2024-11-21 13:20:00 +00:00
claudio
31be28ca73 Use imsgbuf_queuelen() instead of accessing the w.queue member.
OK tb@
2024-11-21 13:18:37 +00:00
claudio
9cbf9e90b0 Use imsgbuf_clear() where appropriate instead of msgbuf_clear().
OK tb@
2024-11-21 13:17:56 +00:00
claudio
dd7efffe3c Rename imsg_init, imsg_clear, imsg_read, imsg_write and imsg_flush to
imsgbuf_init, imsgbuf_clear, imsgbuf_read, imsgbuf_write and imsgbuf_flush.

This separates the imsgbuf API from the per-imsg API.

OK tb@
2024-11-21 13:17:01 +00:00
claudio
c1aa9554a3 Convert imsg_write() callers to the new simplified return logic.
OK tb@
2024-11-21 13:16:06 +00:00
claudio
4fb4351109 Convert ibuf_write() callers to new simplified return logic.
OK tb@
2024-11-21 13:13:37 +00:00
claudio
9aadc625f5 Convert msgbuf_write() callers to the new return logic.
OK tb@
2024-11-21 13:12:19 +00:00
claudio
baf8650937 Convert msgbuf_write() callers to the new return logic.
OK tb@
2024-11-21 13:12:11 +00:00
claudio
e4dbe30d1e Use ibuf_write() to send BGP messages to peers instead of msgbuf_write().
This code does not need to pass fds so there is no need to call msgbuf_write.

OK tb@
2024-11-21 13:11:33 +00:00
claudio
ce33693d52 Introduce imsg_write() and use it instead of msgbuf_write().
imsg_write() is just a thin wrapper around msgbuf_write(). So this is
mostly search and replace.

OK tb@
2024-11-21 13:10:18 +00:00
claudio
22e9111291 Use imsg_flush() instead of implementing the same by hand.
OK tb@
2024-11-21 13:08:32 +00:00
claudio
f978fa48b9 imsg_flush no longer returns EAGAIN. Simplify proc_flush_imsg() accordingly.
Issue spotted by op@
2024-11-21 13:06:19 +00:00
claudio
674395a05a ibuf_get_string() was added to the ibuf API, remove local version
OK tb@
2024-11-21 13:05:23 +00:00
tb
b4964d69b7 rpki-client: use macros for skipping rather than hardcoded numbers
ok claudio
2024-11-14 10:28:59 +00:00
otto
be5c6adac6 Take into account how long the dns probe takes before decding to
punt. A single res_query() call can return immediately (e.g. success
or the nameservers are unreachable), or take quite some time,
depending on how many nameservers are configured. So measure the
actual time it takes and decide wat to do based on that.
Early version from beck@; ok claudio@ deraadt@
2024-11-13 15:51:50 +00:00
tb
30a085025d Second sweep of foosz -> num_foos and friends
Binary change in main.o and tal.o due to an assertion change and in spl.o
due to line number changes

looks good to claudio, ok clang + sha256
2024-11-13 12:51:03 +00:00
tb
381ee59950 Rename ips/as and ipsz/asz to ips/ases, num_ips/num_ases
Having a single letter to distinguish a length from a pointer is error
prone. This results in binary change only in validate.c and cert.c due
to a line wrap resulting in line number changes and in cert.c there's in
addition two asserts that change.

checked with/ok job
2024-11-12 09:23:07 +00:00
kn
6b1aed72d5 sync curly braces markup, fix indent
Replace literal braces with .Brq, use lists, replace literal 'foo options'
with .Ar option ... and indent options where they belong.

This highlights config parser differences between daemons:
- dhcpleased: requires empty blocks, e.g. 'interface em0 {}' (Brq Op Ar option ...)
- rad:  lets you omit them, e.g.          'interface em0'    (Op Brq Ar option ...)

Feedback OK jmc
2024-11-09 12:40:10 +00:00
afresh1
3df6484578 Remove unnecessary variable
It turns out that DOWNLOAD_ONLY was just used as the inverse of INSTALL,
so use the one variable instead of two.

This also uncovered some small cleanups.
2024-11-09 02:40:57 +00:00
afresh1
14dcac1e21 Add a -l flag to list drivers or files
This provides a more easily machine readable list than the normal output.
2024-11-09 02:19:48 +00:00
kettenis
db15c72a19 Only install a second copy of the bootloader if the EFI System Partition
is at least 1MB.  This should prevent us from filling up the tiny ESPs
that we used to create a few releases ago.

ok deraadt@
2024-11-08 10:43:07 +00:00
yasuoka
3a9fd06ccc The comparator of the RBtree for the IP addresses was broken.
Also, log verbosely when ignoring accounting request.
2024-11-07 16:00:11 +00:00
bluhm
18e6fc661f Move syslogd(8) TLS handshake callback from read to write handler.
syslogd should immediately detect that the incoming TLS handshake
is complete.  The old logic detected it when the first log message
over TLS was arriving.  For now only a debug message is logged, but
the callback will be used to print the common name of the client
certificate in the future.

OK tb@
2024-11-07 10:12:18 +00:00
mpi
53407cb03f Add multi-line strings support to the bt(5) script parser.
From Christian Ludwig
2024-11-07 09:20:09 +00:00
yasuoka
7af3c8953e Log the username when rejecting by ipcp. 2024-11-07 06:37:18 +00:00
bluhm
7f22b52a24 Fix vmd(8) logging to syslog(3) from child process.
Log messages from vmd(8) child processes went to /dev/null.  Re-exec
set the -n option, which in turn sets vmd_noaction and vmd_debug.
Debugging means no more syslog(3), but stderr, which is /dev/null
for a daemon.
Remove -n from child re-exec, it does not have any effect except
looging.  Pass on the -d flag when debugging.  The VMD_VERBOSE
defines are more confusing than useful, just write -v like all the
other options.  Rework creation of execvp arguments.  Do not use
tab in syslog messages, space is sufficient.

OK mlarkin@ hshoexer@ dv@
2024-11-06 23:04:45 +00:00
bluhm
06d0d09838 vmd(8) logs psp(4) firmware version.
On vmd startup, log the AMD SEV PSP API and build number.

from hshoexer@; OK mlarkin@
2024-11-06 22:06:16 +00:00
miod
c18ef1e4e9 Add -g option to get the index of the current virtual terminal.
This can help scripts using wsconsctl display.focus to perform vt switches.

From NetBSD via Sergiy Kopchalyuk.
2024-11-06 17:14:03 +00:00
bluhm
e7a1ead9e6 Fix broken vmd(8) build on arm64 due to missing psp_setup().
The psp.c source is restricted in makefile with .if ${MACHINE} ==
"amd64" so use #ifdef __amd64__ around the call to psp_setup().  On
arm64 set vmd_psp_fd to an invalid value.

OK hshoexer@ mlarkin@
2024-11-06 14:26:20 +00:00
job
64468f86ca Reference SendHoldTimer RFC in bgpd(8)
OK claudio@
2024-11-06 12:01:39 +00:00
bluhm
5db0dbc53e vmd(8) resets psp(4)
Use shutdown and init to reset psp(4) on vmd(8) startup.  This helps
when hacking on vmd(8) and crashing it.  The psp(4) reset cleans
up all remnants of dead VMs from psp(4).  Otherwise one would have
to reboot the machine.

from hshoexer@; OK mlarkin@
2024-11-05 23:16:46 +00:00
jmc
605f2cbb7e mark up fix; from jesper wallin 2024-11-05 19:36:53 +00:00
lucas
496b8bf985 Check for pfxsz, not the pointer
ok tb
2024-11-05 18:58:35 +00:00
tb
f814cda1d9 Avoid zero-sized allocations
ok claudio
2024-11-05 18:09:16 +00:00
claudio
45a3ee5e7e ncomplete is set but never used. Noticed by cc
OK tb@
2024-11-05 09:18:35 +00:00
tb
490bf47853 rpki-client: check validity time in filemode
Currently the validation indicator only takes the certificate's status
into account. In case everything check out, check the product's life
time and the signature path's expiration moment before printing OK.

should fix an issue encountered by job
looks good to claudio
2024-11-05 06:05:35 +00:00
jca
2119819d27 Ignore extra groups that don't fit in the buffer passed to getgrouplist(3)
Our kernel supports 16 groups (NGROUPS_MAX), but nothing prevents
an admin from adding a user to more groups.  With that tweak we'll keep
on ignoring them instead of potentially reading past the buffer passed to
getgrouplist(3).  That behavior is explicitely described in initgroups(3).

ok millert@ gilles@
2024-11-04 21:59:15 +00:00
job
c4e27ad9e4 Update reference 2024-11-04 11:39:12 +00:00
deraadt
6b5bf2e84b Some atoi -> strtonum conversions; ok denis 2024-11-04 11:12:52 +00:00
afresh1
8eda69bd84 Allow downloading firmware without root
If we are downloading as non-root, we can't drop privileges using ftp,
but sometimes that is OK.

While here, improve the DOWNLOAD_ONLY variable name.
2024-11-04 01:24:00 +00:00
afresh1
fcfe10d69c Make fw_update -p consistent
Previously, if using fw_update -Fp ..., the argument to -p was
treated as a destination path, unless it looked like a URL.

This is too complex, if we want to be able to change the download
destination, that wll need to be a new option.
2024-11-04 00:34:47 +00:00
job
318f05722c Improve detection of gaps in Manifestissuance
It is helpful for network operators, publication point operators, and CA
operators to have more insight into whether the RP noticed an issuance
gap between two versions of a given manifest.

* high number of gaps all the time might be an indication the RP is not
  refreshing often enough
* the CA is trying to issue manifests more than once a second
* the RFC 8181 publication server's ingress API endpoint has issues
* the RFC 8181 publication client has trouble reaching the server
* the CA's private keys (RPKI + BPKI) are used on a second (cloned) system
* the CA's issuance database is broken

Correlation opportunity: detection of a gap means some of the CA's
intermediate states were occluded from the RP; the RP operator might
want to correlate this to traffic shifts in BGP or publication point
reachability issues.

Going forward, emit a warning per manifest, adds metrics to the
openmetrics output, and displays a summary at the end of the run about
issuance gaps.

OK tb@
2024-11-02 12:30:28 +00:00
claudio
f4d4619418 Use imsg_get_fd() to extract the fd from an imsg.
OK tb@
2024-10-31 13:37:44 +00:00
kettenis
fbfcabeaad Install a copy of the UEFI bootloader in /efi/openbsd on the EFI system
partition.  This will allow us to create boot options for the firmware
boot manager that other OSes won't interfere with.

ok phessler@, tobhe@, kn@
2024-10-30 16:22:33 +00:00
sthen
d87a8abac1 print pppoe tags as hex dumps rather than strvis-a-like'd text, unless
they're tags where text is likely. strvis on random cookies is hard to read
and compare, and it's easier to convert 0x05dc than \005\334 to 1500 for
PPP-Max-Payload.  ok claudio dlg
2024-10-30 10:36:28 +00:00
jsg
e22ff83ad5 remove unneeded conf.h include 2024-10-30 07:28:17 +00:00
jsg
a74a190b71 directly use dev_t for swdevt[], remove struct swdevt
ok mpi@ miod@
2024-10-30 06:16:27 +00:00
bluhm
4cfb78b57c Add fw_update pattern for AMD SEV firmware used with psp(4).
from hshoexer@; input deraadt@
2024-10-30 00:04:46 +00:00