diff --git a/lib/libcrypto/evp/m_md5_sha1.c b/lib/libcrypto/evp/m_md5_sha1.c index f4a6600ec..7dd1ae127 100644 --- a/lib/libcrypto/evp/m_md5_sha1.c +++ b/lib/libcrypto/evp/m_md5_sha1.c @@ -1,4 +1,4 @@ -/* $OpenBSD: m_md5_sha1.c,v 1.7 2023/07/07 19:37:53 beck Exp $ */ +/* $OpenBSD: m_md5_sha1.c,v 1.8 2023/09/02 04:55:18 tb Exp $ */ /* * Copyright (c) 2017 Joel Sing * @@ -44,7 +44,7 @@ md5_sha1_init(EVP_MD_CTX *ctx) return 1; } -static int +static int md5_sha1_update(EVP_MD_CTX *ctx, const void *data, size_t count) { struct md5_sha1_ctx *mdctx = ctx->md_data; diff --git a/lib/libcrypto/evp/p_lib.c b/lib/libcrypto/evp/p_lib.c index e8f031714..c53f38f92 100644 --- a/lib/libcrypto/evp/p_lib.c +++ b/lib/libcrypto/evp/p_lib.c @@ -1,4 +1,4 @@ -/* $OpenBSD: p_lib.c,v 1.35 2023/09/01 17:12:19 tb Exp $ */ +/* $OpenBSD: p_lib.c,v 1.36 2023/09/02 04:15:39 tb Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -449,12 +449,13 @@ EVP_PKEY_get0_RSA(EVP_PKEY *pkey) RSA * EVP_PKEY_get1_RSA(EVP_PKEY *pkey) { - if (pkey->type != EVP_PKEY_RSA) { - EVPerror(EVP_R_EXPECTING_AN_RSA_KEY); - return NULL; + if (pkey->type == EVP_PKEY_RSA || pkey->type == EVP_PKEY_RSA_PSS) { + RSA_up_ref(pkey->pkey.rsa); + return pkey->pkey.rsa; } - RSA_up_ref(pkey->pkey.rsa); - return pkey->pkey.rsa; + + EVPerror(EVP_R_EXPECTING_AN_RSA_KEY); + return NULL; } int diff --git a/regress/usr.sbin/btrace/Makefile b/regress/usr.sbin/btrace/Makefile index e1d399910..a5b37cbab 100644 --- a/regress/usr.sbin/btrace/Makefile +++ b/regress/usr.sbin/btrace/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.28 2023/08/28 21:23:46 dv Exp $ +# $OpenBSD: Makefile,v 1.29 2023/09/02 19:28:46 dv Exp $ BTRACE?= /usr/sbin/btrace ALLOWDT!= sysctl -n kern.allowdt 2>/dev/null @@ -14,7 +14,7 @@ BT_LANG_SCRIPTS= arithm beginend beginend-argn boolean comments delete \ BT_ARG_LANG_SCRIPTS= staticv str # scripts that use kernel probes -BT_KERN_SCRIPTS= filters mapoverwrite multiprobe +BT_KERN_SCRIPTS= empty-stmts filters mapoverwrite multiprobe REGRESS_EXPECTED_FAILURES= run-maxoperand diff --git a/regress/usr.sbin/btrace/beginend.bt b/regress/usr.sbin/btrace/beginend.bt index a24699669..fb603b155 100644 --- a/regress/usr.sbin/btrace/beginend.bt +++ b/regress/usr.sbin/btrace/beginend.bt @@ -3,11 +3,11 @@ BEGIN { - printf("Hello from BEGIN\n"); + printf("Hello from %s\n", probe); } END { // Comment inside of a block - printf("Bye from END\n"); + printf("Bye from %s\n", probe); } diff --git a/regress/usr.sbin/btrace/empty-stmts.bt b/regress/usr.sbin/btrace/empty-stmts.bt new file mode 100644 index 000000000..87cd947d5 --- /dev/null +++ b/regress/usr.sbin/btrace/empty-stmts.bt @@ -0,0 +1,18 @@ +// Test support for empty statement lists. +BEGIN +{ + exit(); +} + +syscall:open:return +{ +} + +syscall:close:return +/comm != "ksh"/ +{ +} + +END +{ +} \ No newline at end of file diff --git a/regress/usr.sbin/btrace/empty-stmts.ok b/regress/usr.sbin/btrace/empty-stmts.ok new file mode 100644 index 000000000..e69de29bb diff --git a/sbin/bioctl/bioctl.8 b/sbin/bioctl/bioctl.8 index 3323de05e..a187daf36 100644 --- a/sbin/bioctl/bioctl.8 +++ b/sbin/bioctl/bioctl.8 @@ -1,4 +1,4 @@ -.\" $OpenBSD: bioctl.8,v 1.113 2023/08/21 08:33:11 kn Exp $ +.\" $OpenBSD: bioctl.8,v 1.114 2023/09/02 09:14:47 kn Exp $ .\" .\" Copyright (c) 2004, 2005 Marco Peereboom .\" @@ -23,7 +23,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd $Mdocdate: August 21 2023 $ +.Dd $Mdocdate: September 2 2023 $ .Dt BIOCTL 8 .Os .Sh NAME @@ -282,11 +282,12 @@ passphrase into a key, in order to create a new encrypted volume or change the passphrase of an existing encrypted volume. A larger number of iterations takes more time, but offers increased resistance against passphrase guessing attacks. -If +By default, or if .Ar rounds -is specified as "auto", the number of rounds will be automatically determined -based on system performance. -Otherwise the minimum is 4 rounds and the default is 16. +is specified as +.Cm auto , +the number of rounds will automatically be based on system performance. +The minimum is 16 rounds. .It Fl s Read passphrases from .Pa /dev/stdin diff --git a/sbin/bioctl/bioctl.c b/sbin/bioctl/bioctl.c index 542801f2d..20e10743a 100644 --- a/sbin/bioctl/bioctl.c +++ b/sbin/bioctl/bioctl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bioctl.c,v 1.154 2023/08/21 08:33:11 kn Exp $ */ +/* $OpenBSD: bioctl.c,v 1.155 2023/09/02 09:14:47 kn Exp $ */ /* * Copyright (c) 2004, 2005 Marco Peereboom @@ -89,7 +89,7 @@ int devh = -1; int human; int verbose; u_int32_t cflags = 0; -int rflag = 0; +int rflag = -1; /* auto */ char *password; void *bio_cookie; @@ -182,7 +182,7 @@ main(int argc, char *argv[]) rflag = -1; break; } - rflag = strtonum(optarg, 4, 1<<30, &errstr); + rflag = strtonum(optarg, 16, 1<<30, &errstr); if (errstr != NULL) errx(1, "number of KDF rounds is %s: %s", errstr, optarg); @@ -979,7 +979,7 @@ bio_kdf_generate(struct sr_crypto_kdfinfo *kdfinfo) kdfinfo->pbkdf.generic.len = sizeof(kdfinfo->pbkdf); kdfinfo->pbkdf.generic.type = SR_CRYPTOKDFT_BCRYPT_PBKDF; - kdfinfo->pbkdf.rounds = rflag ? rflag : 16; + kdfinfo->pbkdf.rounds = rflag; kdfinfo->flags = SR_CRYPTOKDF_KEY | SR_CRYPTOKDF_HINT; kdfinfo->len = sizeof(*kdfinfo); @@ -1119,12 +1119,14 @@ bio_changepass(char *dev) /* Current passphrase. */ bio_kdf_derive(&kdfinfo1, &kdfhint, "Old passphrase: ", 0); - /* - * Unless otherwise specified, keep the previous number of rounds as - * long as we're using the same KDF. - */ - if (kdfhint.generic.type == SR_CRYPTOKDFT_BCRYPT_PBKDF && !rflag) - rflag = kdfhint.rounds; + if (rflag == -1) { + rflag = bcrypt_pbkdf_autorounds(); + + /* Use previous number of rounds for the same KDF if higher. */ + if (kdfhint.generic.type == SR_CRYPTOKDFT_BCRYPT_PBKDF && + rflag < kdfhint.rounds) + rflag = kdfhint.rounds; + } /* New passphrase. */ bio_kdf_generate(&kdfinfo2); @@ -1328,7 +1330,7 @@ derive_key(u_int32_t type, int rounds, u_int8_t *key, size_t keysz, type != SR_CRYPTOKDFT_BCRYPT_PBKDF) errx(1, "unknown KDF type %d", type); - if (rounds < (type == SR_CRYPTOKDFT_PKCS5_PBKDF2 ? 1000 : 4)) + if (rounds < (type == SR_CRYPTOKDFT_PKCS5_PBKDF2 ? 1000 : 16)) errx(1, "number of KDF rounds is too small: %d", rounds); /* get passphrase */ diff --git a/sbin/iked/ca.c b/sbin/iked/ca.c index ee8dbacc6..424bd997c 100644 --- a/sbin/iked/ca.c +++ b/sbin/iked/ca.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ca.c,v 1.96 2023/08/04 19:06:25 claudio Exp $ */ +/* $OpenBSD: ca.c,v 1.97 2023/09/02 18:16:02 tobhe Exp $ */ /* * Copyright (c) 2010-2013 Reyk Floeter @@ -210,8 +210,7 @@ ca_certbundle_add(struct ibuf *buf, struct iked_id *id) size_t len = ibuf_size(id->id_buf); void *val = ibuf_data(id->id_buf); - if (id == NULL || - buf == NULL || + if (buf == NULL || ibuf_add(buf, &type, sizeof(type)) != 0 || ibuf_add(buf, &len, sizeof(len)) != 0 || ibuf_add(buf, val, len) != 0) diff --git a/sbin/iked/ikev2_pld.c b/sbin/iked/ikev2_pld.c index eb5400a9c..f207fbfc3 100644 --- a/sbin/iked/ikev2_pld.c +++ b/sbin/iked/ikev2_pld.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ikev2_pld.c,v 1.132 2023/08/04 19:06:25 claudio Exp $ */ +/* $OpenBSD: ikev2_pld.c,v 1.133 2023/09/02 18:36:30 tobhe Exp $ */ /* * Copyright (c) 2019 Tobias Heider @@ -796,6 +796,10 @@ ikev2_validate_cert(struct iked_message *msg, size_t offset, size_t left, return (-1); } memcpy(cert, msgbuf + offset, sizeof(*cert)); + if (cert->cert_type == IKEV2_CERT_NONE) { + log_debug("%s: malformed payload: invalid cert type", __func__); + return (-1); + } return (0); } diff --git a/share/man/man5/bsd.port.mk.5 b/share/man/man5/bsd.port.mk.5 index 77ba5ec17..ded61b04f 100644 --- a/share/man/man5/bsd.port.mk.5 +++ b/share/man/man5/bsd.port.mk.5 @@ -1,4 +1,4 @@ -.\" $OpenBSD: bsd.port.mk.5,v 1.582 2023/08/22 03:51:45 jsg Exp $ +.\" $OpenBSD: bsd.port.mk.5,v 1.583 2023/09/02 17:19:57 espie Exp $ .\" .\" Copyright (c) 2000-2008 Marc Espie .\" @@ -24,7 +24,7 @@ .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" -.Dd $Mdocdate: August 22 2023 $ +.Dd $Mdocdate: September 2 2023 $ .Dt BSD.PORT.MK 5 .Os .Sh NAME @@ -918,11 +918,25 @@ Invoked as make show=name, show the contents of ${name}. Invoked as make show="name1 name2 ...", show the contents of ${name1} ${name2} ..., one variable value per line. +.It Ev ALL_DISTFILES +List of all actual files coming from every +.Ev DISTFILES* +setting, after applying the +.Sq Ar filename Ns { Ns Ar url Ns } Ns Ar sufx +conversion, occasionally useful for setting +.Ev EXTRACT_ONLY +manually. .It Ev ALL_FAKE_FLAGS Flags passed to ${MAKE} invocations during the fake process. Equals .Li ${MAKE_FLAGS} ${DESTDIRNAME}=${WRKINST} ${FAKE_FLAGS} . Read-only. +.It Ev ALL_PATCHFILES +List of all actual files coming from every +.Ev PATCHFILES* +setting, after applying the +.Sq Ar filename Ns { Ns Ar url Ns } Ns Ar sufx +conversion. .It Ev ALL_TEST_ENV Environment passed to test. Equals diff --git a/sys/dev/pci/if_iwm.c b/sys/dev/pci/if_iwm.c index 5f8042dee..fc4bc1adc 100644 --- a/sys/dev/pci/if_iwm.c +++ b/sys/dev/pci/if_iwm.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_iwm.c,v 1.408 2023/07/05 15:07:28 stsp Exp $ */ +/* $OpenBSD: if_iwm.c,v 1.410 2023/09/02 09:02:18 stsp Exp $ */ /* * Copyright (c) 2014, 2016 genua gmbh @@ -6746,7 +6746,12 @@ iwm_tx(struct iwm_softc *sc, struct mbuf *m, struct ieee80211_node *ni, int ac) * client mode; the firmware's station table contains only one entry * which represents our access point. */ - if (isset(sc->sc_enabled_capa, IWM_UCODE_TLV_CAPA_DQA_SUPPORT)) + if (ic->ic_opmode == IEEE80211_M_MONITOR) { + if (isset(sc->sc_enabled_capa, IWM_UCODE_TLV_CAPA_DQA_SUPPORT)) + qid = IWM_DQA_INJECT_MONITOR_QUEUE; + else + qid = IWM_AUX_QUEUE; + } else if (isset(sc->sc_enabled_capa, IWM_UCODE_TLV_CAPA_DQA_SUPPORT)) qid = IWM_DQA_MIN_MGMT_QUEUE + ac; else qid = ac; @@ -6818,7 +6823,8 @@ iwm_tx(struct iwm_softc *sc, struct mbuf *m, struct ieee80211_node *ni, int ac) #endif totlen = m->m_pkthdr.len; - if (wh->i_fc[1] & IEEE80211_FC1_PROTECTED) { + if (ic->ic_opmode != IEEE80211_M_MONITOR && + (wh->i_fc[1] & IEEE80211_FC1_PROTECTED)) { k = ieee80211_get_txkey(ic, wh, ni); if ((k->k_flags & IEEE80211_KEY_GROUP) || (k->k_cipher != IEEE80211_CIPHER_CCMP)) { @@ -6845,7 +6851,10 @@ iwm_tx(struct iwm_softc *sc, struct mbuf *m, struct ieee80211_node *ni, int ac) (ic->ic_flags & IEEE80211_F_USEPROT))) flags |= IWM_TX_CMD_FLG_PROT_REQUIRE; - tx->sta_id = IWM_STATION_ID; + if (ic->ic_opmode == IEEE80211_M_MONITOR) + tx->sta_id = IWM_MONITOR_STA_ID; + else + tx->sta_id = IWM_STATION_ID; if (type == IEEE80211_FC0_TYPE_MGT) { if (subtype == IEEE80211_FC0_SUBTYPE_ASSOC_REQ || @@ -9197,6 +9206,9 @@ iwm_delete_key(struct ieee80211com *ic, struct ieee80211_node *ni, return; } + if ((sc->sc_flags & IWM_FLAG_STA_ACTIVE) == 0) + return; + if (!isset(sc->sc_ucode_api, IWM_UCODE_TLV_API_TKIP_MIC_KEYS)) return iwm_delete_key_v1(ic, ni, k); diff --git a/sys/uvm/uvm_anon.c b/sys/uvm/uvm_anon.c index 13d36f278..abb3e8de3 100644 --- a/sys/uvm/uvm_anon.c +++ b/sys/uvm/uvm_anon.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uvm_anon.c,v 1.55 2023/04/11 00:45:09 jsg Exp $ */ +/* $OpenBSD: uvm_anon.c,v 1.56 2023/09/02 08:24:40 mpi Exp $ */ /* $NetBSD: uvm_anon.c,v 1.10 2000/11/25 06:27:59 chs Exp $ */ /* @@ -255,6 +255,7 @@ uvm_anon_release(struct vm_anon *anon) KASSERT(anon->an_ref == 0); uvm_lock_pageq(); + pmap_page_protect(pg, PROT_NONE); uvm_pagefree(pg); uvm_unlock_pageq(); KASSERT(anon->an_page == NULL); diff --git a/sys/uvm/uvm_fault.c b/sys/uvm/uvm_fault.c index 454841044..28fa1da14 100644 --- a/sys/uvm/uvm_fault.c +++ b/sys/uvm/uvm_fault.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uvm_fault.c,v 1.133 2022/11/04 09:36:44 mpi Exp $ */ +/* $OpenBSD: uvm_fault.c,v 1.134 2023/09/02 08:24:40 mpi Exp $ */ /* $NetBSD: uvm_fault.c,v 1.51 2000/08/06 00:22:53 thorpej Exp $ */ /* @@ -396,7 +396,6 @@ uvmfault_anonget(struct uvm_faultinfo *ufi, struct vm_amap *amap, * anon and try again. */ if (pg->pg_flags & PG_RELEASED) { - pmap_page_protect(pg, PROT_NONE); KASSERT(anon->an_ref == 0); /* * Released while we had unlocked amap. diff --git a/usr.bin/tmux/server-client.c b/usr.bin/tmux/server-client.c index c57e57ecf..fb9f27ad3 100644 --- a/usr.bin/tmux/server-client.c +++ b/usr.bin/tmux/server-client.c @@ -1,4 +1,4 @@ -/* $OpenBSD: server-client.c,v 1.401 2023/08/17 14:10:28 nicm Exp $ */ +/* $OpenBSD: server-client.c,v 1.402 2023/09/02 20:03:10 nicm Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott @@ -2770,6 +2770,7 @@ server_client_dispatch(struct imsg *imsg, void *arg) break; server_client_update_latest(c); tty_resize(&c->tty); + tty_repeat_requests(&c->tty); recalculate_sizes(); if (c->overlay_resize == NULL) server_client_clear_overlay(c); diff --git a/usr.bin/tmux/session.c b/usr.bin/tmux/session.c index 688493986..548d11c83 100644 --- a/usr.bin/tmux/session.c +++ b/usr.bin/tmux/session.c @@ -1,4 +1,4 @@ -/* $OpenBSD: session.c,v 1.95 2023/09/01 13:48:54 nicm Exp $ */ +/* $OpenBSD: session.c,v 1.96 2023/09/02 08:38:37 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -687,8 +687,10 @@ session_group_synchronize1(struct session *target, struct session *s) TAILQ_INIT(&s->lastw); TAILQ_FOREACH(wl, &old_lastw, sentry) { wl2 = winlink_find_by_index(&s->windows, wl->idx); - if (wl2 != NULL) + if (wl2 != NULL) { TAILQ_INSERT_TAIL(&s->lastw, wl2, sentry); + wl2->flags |= WINLINK_VISITED; + } } /* Then free the old winlinks list. */ diff --git a/usr.bin/tmux/tmux.1 b/usr.bin/tmux/tmux.1 index 1072bf734..4a33de855 100644 --- a/usr.bin/tmux/tmux.1 +++ b/usr.bin/tmux/tmux.1 @@ -1,4 +1,4 @@ -.\" $OpenBSD: tmux.1,v 1.930 2023/09/01 13:48:54 nicm Exp $ +.\" $OpenBSD: tmux.1,v 1.931 2023/09/02 09:17:23 nicm Exp $ .\" .\" Copyright (c) 2007 Nicholas Marriott .\" @@ -14,7 +14,7 @@ .\" IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING .\" OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" -.Dd $Mdocdate: September 1 2023 $ +.Dd $Mdocdate: September 2 2023 $ .Dt TMUX 1 .Os .Sh NAME @@ -6802,9 +6802,15 @@ Set a styled underscore. The single parameter is one of: 0 for no underscore, 1 for normal underscore, 2 for double underscore, 3 for curly underscore, 4 for dotted underscore and 5 for dashed underscore. -.It Em \&Setulc , \&ol +.It Em \&Setulc , \&Setulc1, \&ol Set the underscore colour or reset to the default. -The argument is (red * 65536) + (green * 256) + blue where each is between 0 +.Em Setulc +is for RGB colours and +.Em Setulc1 +for ANSI or 256 colours. +The +.Em Setulc +argument is (red * 65536) + (green * 256) + blue where each is between 0 and 255. .It Em \&Ss , Se Set or reset the cursor style. diff --git a/usr.bin/tmux/tmux.h b/usr.bin/tmux/tmux.h index d3268a190..74a86482a 100644 --- a/usr.bin/tmux/tmux.h +++ b/usr.bin/tmux/tmux.h @@ -1,4 +1,4 @@ -/* $OpenBSD: tmux.h,v 1.1207 2023/09/01 14:29:11 nicm Exp $ */ +/* $OpenBSD: tmux.h,v 1.1209 2023/09/02 20:03:10 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -536,6 +536,7 @@ enum tty_code_code { TTYC_SETRGBB, TTYC_SETRGBF, TTYC_SETULC, + TTYC_SETULC1, TTYC_SGR0, TTYC_SITM, TTYC_SMACS, @@ -1385,6 +1386,7 @@ struct tty { struct client *client; struct event start_timer; struct event clipboard_timer; + time_t last_requests; u_int sx; u_int sy; @@ -1436,10 +1438,8 @@ struct tty { #define TTY_HAVEXDA 0x200 #define TTY_SYNCING 0x400 #define TTY_HAVEDA2 0x800 /* Secondary DA. */ -#define TTY_HAVEFG 0x1000 -#define TTY_HAVEBG 0x2000 #define TTY_ALL_REQUEST_FLAGS \ - (TTY_HAVEDA|TTY_HAVEDA2|TTY_HAVEXDA|TTY_HAVEFG|TTY_HAVEBG) + (TTY_HAVEDA|TTY_HAVEDA2|TTY_HAVEXDA) int flags; struct tty_term *term; @@ -2332,6 +2332,7 @@ void tty_resize(struct tty *); void tty_set_size(struct tty *, u_int, u_int, u_int, u_int); void tty_start_tty(struct tty *); void tty_send_requests(struct tty *); +void tty_repeat_requests(struct tty *); void tty_stop_tty(struct tty *); void tty_set_title(struct tty *, const char *); void tty_set_path(struct tty *, const char *); diff --git a/usr.bin/tmux/tty-features.c b/usr.bin/tmux/tty-features.c index deb43f247..de6652c6b 100644 --- a/usr.bin/tmux/tty-features.c +++ b/usr.bin/tmux/tty-features.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tty-features.c,v 1.28 2022/11/11 08:44:11 nicm Exp $ */ +/* $OpenBSD: tty-features.c,v 1.29 2023/09/02 09:17:23 nicm Exp $ */ /* * Copyright (c) 2020 Nicholas Marriott @@ -145,6 +145,7 @@ static const struct tty_feature tty_feature_overline = { static const char *const tty_feature_usstyle_capabilities[] = { "Smulx=\\E[4::%p1%dm", "Setulc=\\E[58::2::%p1%{65536}%/%d::%p1%{256}%/%{255}%&%d::%p1%{255}%&%d%;m", + "Setulc1=\\E[58::5::%p1%dm", "ol=\\E[59m", NULL }; diff --git a/usr.bin/tmux/tty-keys.c b/usr.bin/tmux/tty-keys.c index f72c6b36f..38b4fe435 100644 --- a/usr.bin/tmux/tty-keys.c +++ b/usr.bin/tmux/tty-keys.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tty-keys.c,v 1.167 2023/06/30 13:19:32 nicm Exp $ */ +/* $OpenBSD: tty-keys.c,v 1.168 2023/09/02 20:03:10 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -1492,8 +1492,6 @@ tty_keys_colours(struct tty *tty, const char *buf, size_t len, size_t *size) int n; *size = 0; - if ((tty->flags & TTY_HAVEFG) && (tty->flags & TTY_HAVEBG)) - return (-1); /* First four bytes are always \033]1 and 0 or 1 and ;. */ if (buf[0] != '\033') @@ -1539,11 +1537,9 @@ tty_keys_colours(struct tty *tty, const char *buf, size_t len, size_t *size) if (n != -1 && buf[3] == '0') { log_debug("%s: foreground is %s", c->name, colour_tostring(n)); tty->fg = n; - tty->flags |= TTY_HAVEFG; } else if (n != -1) { log_debug("%s: background is %s", c->name, colour_tostring(n)); tty->bg = n; - tty->flags |= TTY_HAVEBG; } return (0); diff --git a/usr.bin/tmux/tty-term.c b/usr.bin/tmux/tty-term.c index 6ca24f4a2..8e6d76a95 100644 --- a/usr.bin/tmux/tty-term.c +++ b/usr.bin/tmux/tty-term.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tty-term.c,v 1.99 2023/06/30 13:19:32 nicm Exp $ */ +/* $OpenBSD: tty-term.c,v 1.100 2023/09/02 09:17:23 nicm Exp $ */ /* * Copyright (c) 2008 Nicholas Marriott @@ -264,6 +264,7 @@ static const struct tty_term_code_entry tty_term_codes[] = { [TTYC_SETRGBB] = { TTYCODE_STRING, "setrgbb" }, [TTYC_SETRGBF] = { TTYCODE_STRING, "setrgbf" }, [TTYC_SETULC] = { TTYCODE_STRING, "Setulc" }, + [TTYC_SETULC1] = { TTYCODE_STRING, "Setulc1" }, [TTYC_SE] = { TTYCODE_STRING, "Se" }, [TTYC_SXL] = { TTYCODE_FLAG, "Sxl" }, [TTYC_SGR0] = { TTYCODE_STRING, "sgr0" }, diff --git a/usr.bin/tmux/tty.c b/usr.bin/tmux/tty.c index 94b33ce68..efbc4a3cc 100644 --- a/usr.bin/tmux/tty.c +++ b/usr.bin/tmux/tty.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tty.c,v 1.432 2023/07/13 06:03:48 nicm Exp $ */ +/* $OpenBSD: tty.c,v 1.434 2023/09/02 20:03:10 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -82,6 +82,7 @@ static void tty_check_overlay_range(struct tty *, u_int, u_int, u_int, #define TTY_BLOCK_STOP(tty) (1 + ((tty)->sx * (tty)->sy) / 8) #define TTY_QUERY_TIMEOUT 5 +#define TTY_REQUEST_LIMIT 30 void tty_create_log(void) @@ -369,12 +370,29 @@ tty_send_requests(struct tty *tty) tty_puts(tty, "\033[>c"); if (~tty->flags & TTY_HAVEXDA) tty_puts(tty, "\033[>q"); - if (~tty->flags & TTY_HAVEFG) - tty_puts(tty, "\033]10;?\033\\"); - if (~tty->flags & TTY_HAVEBG) - tty_puts(tty, "\033]11;?\033\\"); + tty_puts(tty, "\033]10;?\033\\"); + tty_puts(tty, "\033]11;?\033\\"); } else tty->flags |= TTY_ALL_REQUEST_FLAGS; + tty->last_requests = time (NULL); +} + +void +tty_repeat_requests(struct tty *tty) +{ + time_t t = time (NULL); + + if (~tty->flags & TTY_STARTED) + return; + + if (t - tty->last_requests <= TTY_REQUEST_LIMIT) + return; + tty->last_requests = t; + + if (tty->term->flags & TERM_VT100LIKE) { + tty_puts(tty, "\033]10;?\033\\"); + tty_puts(tty, "\033]11;?\033\\"); + } } void @@ -2814,11 +2832,13 @@ tty_check_us(__unused struct tty *tty, struct colour_palette *palette, gc->us = c; } - /* Underscore colour is set as RGB so convert. */ - if ((c = colour_force_rgb (gc->us)) == -1) - gc->us = 8; - else - gc->us = c; + /* Convert underscore colour if only RGB can be supported. */ + if (!tty_term_has(tty->term, TTYC_SETULC1)) { + if ((c = colour_force_rgb (gc->us)) == -1) + gc->us = 8; + else + gc->us = c; + } } static void @@ -2898,9 +2918,17 @@ tty_colours_us(struct tty *tty, const struct grid_cell *gc) goto save; } - /* Must be an RGB colour - this should never happen. */ - if (~gc->us & COLOUR_FLAG_RGB) + /* + * If this is not an RGB colour, use Setulc1 if it exists, otherwise + * convert. + */ + if (~gc->us & COLOUR_FLAG_RGB) { + c = gc->us; + if ((~c & COLOUR_FLAG_256) && (c >= 90 && c <= 97)) + c -= 82; + tty_putcode_i(tty, TTYC_SETULC1, c & ~COLOUR_FLAG_256); return; + } /* * Setulc and setal follows the ncurses(3) one argument "direct colour" diff --git a/usr.sbin/btrace/bt_parse.y b/usr.sbin/btrace/bt_parse.y index b2c3bef3b..b2c3e6585 100644 --- a/usr.sbin/btrace/bt_parse.y +++ b/usr.sbin/btrace/bt_parse.y @@ -1,4 +1,4 @@ -/* $OpenBSD: bt_parse.y,v 1.51 2023/08/28 21:23:46 dv Exp $ */ +/* $OpenBSD: bt_parse.y,v 1.52 2023/09/02 19:28:46 dv Exp $ */ /* * Copyright (c) 2019-2021 Martin Pieuchot @@ -266,6 +266,7 @@ block : action ; action : '{' stmtlist '}' { $$ = $2; } + | '{' '}' { $$ = NULL; } ; %% diff --git a/usr.sbin/btrace/btrace.c b/usr.sbin/btrace/btrace.c index 45e485b6c..f57091107 100644 --- a/usr.sbin/btrace/btrace.c +++ b/usr.sbin/btrace/btrace.c @@ -1,4 +1,4 @@ -/* $OpenBSD: btrace.c,v 1.74 2023/08/16 13:07:11 dv Exp $ */ +/* $OpenBSD: btrace.c,v 1.75 2023/09/02 15:16:12 dv Exp $ */ /* * Copyright (c) 2019 - 2021 Martin Pieuchot @@ -117,6 +117,8 @@ size_t dt_ndtpi; /* # of elements in the array */ struct dtioc_arg_info **dt_args; /* array of probe arguments */ struct dt_evt bt_devt; /* fake event for BEGIN/END */ +#define EVENT_BEGIN 0 +#define EVENT_END (unsigned int)(-1) uint64_t bt_filtered; /* # of events filtered out */ struct syms *kelf, *uelf; @@ -543,7 +545,7 @@ rules_setup(int fd) kelf = kelf_open(_PATH_KSYMS); /* Initialize "fake" event for BEGIN/END */ - bt_devt.dtev_pbn = -1; + bt_devt.dtev_pbn = EVENT_BEGIN; strlcpy(bt_devt.dtev_comm, getprogname(), sizeof(bt_devt.dtev_comm)); bt_devt.dtev_pid = getpid(); bt_devt.dtev_tid = getthrid(); @@ -623,6 +625,7 @@ rules_teardown(int fd) uelf = NULL; /* Update "fake" event for BEGIN/END */ + bt_devt.dtev_pbn = EVENT_END; clock_gettime(CLOCK_REALTIME, &bt_devt.dtev_tsp); if (rend) @@ -1600,6 +1603,13 @@ ba2str(struct bt_arg *ba, struct dt_evt *dtev) str = buf; break; case B_AT_BI_PROBE: + if (dtev->dtev_pbn == EVENT_BEGIN) { + str = "BEGIN"; + break; + } else if (dtev->dtev_pbn == EVENT_END) { + str = "END"; + break; + } dtpi = &dt_dtpis[dtev->dtev_pbn - 1]; if (dtpi != NULL) snprintf(buf, sizeof(buf), "%s:%s:%s", diff --git a/usr.sbin/dhcpd/dispatch.c b/usr.sbin/dhcpd/dispatch.c index 8b8972be9..238d620f1 100644 --- a/usr.sbin/dhcpd/dispatch.c +++ b/usr.sbin/dhcpd/dispatch.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dispatch.c,v 1.44 2021/11/20 11:47:02 kn Exp $ */ +/* $OpenBSD: dispatch.c,v 1.45 2023/09/02 10:18:45 kn Exp $ */ /* * Copyright (c) 1995, 1996, 1997, 1998, 1999 @@ -112,9 +112,7 @@ discover_interfaces(int *rdomain) for (ifa = ifap; ifa != NULL; ifa = ifa->ifa_next) { /* * See if this is the sort of interface we want to - * deal with. Skip loopback and point-to-point - * interfaces, except don't skip down interfaces if we're - * trying to get a list of configurable interfaces. + * deal with. */ if ((ifa->ifa_flags & IFF_LOOPBACK) || (ifa->ifa_flags & IFF_POINTOPOINT) ||