diff options
-rw-r--r-- | etc/MAKEDEV.common | 4 | ||||
-rw-r--r-- | lib/libcrypto/bn/bn_recp.c | 47 | ||||
-rw-r--r-- | lib/libcrypto/ec/ec_lib.c | 50 | ||||
-rw-r--r-- | lib/libcrypto/ec/ec_local.h | 9 | ||||
-rw-r--r-- | lib/libcrypto/ec/ecp_methods.c | 61 | ||||
-rw-r--r-- | lib/libcrypto/man/X509_NAME_print_ex.3 | 13 | ||||
-rw-r--r-- | lib/libcrypto/ts/ts_lib.c | 33 | ||||
-rw-r--r-- | share/misc/airport | 3 | ||||
-rw-r--r-- | sys/dev/i2c/ihidev.c | 95 | ||||
-rw-r--r-- | sys/dev/i2c/ihidev.h | 5 | ||||
-rw-r--r-- | sys/dev/i2c/ikbd.c | 14 | ||||
-rw-r--r-- | sys/dev/pci/pcidevs | 7 | ||||
-rw-r--r-- | sys/dev/pci/pcidevs.h | 7 | ||||
-rw-r--r-- | sys/dev/pci/pcidevs_data.h | 22 | ||||
-rw-r--r-- | sys/dev/usb/uaudio.c | 4 | ||||
-rw-r--r-- | sys/kern/uipc_socket.c | 35 | ||||
-rw-r--r-- | usr.sbin/bgpd/bgpd.8 | 43 | ||||
-rw-r--r-- | usr.sbin/bgpd/bgpd.conf.5 | 19 | ||||
-rw-r--r-- | usr.sbin/bgpd/bgpd.h | 9 | ||||
-rw-r--r-- | usr.sbin/bgpd/rde.h | 5 | ||||
-rw-r--r-- | usr.sbin/bgpd/rde_peer.c | 6 | ||||
-rw-r--r-- | usr.sbin/bgpd/rde_update.c | 15 | ||||
-rw-r--r-- | usr.sbin/bgpd/util.c | 4 | ||||
-rw-r--r-- | usr.sbin/vmd/virtio.c | 78 | ||||
-rw-r--r-- | usr.sbin/vmd/virtio.h | 10 | ||||
-rw-r--r-- | usr.sbin/vmd/vmd.h | 4 |
26 files changed, 414 insertions, 188 deletions
diff --git a/etc/MAKEDEV.common b/etc/MAKEDEV.common index eaf77bba602..3b90b912758 100644 --- a/etc/MAKEDEV.common +++ b/etc/MAKEDEV.common @@ -1,4 +1,4 @@ -vers(a, {-$OpenBSD: MAKEDEV.common,v 1.121 2024/09/03 09:35:46 bluhm Exp $-})dnl +vers(a, {-$OpenBSD: MAKEDEV.common,v 1.122 2025/01/08 23:09:25 kirill Exp $-})dnl dnl dnl Copyright (c) 2001-2006 Todd T. Fries <todd@OpenBSD.org> dnl @@ -144,7 +144,7 @@ twrget(all, lpt, lpa, 0, 1, 2)dnl target(all, joy, 0, 1)dnl twrget(all, rnd, random)dnl target(all, uk, 0)dnl -twrget(all, vi, video, 0, 1)dnl +twrget(all, vi, video, 0, 1, 2, 3)dnl twrget(all, speak, speaker)dnl target(all, asc, 0)dnl target(all, radio, 0)dnl diff --git a/lib/libcrypto/bn/bn_recp.c b/lib/libcrypto/bn/bn_recp.c index c9a83f8489a..44c5b05e4d8 100644 --- a/lib/libcrypto/bn/bn_recp.c +++ b/lib/libcrypto/bn/bn_recp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bn_recp.c,v 1.21 2025/01/06 13:47:37 tb Exp $ */ +/* $OpenBSD: bn_recp.c,v 1.25 2025/01/08 20:21:28 tb Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -65,8 +65,8 @@ void BN_RECP_CTX_init(BN_RECP_CTX *recp) { - BN_init(&(recp->N)); - BN_init(&(recp->Nr)); + BN_init(&recp->N); + BN_init(&recp->Nr); recp->num_bits = 0; recp->flags = 0; } @@ -77,11 +77,11 @@ BN_RECP_CTX_new(void) BN_RECP_CTX *ret; if ((ret = malloc(sizeof(BN_RECP_CTX))) == NULL) - return (NULL); + return NULL; BN_RECP_CTX_init(ret); ret->flags = BN_FLG_MALLOCED; - return (ret); + return ret; } void @@ -90,8 +90,8 @@ BN_RECP_CTX_free(BN_RECP_CTX *recp) if (recp == NULL) return; - BN_free(&(recp->N)); - BN_free(&(recp->Nr)); + BN_free(&recp->N); + BN_free(&recp->Nr); if (recp->flags & BN_FLG_MALLOCED) free(recp); } @@ -99,12 +99,14 @@ BN_RECP_CTX_free(BN_RECP_CTX *recp) int BN_RECP_CTX_set(BN_RECP_CTX *recp, const BIGNUM *d, BN_CTX *ctx) { - if (!bn_copy(&(recp->N), d)) + if (!bn_copy(&recp->N, d)) return 0; - BN_zero(&(recp->Nr)); - recp->num_bits = BN_num_bits(d); + recp->num_bits = BN_num_bits(&recp->N); + + BN_zero(&recp->Nr); recp->shift = 0; - return (1); + + return 1; } /* len is the expected size of the result @@ -125,14 +127,14 @@ BN_reciprocal(BIGNUM *r, const BIGNUM *m, int len, BN_CTX *ctx) if (!BN_set_bit(t, len)) goto err; - if (!BN_div_ct(r, NULL, t,m, ctx)) + if (!BN_div_ct(r, NULL, t, m, ctx)) goto err; ret = len; err: BN_CTX_end(ctx); - return (ret); + return ret; } int @@ -156,14 +158,14 @@ BN_div_recp(BIGNUM *dv, BIGNUM *rem, const BIGNUM *m, BN_RECP_CTX *recp, if (a == NULL || b == NULL || d == NULL || r == NULL) goto err; - if (BN_ucmp(m, &(recp->N)) < 0) { + if (BN_ucmp(m, &recp->N) < 0) { BN_zero(d); if (!bn_copy(r, m)) { BN_CTX_end(ctx); return 0; } BN_CTX_end(ctx); - return (1); + return 1; } /* We want the remainder @@ -180,7 +182,7 @@ BN_div_recp(BIGNUM *dv, BIGNUM *rem, const BIGNUM *m, BN_RECP_CTX *recp, /* Nr := round(2^i / N) */ if (i != recp->shift) - recp->shift = BN_reciprocal(&(recp->Nr), &(recp->N), i, ctx); + recp->shift = BN_reciprocal(&recp->Nr, &recp->N, i, ctx); /* BN_reciprocal returns i, or -1 for an error */ if (recp->shift == -1) @@ -193,13 +195,13 @@ BN_div_recp(BIGNUM *dv, BIGNUM *rem, const BIGNUM *m, BN_RECP_CTX *recp, */ if (!BN_rshift(a, m, recp->num_bits)) goto err; - if (!BN_mul(b, a,&(recp->Nr), ctx)) + if (!BN_mul(b, a, &recp->Nr, ctx)) goto err; if (!BN_rshift(d, b, i - recp->num_bits)) goto err; d->neg = 0; - if (!BN_mul(b, &(recp->N), d, ctx)) + if (!BN_mul(b, &recp->N, d, ctx)) goto err; if (!BN_usub(r, m, b)) goto err; @@ -207,12 +209,12 @@ BN_div_recp(BIGNUM *dv, BIGNUM *rem, const BIGNUM *m, BN_RECP_CTX *recp, #if 1 j = 0; - while (BN_ucmp(r, &(recp->N)) >= 0) { + while (BN_ucmp(r, &recp->N) >= 0) { if (j++ > 2) { BNerror(BN_R_BAD_RECIPROCAL); goto err; } - if (!BN_usub(r, r, &(recp->N))) + if (!BN_usub(r, r, &recp->N)) goto err; if (!BN_add_word(d, 1)) goto err; @@ -226,10 +228,9 @@ BN_div_recp(BIGNUM *dv, BIGNUM *rem, const BIGNUM *m, BN_RECP_CTX *recp, err: BN_CTX_end(ctx); - return (ret); + return ret; } - int BN_mod_mul_reciprocal(BIGNUM *r, const BIGNUM *x, const BIGNUM *y, BN_RECP_CTX *recp, BN_CTX *ctx) @@ -257,5 +258,5 @@ BN_mod_mul_reciprocal(BIGNUM *r, const BIGNUM *x, const BIGNUM *y, err: BN_CTX_end(ctx); - return (ret); + return ret; } diff --git a/lib/libcrypto/ec/ec_lib.c b/lib/libcrypto/ec/ec_lib.c index 7a82eb23f8f..a50b1e5633b 100644 --- a/lib/libcrypto/ec/ec_lib.c +++ b/lib/libcrypto/ec/ec_lib.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ec_lib.c,v 1.102 2025/01/06 19:23:25 tb Exp $ */ +/* $OpenBSD: ec_lib.c,v 1.103 2025/01/07 08:30:52 tb Exp $ */ /* * Originally written by Bodo Moeller for the OpenSSL project. */ @@ -600,6 +600,7 @@ int EC_GROUP_check_discriminant(const EC_GROUP *group, BN_CTX *ctx_in) { BN_CTX *ctx; + BIGNUM *p, *a, *b, *discriminant; int ret = 0; if ((ctx = ctx_in) == NULL) @@ -607,11 +608,50 @@ EC_GROUP_check_discriminant(const EC_GROUP *group, BN_CTX *ctx_in) if (ctx == NULL) goto err; - if (group->meth->group_check_discriminant == NULL) { - ECerror(ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); + BN_CTX_start(ctx); + + if ((p = BN_CTX_get(ctx)) == NULL) goto err; - } - ret = group->meth->group_check_discriminant(group, ctx); + if ((a = BN_CTX_get(ctx)) == NULL) + goto err; + if ((b = BN_CTX_get(ctx)) == NULL) + goto err; + if ((discriminant = BN_CTX_get(ctx)) == NULL) + goto err; + + if (!EC_GROUP_get_curve(group, p, a, b, ctx)) + goto err; + + /* + * Check that the discriminant 4a^3 + 27b^2 is non-zero modulo p. + */ + + if (BN_is_zero(a) && BN_is_zero(b)) + goto err; + if (BN_is_zero(a) || BN_is_zero(b)) + goto done; + + /* Compute the discriminant: first 4a^3, then 27b^2, then their sum. */ + if (!BN_mod_sqr(discriminant, a, p, ctx)) + goto err; + if (!BN_mod_mul(discriminant, discriminant, a, p, ctx)) + goto err; + if (!BN_lshift(discriminant, discriminant, 2)) + goto err; + + if (!BN_mod_sqr(b, b, p, ctx)) + goto err; + if (!BN_mul_word(b, 27)) + goto err; + + if (!BN_mod_add(discriminant, discriminant, b, p, ctx)) + goto err; + + if (BN_is_zero(discriminant)) + goto err; + + done: + ret = 1; err: if (ctx != ctx_in) diff --git a/lib/libcrypto/ec/ec_local.h b/lib/libcrypto/ec/ec_local.h index 03fda6876b5..59499089911 100644 --- a/lib/libcrypto/ec/ec_local.h +++ b/lib/libcrypto/ec/ec_local.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ec_local.h,v 1.52 2025/01/06 14:34:47 tb Exp $ */ +/* $OpenBSD: ec_local.h,v 1.54 2025/01/07 08:52:17 tb Exp $ */ /* * Originally written by Bodo Moeller for the OpenSSL project. */ @@ -93,8 +93,6 @@ struct ec_method_st { int (*group_get_curve)(const EC_GROUP *, BIGNUM *p, BIGNUM *a, BIGNUM *b, BN_CTX *); - int (*group_check_discriminant)(const EC_GROUP *, BN_CTX *); - int (*point_set_affine_coordinates)(const EC_GROUP *, EC_POINT *, const BIGNUM *x, const BIGNUM *y, BN_CTX *); int (*point_get_affine_coordinates)(const EC_GROUP *, const EC_POINT *, @@ -162,11 +160,6 @@ struct ec_group_st { size_t seed_len; /* - * Internal methods and members. Handled by the method functions, even - * if they appear to be generic. - */ - - /* * Coefficients of the Weierstrass equation y^2 = x^3 + a*x + b (mod p). */ BIGNUM *p; diff --git a/lib/libcrypto/ec/ecp_methods.c b/lib/libcrypto/ec/ecp_methods.c index 8623131ffa0..9593428870f 100644 --- a/lib/libcrypto/ec/ecp_methods.c +++ b/lib/libcrypto/ec/ecp_methods.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ecp_methods.c,v 1.25 2025/01/06 18:43:27 tb Exp $ */ +/* $OpenBSD: ecp_methods.c,v 1.26 2025/01/07 08:30:52 tb Exp $ */ /* Includes code written by Lenka Fibikova <fibikova@exp-math.uni-essen.de> * for the OpenSSL project. * Includes code written by Bodo Moeller for the OpenSSL project. @@ -167,63 +167,6 @@ ec_group_get_curve(const EC_GROUP *group, BIGNUM *p, BIGNUM *a, BIGNUM *b, } static int -ec_group_check_discriminant(const EC_GROUP *group, BN_CTX *ctx) -{ - BIGNUM *p, *a, *b, *discriminant; - int ret = 0; - - BN_CTX_start(ctx); - - if ((p = BN_CTX_get(ctx)) == NULL) - goto err; - if ((a = BN_CTX_get(ctx)) == NULL) - goto err; - if ((b = BN_CTX_get(ctx)) == NULL) - goto err; - if ((discriminant = BN_CTX_get(ctx)) == NULL) - goto err; - - if (!EC_GROUP_get_curve(group, p, a, b, ctx)) - goto err; - - /* - * Check that the discriminant 4a^3 + 27b^2 is non-zero modulo p. - */ - - if (BN_is_zero(a) && BN_is_zero(b)) - goto err; - if (BN_is_zero(a) || BN_is_zero(b)) - goto done; - - /* Compute the discriminant: first 4a^3, then 27b^2, then their sum. */ - if (!BN_mod_sqr(discriminant, a, p, ctx)) - goto err; - if (!BN_mod_mul(discriminant, discriminant, a, p, ctx)) - goto err; - if (!BN_lshift(discriminant, discriminant, 2)) - goto err; - - if (!BN_mod_sqr(b, b, p, ctx)) - goto err; - if (!BN_mul_word(b, 27)) - goto err; - - if (!BN_mod_add(discriminant, discriminant, b, p, ctx)) - goto err; - - if (BN_is_zero(discriminant)) - goto err; - - done: - ret = 1; - - err: - BN_CTX_end(ctx); - - return ret; -} - -static int ec_point_set_affine_coordinates(const EC_GROUP *group, EC_POINT *point, const BIGNUM *x, const BIGNUM *y, BN_CTX *ctx) { @@ -1511,7 +1454,6 @@ static const EC_METHOD ec_GFp_simple_method = { .field_type = NID_X9_62_prime_field, .group_set_curve = ec_group_set_curve, .group_get_curve = ec_group_get_curve, - .group_check_discriminant = ec_group_check_discriminant, .point_set_affine_coordinates = ec_point_set_affine_coordinates, .point_get_affine_coordinates = ec_point_get_affine_coordinates, .point_set_compressed_coordinates = ec_set_compressed_coordinates, @@ -1540,7 +1482,6 @@ static const EC_METHOD ec_GFp_mont_method = { .field_type = NID_X9_62_prime_field, .group_set_curve = ec_mont_group_set_curve, .group_get_curve = ec_group_get_curve, - .group_check_discriminant = ec_group_check_discriminant, .point_set_affine_coordinates = ec_point_set_affine_coordinates, .point_get_affine_coordinates = ec_point_get_affine_coordinates, .point_set_compressed_coordinates = ec_set_compressed_coordinates, diff --git a/lib/libcrypto/man/X509_NAME_print_ex.3 b/lib/libcrypto/man/X509_NAME_print_ex.3 index 8024d8380d5..f1b3262f2a9 100644 --- a/lib/libcrypto/man/X509_NAME_print_ex.3 +++ b/lib/libcrypto/man/X509_NAME_print_ex.3 @@ -1,4 +1,4 @@ -.\" $OpenBSD: X509_NAME_print_ex.3,v 1.12 2021/11/11 15:58:49 schwarze Exp $ +.\" $OpenBSD: X509_NAME_print_ex.3,v 1.14 2025/01/08 00:08:02 tb Exp $ .\" full merge up to: OpenSSL aebb9aac Jul 19 09:27:53 2016 -0400 .\" selective merge up to: OpenSSL 61f805c1 Jan 16 01:01:46 2018 +0800 .\" @@ -50,7 +50,7 @@ .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED .\" OF THE POSSIBILITY OF SUCH DAMAGE. .\" -.Dd $Mdocdate: November 11 2021 $ +.Dd $Mdocdate: January 8 2025 $ .Dt X509_NAME_PRINT_EX 3 .Os .Sh NAME @@ -131,12 +131,11 @@ is returned. prints out .Fa name to -.Fa bp -indenting each line by +.Fa bp . +The .Fa obase -characters. -Multiple lines are used if the output (including indent) exceeds 80 -characters. +argument is intended to indent the output, +it is however ignored. .Pp The functions .Fn X509_NAME_oneline diff --git a/lib/libcrypto/ts/ts_lib.c b/lib/libcrypto/ts/ts_lib.c index 1e94922aa19..7e401017529 100644 --- a/lib/libcrypto/ts/ts_lib.c +++ b/lib/libcrypto/ts/ts_lib.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ts_lib.c,v 1.14 2023/07/07 07:25:21 beck Exp $ */ +/* $OpenBSD: ts_lib.c,v 1.15 2025/01/07 14:22:19 tb Exp $ */ /* Written by Zoltan Glozik (zglozik@stones.com) for the OpenSSL * project 2002. */ @@ -74,20 +74,25 @@ int TS_ASN1_INTEGER_print_bio(BIO *bio, const ASN1_INTEGER *num) { - BIGNUM num_bn; - int result = 0; - char *hex; - - BN_init(&num_bn); - ASN1_INTEGER_to_BN(num, &num_bn); - if ((hex = BN_bn2hex(&num_bn))) { - result = BIO_write(bio, "0x", 2) > 0; - result = result && BIO_write(bio, hex, strlen(hex)) > 0; - free(hex); - } - BN_free(&num_bn); + BIGNUM *bn = NULL; + char *hex = NULL; + int ret = 0; + + /* XXX - OpenSSL decided to return -1 here for some stupid reason. */ + if ((bn = ASN1_INTEGER_to_BN(num, NULL)) == NULL) + goto err; + if ((hex = BN_bn2hex(bn)) == NULL) + goto err; + if (BIO_printf(bio, "0x%s", hex) <= 0) + goto err; + + ret = 1; + + err: + BN_free(bn); + free(hex); - return result; + return ret; } LCRYPTO_ALIAS(TS_ASN1_INTEGER_print_bio); diff --git a/share/misc/airport b/share/misc/airport index e90f5c58f96..e93a990adc0 100644 --- a/share/misc/airport +++ b/share/misc/airport @@ -1,4 +1,4 @@ -# $OpenBSD: airport,v 1.99 2024/11/07 08:43:18 sthen Exp $ +# $OpenBSD: airport,v 1.100 2025/01/08 22:26:22 kn Exp $ # @(#)airport 8.1 (Berkeley) 6/8/93 # # Some of this information from the Airport Search Engine at @@ -1346,6 +1346,7 @@ PKB:Wood County, Parkersburg / Marietta, West Virginia, USA PKE:Parkes, New South Wales, Australia PKR:Pokhara, Nepal PKU:Simpang Tiga, Pekanbaru, Indonesia +PKV:Pskov, Russia PLB:Plattsburgh, New York, USA PLH:Plymouth, England, United Kingdom PLM:Sultan Mahmud Badaruddin Ii, Palembang, Indonesia diff --git a/sys/dev/i2c/ihidev.c b/sys/dev/i2c/ihidev.c index af5e90cebd5..8559b793ecb 100644 --- a/sys/dev/i2c/ihidev.c +++ b/sys/dev/i2c/ihidev.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ihidev.c,v 1.35 2025/01/06 02:13:55 kirill Exp $ */ +/* $OpenBSD: ihidev.c,v 1.38 2025/01/07 23:13:56 kirill Exp $ */ /* * HID-over-i2c driver * @@ -76,6 +76,17 @@ int ihidev_maxrepid(void *buf, int len); int ihidev_print(void *aux, const char *pnp); int ihidev_submatch(struct device *parent, void *cf, void *aux); +#define IHIDEV_QUIRK_RE_POWER_ON 0x1 + +const struct ihidev_quirks { + uint16_t ihq_vid; + uint16_t ihq_pid; + int ihq_quirks; +} ihidev_devs[] = { + /* HONOR MagicBook Art 14 Touchpad (QTEC0002) */ + { 0x35cc, 0x0104, IHIDEV_QUIRK_RE_POWER_ON }, +}; + const struct cfattach ihidev_ca = { sizeof(struct ihidev_softc), ihidev_match, @@ -99,6 +110,25 @@ ihidev_match(struct device *parent, void *match, void *aux) return (0); } +int +ihidev_quirks(struct ihidev_softc *sc) +{ + const struct ihidev_quirks *q; + uint16_t vid, pid; + int i, nent; + + nent = nitems(ihidev_devs); + + vid = letoh16(sc->hid_desc.wVendorID); + pid = letoh16(sc->hid_desc.wProductID); + + for (i = 0, q = ihidev_devs; i < nent; i++, q++) + if (vid == q->ihq_vid && pid == q->ihq_pid) + return (q->ihq_quirks); + + return (0); +} + void ihidev_attach(struct device *parent, struct device *self, void *aux) { @@ -447,17 +477,8 @@ ihidev_hid_command(struct ihidev_softc *sc, int hidcmd, void *arg) cmd[2] = report_id | rreq->type << 4; - if (rreq->type == I2C_HID_REPORT_TYPE_FEATURE) { - cmd[dataoff++] = htole16(sc->hid_desc.wDataRegister) - & 0xff; - cmd[dataoff++] = htole16(sc->hid_desc.wDataRegister) - >> 8; - } else { - cmd[dataoff++] = htole16(sc->hid_desc.wOutputRegister) - & 0xff; - cmd[dataoff++] = htole16(sc->hid_desc.wOutputRegister) - >> 8; - } + cmd[dataoff++] = htole16(sc->hid_desc.wDataRegister) & 0xff; + cmd[dataoff++] = htole16(sc->hid_desc.wDataRegister) >> 8; cmd[dataoff++] = report_len & 0xff; cmd[dataoff++] = report_len >> 8; @@ -602,6 +623,8 @@ ihidev_reset(struct ihidev_softc *sc) int ihidev_hid_desc_parse(struct ihidev_softc *sc) { + sc->sc_quirks = ihidev_quirks(sc); + /* must be v01.00 */ if (letoh16(sc->hid_desc.bcdVersion) != 0x0100) { printf("%s: bad HID descriptor bcdVersion (0x%x)\n", @@ -639,6 +662,23 @@ ihidev_hid_desc_parse(struct ihidev_softc *sc) return (1); } + if (sc->sc_quirks & IHIDEV_QUIRK_RE_POWER_ON) { + if (ihidev_poweron(sc)) + return (1); + + /* + * 7.2.8 states that a device shall not respond back + * after receiving the power on command, and must ensure + * that it transitions to power on state in less than 1 + * second. The ihidev_poweron function uses a shorter + * sleep, sufficient for the ON-RESET sequence. Here, + * however, it sleeps for the full second to accommodate + * cold boot scenarios on affected devices. + */ + + ihidev_sleep(sc, 1000); + } + return (0); } @@ -920,3 +960,34 @@ ihidev_set_report(struct device *dev, int type, int id, void *data, int len) return 0; } + +int +ihidev_send_report(struct device *dev, int repid, void *data, int data_len) +{ + struct ihidev_softc *sc = (struct ihidev_softc *)dev; + uint8_t *finalcmd, cmd[5]; + int cmd_len, report_len, res; + + cmd_len = sizeof(cmd); + report_len = 2 + 1 + data_len; + + cmd[0] = htole16(sc->hid_desc.wOutputRegister) & 0xff; + cmd[1] = htole16(sc->hid_desc.wOutputRegister) >> 8; + cmd[2] = report_len & 0xff; + cmd[3] = report_len >> 8; + cmd[4] = repid; + + finalcmd = malloc(cmd_len + data_len, M_DEVBUF, M_NOWAIT | M_ZERO); + if (finalcmd == NULL) + return ENOMEM; + + memcpy(finalcmd, cmd, cmd_len); + memcpy(finalcmd + cmd_len, data, data_len); + + res = iic_exec(sc->sc_tag, I2C_OP_WRITE_WITH_STOP, sc->sc_addr, + finalcmd, cmd_len + data_len, NULL, 0, 0); + + free(finalcmd, M_DEVBUF, cmd_len + data_len); + + return res; +} diff --git a/sys/dev/i2c/ihidev.h b/sys/dev/i2c/ihidev.h index cb87da7332b..e056386b848 100644 --- a/sys/dev/i2c/ihidev.h +++ b/sys/dev/i2c/ihidev.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ihidev.h,v 1.9 2022/09/03 15:48:16 kettenis Exp $ */ +/* $OpenBSD: ihidev.h,v 1.11 2025/01/07 19:26:14 mglocker Exp $ */ /* * HID-over-i2c driver * @@ -93,6 +93,8 @@ struct ihidev_softc { int sc_fastpoll; struct timeout sc_timer; int sc_dying; + + int sc_quirks; }; struct ihidev { @@ -135,5 +137,6 @@ int ihidev_ioctl(struct ihidev *, u_long, caddr_t, int, struct proc *); int ihidev_report_type_conv(int); int ihidev_set_report(struct device *, int, int, void *, int); int ihidev_get_report(struct device *, int, int, void *, int); +int ihidev_send_report(struct device *, int, void *, int); void ihidev_poll(void *); diff --git a/sys/dev/i2c/ikbd.c b/sys/dev/i2c/ikbd.c index e1e4bf8ba35..6551b918f01 100644 --- a/sys/dev/i2c/ikbd.c +++ b/sys/dev/i2c/ikbd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ikbd.c,v 1.2 2022/09/03 15:48:16 kettenis Exp $ */ +/* $OpenBSD: ikbd.c,v 1.3 2025/01/07 19:26:14 mglocker Exp $ */ /* * HID-over-i2c keyboard driver * @@ -36,6 +36,7 @@ struct ikbd_softc { struct ihidev sc_hdev; +#define sc_ledsize sc_hdev.sc_osize struct hidkbd sc_kbd; int sc_spl; }; @@ -167,6 +168,14 @@ ikbd_enable(void *v, int on) void ikbd_set_leds(void *v, int leds) { + struct ikbd_softc *sc = v; + struct hidkbd *kbd = &sc->sc_kbd; + uint8_t res; + + if (sc->sc_ledsize && hidkbd_set_leds(kbd, leds, &res) != 0) { + ihidev_send_report((struct device *)sc->sc_hdev.sc_parent, + sc->sc_hdev.sc_report_id, &res, 1); + } } int @@ -181,6 +190,9 @@ ikbd_ioctl(void *v, u_long cmd, caddr_t data, int flag, struct proc *p) /* XXX: should we set something else? */ *(u_int *)data = WSKBD_TYPE_USB; return 0; + case WSKBDIO_SETLEDS: + ikbd_set_leds(v, *(int *)data); + return 0; default: rc = ihidev_ioctl(&sc->sc_hdev, cmd, data, flag, p); if (rc != -1) diff --git a/sys/dev/pci/pcidevs b/sys/dev/pci/pcidevs index 847d101ff1b..9f9c6d56633 100644 --- a/sys/dev/pci/pcidevs +++ b/sys/dev/pci/pcidevs @@ -1,4 +1,4 @@ -$OpenBSD: pcidevs,v 1.2094 2024/11/09 10:23:06 miod Exp $ +$OpenBSD: pcidevs,v 1.2095 2025/01/08 02:12:24 jsg Exp $ /* $NetBSD: pcidevs,v 1.30 1997/06/24 06:20:24 thorpej Exp $ */ /* @@ -6460,9 +6460,13 @@ product INTEL MTL_U_HB_1 0x7d16 Core Ultra Host product INTEL MTL_IPU 0x7d19 Core Ultra IPU product INTEL MTL_NPU 0x7d1d Core Ultra NPU product INTEL MTL_U4_GT_1 0x7d40 Graphics +product INTEL ARL_U_GT_1 0x7d41 Graphics product INTEL MTL_U_GT_1 0x7d45 Graphics +product INTEL ARL_H_GT_1 0x7d51 Graphics product INTEL MTL_H_GT_1 0x7d55 Arc Graphics product INTEL MTL_U_GT_2 0x7d60 Graphics +product INTEL ARL_S_GT_1 0x7d67 Graphics +product INTEL ARL_H_GT_2 0x7dd1 Graphics product INTEL MTL_H_GT_2 0x7dd5 Graphics product INTEL MTL_H_ESPI 0x7e02 Core Ultra eSPI product INTEL MTL_U_ESPI 0x7e03 Core Ultra eSPI @@ -7349,6 +7353,7 @@ product INTEL LNL_XHCI 0xa87d Core Ultra xHCI product INTEL LNL_SRAM 0xa87f Core Ultra SRAM product INTEL 21152 0xb152 S21152BB product INTEL 21154 0xb154 21154AE/BE +product INTEL ARL_S_GT_2 0xb640 Graphics product INTEL CORE_DMI_0 0xd130 Core DMI product INTEL CORE_DMI_1 0xd131 Core DMI product INTEL CORE_DMI_2 0xd132 Core DMI diff --git a/sys/dev/pci/pcidevs.h b/sys/dev/pci/pcidevs.h index f14af30638a..8fd8706c09a 100644 --- a/sys/dev/pci/pcidevs.h +++ b/sys/dev/pci/pcidevs.h @@ -2,7 +2,7 @@ * THIS FILE AUTOMATICALLY GENERATED. DO NOT EDIT. * * generated from: - * OpenBSD: pcidevs,v 1.2094 2024/11/09 10:23:06 miod Exp + * OpenBSD: pcidevs,v 1.2095 2025/01/08 02:12:24 jsg Exp */ /* $NetBSD: pcidevs,v 1.30 1997/06/24 06:20:24 thorpej Exp $ */ @@ -6465,9 +6465,13 @@ #define PCI_PRODUCT_INTEL_MTL_IPU 0x7d19 /* Core Ultra IPU */ #define PCI_PRODUCT_INTEL_MTL_NPU 0x7d1d /* Core Ultra NPU */ #define PCI_PRODUCT_INTEL_MTL_U4_GT_1 0x7d40 /* Graphics */ +#define PCI_PRODUCT_INTEL_ARL_U_GT_1 0x7d41 /* Graphics */ #define PCI_PRODUCT_INTEL_MTL_U_GT_1 0x7d45 /* Graphics */ +#define PCI_PRODUCT_INTEL_ARL_H_GT_1 0x7d51 /* Graphics */ #define PCI_PRODUCT_INTEL_MTL_H_GT_1 0x7d55 /* Arc Graphics */ #define PCI_PRODUCT_INTEL_MTL_U_GT_2 0x7d60 /* Graphics */ +#define PCI_PRODUCT_INTEL_ARL_S_GT_1 0x7d67 /* Graphics */ +#define PCI_PRODUCT_INTEL_ARL_H_GT_2 0x7dd1 /* Graphics */ #define PCI_PRODUCT_INTEL_MTL_H_GT_2 0x7dd5 /* Graphics */ #define PCI_PRODUCT_INTEL_MTL_H_ESPI 0x7e02 /* Core Ultra eSPI */ #define PCI_PRODUCT_INTEL_MTL_U_ESPI 0x7e03 /* Core Ultra eSPI */ @@ -7354,6 +7358,7 @@ #define PCI_PRODUCT_INTEL_LNL_SRAM 0xa87f /* Core Ultra SRAM */ #define PCI_PRODUCT_INTEL_21152 0xb152 /* S21152BB */ #define PCI_PRODUCT_INTEL_21154 0xb154 /* 21154AE/BE */ +#define PCI_PRODUCT_INTEL_ARL_S_GT_2 0xb640 /* Graphics */ #define PCI_PRODUCT_INTEL_CORE_DMI_0 0xd130 /* Core DMI */ #define PCI_PRODUCT_INTEL_CORE_DMI_1 0xd131 /* Core DMI */ #define PCI_PRODUCT_INTEL_CORE_DMI_2 0xd132 /* Core DMI */ diff --git a/sys/dev/pci/pcidevs_data.h b/sys/dev/pci/pcidevs_data.h index 546ae7d8a3e..51027526e87 100644 --- a/sys/dev/pci/pcidevs_data.h +++ b/sys/dev/pci/pcidevs_data.h @@ -2,7 +2,7 @@ * THIS FILE AUTOMATICALLY GENERATED. DO NOT EDIT. * * generated from: - * OpenBSD: pcidevs,v 1.2094 2024/11/09 10:23:06 miod Exp + * OpenBSD: pcidevs,v 1.2095 2025/01/08 02:12:24 jsg Exp */ /* $NetBSD: pcidevs,v 1.30 1997/06/24 06:20:24 thorpej Exp $ */ @@ -23188,10 +23188,18 @@ static const struct pci_known_product pci_known_products[] = { "Graphics", }, { + PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_ARL_U_GT_1, + "Graphics", + }, + { PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_MTL_U_GT_1, "Graphics", }, { + PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_ARL_H_GT_1, + "Graphics", + }, + { PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_MTL_H_GT_1, "Arc Graphics", }, @@ -23200,6 +23208,14 @@ static const struct pci_known_product pci_known_products[] = { "Graphics", }, { + PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_ARL_S_GT_1, + "Graphics", + }, + { + PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_ARL_H_GT_2, + "Graphics", + }, + { PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_MTL_H_GT_2, "Graphics", }, @@ -26744,6 +26760,10 @@ static const struct pci_known_product pci_known_products[] = { "21154AE/BE", }, { + PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_ARL_S_GT_2, + "Graphics", + }, + { PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_CORE_DMI_0, "Core DMI", }, diff --git a/sys/dev/usb/uaudio.c b/sys/dev/usb/uaudio.c index 1a11b34c744..d3601922d80 100644 --- a/sys/dev/usb/uaudio.c +++ b/sys/dev/usb/uaudio.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uaudio.c,v 1.177 2025/01/04 11:45:15 ratchov Exp $ */ +/* $OpenBSD: uaudio.c,v 1.178 2025/01/07 12:49:40 ratchov Exp $ */ /* * Copyright (c) 2018 Alexandre Ratchov <alex@caoua.org> * @@ -37,8 +37,6 @@ #include <dev/usb/usbdivar.h> #include <dev/usb/usb_mem.h> -#define UAUDIO_DEBUG - #ifdef UAUDIO_DEBUG #define DPRINTF(...) \ do { \ diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c index ac75c300572..8ce0decd823 100644 --- a/sys/kern/uipc_socket.c +++ b/sys/kern/uipc_socket.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uipc_socket.c,v 1.356 2025/01/04 15:57:02 mvs Exp $ */ +/* $OpenBSD: uipc_socket.c,v 1.357 2025/01/07 23:13:46 mvs Exp $ */ /* $NetBSD: uipc_socket.c,v 1.21 1996/02/04 02:17:52 christos Exp $ */ /* @@ -1445,10 +1445,26 @@ sosplice(struct socket *so, int fd, off_t max, struct timeval *tv) error = ENOTCONN; goto release; } - if (so->so_sp == NULL) - so->so_sp = pool_get(&sosplice_pool, PR_WAITOK | PR_ZERO); - if (sosp->so_sp == NULL) - sosp->so_sp = pool_get(&sosplice_pool, PR_WAITOK | PR_ZERO); + if (so->so_sp == NULL) { + struct sosplice *so_sp; + + so_sp = pool_get(&sosplice_pool, PR_WAITOK | PR_ZERO); + timeout_set_flags(&so_sp->ssp_idleto, soidle, so, + KCLOCK_NONE, TIMEOUT_PROC | TIMEOUT_MPSAFE); + task_set(&so_sp->ssp_task, sotask, so); + + so->so_sp = so_sp; + } + if (sosp->so_sp == NULL) { + struct sosplice *so_sp; + + so_sp = pool_get(&sosplice_pool, PR_WAITOK | PR_ZERO); + timeout_set_flags(&so_sp->ssp_idleto, soidle, sosp, + KCLOCK_NONE, TIMEOUT_PROC | TIMEOUT_MPSAFE); + task_set(&so_sp->ssp_task, sotask, sosp); + + sosp->so_sp = so_sp; + } if (so->so_sp->ssp_socket || sosp->so_sp->ssp_soback) { error = EBUSY; goto release; @@ -1460,9 +1476,6 @@ sosplice(struct socket *so, int fd, off_t max, struct timeval *tv) so->so_idletv = *tv; else timerclear(&so->so_idletv); - timeout_set_flags(&so->so_idleto, soidle, so, - KCLOCK_NONE, TIMEOUT_PROC | TIMEOUT_MPSAFE); - task_set(&so->so_splicetask, sotask, so); /* * To prevent sorwakeup() calling somove() before this somove() @@ -1507,9 +1520,6 @@ sounsplice(struct socket *so, struct socket *sosp, int freeing) { sbassertlocked(&so->so_rcv); - task_del(sosplice_taskq, &so->so_splicetask); - timeout_del(&so->so_idleto); - mtx_enter(&so->so_rcv.sb_mtx); mtx_enter(&sosp->so_snd.sb_mtx); so->so_rcv.sb_flags &= ~SB_SPLICE; @@ -1518,6 +1528,9 @@ sounsplice(struct socket *so, struct socket *sosp, int freeing) mtx_leave(&sosp->so_snd.sb_mtx); mtx_leave(&so->so_rcv.sb_mtx); + task_del(sosplice_taskq, &so->so_splicetask); + timeout_del(&so->so_idleto); + /* Do not wakeup a socket that is about to be freed. */ if ((freeing & SOSP_FREEING_READ) == 0) { int readable; diff --git a/usr.sbin/bgpd/bgpd.8 b/usr.sbin/bgpd/bgpd.8 index ab414558914..c9e256b6747 100644 --- a/usr.sbin/bgpd/bgpd.8 +++ b/usr.sbin/bgpd/bgpd.8 @@ -1,4 +1,4 @@ -.\" $OpenBSD: bgpd.8,v 1.81 2024/12/13 19:21:03 claudio Exp $ +.\" $OpenBSD: bgpd.8,v 1.82 2025/01/07 12:00:36 claudio Exp $ .\" .\" Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> .\" @@ -14,7 +14,7 @@ .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" -.Dd $Mdocdate: December 13 2024 $ +.Dd $Mdocdate: January 7 2025 $ .Dt BGPD 8 .Os .Sh NAME @@ -309,6 +309,17 @@ has been started. .Re .Pp .Rs +.%A S. Sangli +.%A E. Chen +.%A R. Fernando +.%A J. Scudder +.%A Y. Rekhter +.%D January 2007 +.%R RFC 4724 +.%T Graceful Restart Mechanism for BGP +.Re +.Pp +.Rs .%A T. Bates .%A R. Chandra .%A D. Katz @@ -338,6 +349,15 @@ has been started. .Re .Pp .Rs +.%A Y. Rekhter +.%A S. Sangli +.%A D. Tappan +.%D October 2009 +.%R RFC 5668 +.%T 4-Octet AS Specific BGP Extended Community +.Re +.Pp +.Rs .%A E. Chen .%A J. Yuan .%D June 2011 @@ -346,6 +366,15 @@ has been started. .Re .Pp .Rs +.%A J. Dong +.%A M. Chen +.%A A. Suryanarayana +.%D May 2012 +.%R RFC 6608 +.%T Subcodes for BGP Finite State Machine Error +.Re +.Pp +.Rs .%A Q. Vohra .%A E. Chen .%D Dec 2012 @@ -411,6 +440,16 @@ has been started. .Re .Pp .Rs +.%A E. Jasinska +.%A N. Hilliard +.%A R. Raszuk +.%A N. Bakker +.%D September 2016 +.%R RFC 7947 +.%T Internet Exchange BGP Route Server +.Re +.Pp +.Rs .%A C. Petrie .%A T. King .%D May 2017 diff --git a/usr.sbin/bgpd/bgpd.conf.5 b/usr.sbin/bgpd/bgpd.conf.5 index 5cda014d00f..f0199a6c151 100644 --- a/usr.sbin/bgpd/bgpd.conf.5 +++ b/usr.sbin/bgpd/bgpd.conf.5 @@ -1,4 +1,4 @@ -.\" $OpenBSD: bgpd.conf.5,v 1.245 2024/12/13 19:21:03 claudio Exp $ +.\" $OpenBSD: bgpd.conf.5,v 1.246 2025/01/07 12:11:45 claudio Exp $ .\" .\" Copyright (c) 2004 Claudio Jeker <claudio@openbsd.org> .\" Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -16,7 +16,7 @@ .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" -.Dd $Mdocdate: December 13 2024 $ +.Dd $Mdocdate: January 7 2025 $ .Dt BGPD.CONF 5 .Os .Sh NAME @@ -407,8 +407,16 @@ The default is 180 seconds. .Xc If set to .Ic yes , +attribute transparency is enabled. .Em AS paths to EBGP neighbors are not prepended with the local AS. +Additionally, the MULTI_EXIT_DISC attribute is passed transparently and +automatic filtering based on the well-known communities +.Ic NO_EXPORT , +.Ic NO_ADVERTISE , +and +.Ic NO_EXPORT_SUBCONFED +is disabled. The default is .Ic no . .El @@ -1571,8 +1579,11 @@ After changing keys, a session needs to be reset to use the new keys. .Xc If set to .Ic yes , -.Em AS paths -to EBGP neighbors are not prepended with the local AS. +attribute transparency is enabled. +See also the +.Ic transparent-as +setting in +.Sx GLOBAL CONFIGURATION . The default is inherited from the global .Ic transparent-as setting. diff --git a/usr.sbin/bgpd/bgpd.h b/usr.sbin/bgpd/bgpd.h index 1e00fbd8262..ce5b3c6fe7b 100644 --- a/usr.sbin/bgpd/bgpd.h +++ b/usr.sbin/bgpd/bgpd.h @@ -1,4 +1,4 @@ -/* $OpenBSD: bgpd.h,v 1.506 2024/12/13 19:21:03 claudio Exp $ */ +/* $OpenBSD: bgpd.h,v 1.507 2025/01/07 17:43:31 denis Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -156,12 +156,14 @@ enum reconf_action { #define AFI_UNSPEC 0 #define AFI_IPv4 1 #define AFI_IPv6 2 +#define AFI_L2VPN 25 /* Subsequent Address Family Identifier as per RFC 4760 */ #define SAFI_NONE 0 #define SAFI_UNICAST 1 #define SAFI_MULTICAST 2 #define SAFI_MPLS 4 +#define SAFI_EVPN 70 /* RFC 7432 */ #define SAFI_MPLSVPN 128 #define SAFI_FLOWSPEC 133 #define SAFI_VPNFLOWSPEC 134 @@ -182,7 +184,8 @@ extern const struct aid aid_vals[]; #define AID_VPN_IPv6 4 #define AID_FLOWSPECv4 5 #define AID_FLOWSPECv6 6 -#define AID_MAX 7 +#define AID_EVPN 7 +#define AID_MAX 8 #define AID_MIN 1 /* skip AID_UNSPEC since that is a dummy */ #define AID_VALS { \ @@ -194,6 +197,7 @@ extern const struct aid aid_vals[]; { AFI_IPv6, AF_INET6, SAFI_MPLSVPN, "IPv6 vpn" }, \ { AFI_IPv4, AF_INET, SAFI_FLOWSPEC, "IPv4 flowspec" }, \ { AFI_IPv6, AF_INET6, SAFI_FLOWSPEC, "IPv6 flowspec" }, \ + { AFI_L2VPN, AF_UNSPEC, SAFI_EVPN, "evpn" }, \ } #define BGP_MPLS_BOS 0x01 @@ -1134,6 +1138,7 @@ struct ext_comm_pairs { { EXT_COMMUNITY_TRANS_IPV4, 0x0b, "vrfri" }, \ \ { EXT_COMMUNITY_TRANS_OPAQUE, 0x06, "ort" }, \ + { EXT_COMMUNITY_TRANS_OPAQUE, 0x0c, "encap" }, \ { EXT_COMMUNITY_TRANS_OPAQUE, 0x0d, "defgw" }, \ \ { EXT_COMMUNITY_NON_TRANS_OPAQUE, EXT_COMMUNITY_SUBTYPE_OVS, "ovs" }, \ diff --git a/usr.sbin/bgpd/rde.h b/usr.sbin/bgpd/rde.h index f28ff29683f..3a6a867aa0b 100644 --- a/usr.sbin/bgpd/rde.h +++ b/usr.sbin/bgpd/rde.h @@ -1,4 +1,4 @@ -/* $OpenBSD: rde.h,v 1.309 2024/12/12 20:19:03 claudio Exp $ */ +/* $OpenBSD: rde.h,v 1.311 2025/01/07 17:43:31 denis Exp $ */ /* * Copyright (c) 2003, 2004 Claudio Jeker <claudio@openbsd.org> and @@ -143,6 +143,7 @@ enum attrtypes { ATTR_EXT_COMMUNITIES=16, ATTR_AS4_PATH=17, ATTR_AS4_AGGREGATOR=18, + ATTR_PMSI_TUNNEL=22, ATTR_LARGE_COMMUNITIES=32, ATTR_OTC=35, ATTR_FIRST_UNKNOWN, /* after this all attributes are unknown */ @@ -157,7 +158,7 @@ enum attrtypes { /* by default mask the reserved bits and the ext len bit */ #define ATTR_DEFMASK (ATTR_RESERVED | ATTR_EXTLEN) -/* default attribute flags for well known attributes */ +/* default attribute flags for well-known attributes */ #define ATTR_WELL_KNOWN ATTR_TRANSITIVE struct attr { diff --git a/usr.sbin/bgpd/rde_peer.c b/usr.sbin/bgpd/rde_peer.c index 60d8491349d..45bf85d5121 100644 --- a/usr.sbin/bgpd/rde_peer.c +++ b/usr.sbin/bgpd/rde_peer.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rde_peer.c,v 1.42 2024/12/12 20:19:03 claudio Exp $ */ +/* $OpenBSD: rde_peer.c,v 1.43 2025/01/07 17:43:31 denis Exp $ */ /* * Copyright (c) 2019 Claudio Jeker <claudio@openbsd.org> @@ -31,8 +31,8 @@ struct peer_tree zombietable = RB_INITIALIZER(&zombietable); struct rde_peer *peerself; static long imsg_pending; -CTASSERT(sizeof(peerself->recv_eor) * 8 > AID_MAX); -CTASSERT(sizeof(peerself->sent_eor) * 8 > AID_MAX); +CTASSERT(sizeof(peerself->recv_eor) * 8 >= AID_MAX); +CTASSERT(sizeof(peerself->sent_eor) * 8 >= AID_MAX); struct iq { SIMPLEQ_ENTRY(iq) entry; diff --git a/usr.sbin/bgpd/rde_update.c b/usr.sbin/bgpd/rde_update.c index bfc90619f14..72a630d87c4 100644 --- a/usr.sbin/bgpd/rde_update.c +++ b/usr.sbin/bgpd/rde_update.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rde_update.c,v 1.170 2024/12/09 10:51:46 claudio Exp $ */ +/* $OpenBSD: rde_update.c,v 1.172 2025/01/07 12:11:45 claudio Exp $ */ /* * Copyright (c) 2004 Claudio Jeker <claudio@openbsd.org> @@ -90,7 +90,14 @@ up_test_update(struct rde_peer *peer, struct prefix *p) return (0); } - /* well known communities */ + /* + * With "transparent-as yes" set do not filter based on + * well-known communities. Instead pass them on to the client. + */ + if (peer->flags & PEERFLAG_TRANS_AS) + return (1); + + /* well-known communities */ if (community_match(comm, &comm_no_advertise, NULL)) return (0); if (peer->conf.ebgp) { @@ -159,8 +166,8 @@ up_process_prefix(struct rde_peer *peer, struct prefix *new, struct prefix *p) /* * up_test_update() needs to run before the output filters - * else the well known communities won't work properly. - * The output filters would not be able to add well known + * else the well-known communities won't work properly. + * The output filters would not be able to add well-known * communities. */ if (!up_test_update(peer, new)) diff --git a/usr.sbin/bgpd/util.c b/usr.sbin/bgpd/util.c index 311ba143f59..62c8557d587 100644 --- a/usr.sbin/bgpd/util.c +++ b/usr.sbin/bgpd/util.c @@ -1,4 +1,4 @@ -/* $OpenBSD: util.c,v 1.89 2024/11/21 13:05:23 claudio Exp $ */ +/* $OpenBSD: util.c,v 1.90 2025/01/07 19:24:53 claudio Exp $ */ /* * Copyright (c) 2006 Claudio Jeker <claudio@openbsd.org> @@ -323,6 +323,8 @@ log_capability(uint8_t capa) return "Multiprotocol Extensions"; case CAPA_REFRESH: return "Route Refresh"; + case CAPA_EXT_MSG: + return "Extended Message"; case CAPA_ROLE: return "BGP Role"; case CAPA_RESTART: diff --git a/usr.sbin/vmd/virtio.c b/usr.sbin/vmd/virtio.c index 37185b7f96d..a8d6b8b7572 100644 --- a/usr.sbin/vmd/virtio.c +++ b/usr.sbin/vmd/virtio.c @@ -1,4 +1,4 @@ -/* $OpenBSD: virtio.c,v 1.122 2024/11/21 13:39:34 claudio Exp $ */ +/* $OpenBSD: virtio.c,v 1.123 2025/01/08 15:46:10 dv Exp $ */ /* * Copyright (c) 2015 Mike Larkin <mlarkin@openbsd.org> @@ -68,6 +68,7 @@ static int virtio_dev_launch(struct vmd_vm *, struct virtio_dev *); static void virtio_dispatch_dev(int, short, void *); static int handle_dev_msg(struct viodev_msg *, struct virtio_dev *); static int virtio_dev_closefds(struct virtio_dev *); +static void vmmci_pipe_dispatch(int, short, void *); const char * virtio_reg_name(uint8_t reg) @@ -275,17 +276,29 @@ virtio_rnd_io(int dir, uint16_t reg, uint32_t *data, uint8_t *intr, return (0); } +/* + * vmmci_ctl + * + * Inject a command into the vmmci device, potentially delivering interrupt. + * + * Called by the vm process's event(3) loop. + */ int vmmci_ctl(unsigned int cmd) { + int ret = 0; struct timeval tv = { 0, 0 }; + mutex_lock(&vmmci.mutex); + if ((vmmci.cfg.device_status & - VIRTIO_CONFIG_DEVICE_STATUS_DRIVER_OK) == 0) - return (-1); + VIRTIO_CONFIG_DEVICE_STATUS_DRIVER_OK) == 0) { + ret = -1; + goto unlock; + } if (cmd == vmmci.cmd) - return (0); + goto unlock; switch (cmd) { case VMMCI_NONE: @@ -307,7 +320,7 @@ vmmci_ctl(unsigned int cmd) vcpu_assert_irq(vmmci.vm_id, 0, vmmci.irq); /* Add ACK timeout */ - tv.tv_sec = VMMCI_TIMEOUT; + tv.tv_sec = VMMCI_TIMEOUT_SHORT; evtimer_add(&vmmci.timeout, &tv); break; case VMMCI_SYNCRTC: @@ -326,14 +339,22 @@ vmmci_ctl(unsigned int cmd) fatalx("invalid vmmci command: %d", cmd); } - return (0); +unlock: + mutex_unlock(&vmmci.mutex); + + return (ret); } +/* + * vmmci_ack + * + * Process a write to the command register. + * + * Called by the vcpu thread. Must be called with the mutex held. + */ void vmmci_ack(unsigned int cmd) { - struct timeval tv = { 0, 0 }; - switch (cmd) { case VMMCI_NONE: break; @@ -347,8 +368,7 @@ vmmci_ack(unsigned int cmd) if (vmmci.cmd == 0) { log_debug("%s: vm %u requested shutdown", __func__, vmmci.vm_id); - tv.tv_sec = VMMCI_TIMEOUT; - evtimer_add(&vmmci.timeout, &tv); + vm_pipe_send(&vmmci.dev_pipe, VMMCI_SET_TIMEOUT_SHORT); return; } /* FALLTHROUGH */ @@ -360,12 +380,10 @@ vmmci_ack(unsigned int cmd) * rc.shutdown on the VM), so increase the timeout before * killing it forcefully. */ - if (cmd == vmmci.cmd && - evtimer_pending(&vmmci.timeout, NULL)) { + if (cmd == vmmci.cmd) { log_debug("%s: vm %u acknowledged shutdown request", __func__, vmmci.vm_id); - tv.tv_sec = VMMCI_SHUTDOWN_TIMEOUT; - evtimer_add(&vmmci.timeout, &tv); + vm_pipe_send(&vmmci.dev_pipe, VMMCI_SET_TIMEOUT_LONG); } break; case VMMCI_SYNCRTC: @@ -392,6 +410,7 @@ vmmci_io(int dir, uint16_t reg, uint32_t *data, uint8_t *intr, { *intr = 0xFF; + mutex_lock(&vmmci.mutex); if (dir == 0) { switch (reg) { case VIRTIO_CONFIG_DEVICE_FEATURES: @@ -466,6 +485,8 @@ vmmci_io(int dir, uint16_t reg, uint32_t *data, uint8_t *intr, break; } } + mutex_unlock(&vmmci.mutex); + return (0); } @@ -482,6 +503,27 @@ virtio_get_base(int fd, char *path, size_t npath, int type, const char *dpath) return -1; } +static void +vmmci_pipe_dispatch(int fd, short event, void *arg) +{ + enum pipe_msg_type msg; + struct timeval tv = { 0, 0 }; + + msg = vm_pipe_recv(&vmmci.dev_pipe); + switch (msg) { + case VMMCI_SET_TIMEOUT_SHORT: + tv.tv_sec = VMMCI_TIMEOUT_SHORT; + evtimer_add(&vmmci.timeout, &tv); + break; + case VMMCI_SET_TIMEOUT_LONG: + tv.tv_sec = VMMCI_TIMEOUT_LONG; + evtimer_add(&vmmci.timeout, &tv); + break; + default: + log_warnx("%s: invalid pipe message type %d", __func__, msg); + } +} + void virtio_init(struct vmd_vm *vm, int child_cdrom, int child_disks[][VM_MAX_BASE_PER_DISK], int *child_taps) @@ -491,6 +533,7 @@ virtio_init(struct vmd_vm *vm, int child_cdrom, struct virtio_dev *dev; uint8_t id; uint8_t i, j; + int ret = 0; /* Virtio entropy device */ if (pci_add_device(&id, PCI_VENDOR_QUMRANET, @@ -745,8 +788,15 @@ virtio_init(struct vmd_vm *vm, int child_cdrom, vmmci.vm_id = vcp->vcp_id; vmmci.irq = pci_get_dev_irq(id); vmmci.pci_id = id; + ret = pthread_mutex_init(&vmmci.mutex, NULL); + if (ret) { + errno = ret; + fatal("could not initialize vmmci mutex"); + } evtimer_set(&vmmci.timeout, vmmci_timeout, NULL); + vm_pipe_init(&vmmci.dev_pipe, vmmci_pipe_dispatch); + event_add(&vmmci.dev_pipe.read_ev, NULL); } /* diff --git a/usr.sbin/vmd/virtio.h b/usr.sbin/vmd/virtio.h index c293743050c..87d5f8b20dd 100644 --- a/usr.sbin/vmd/virtio.h +++ b/usr.sbin/vmd/virtio.h @@ -1,4 +1,4 @@ -/* $OpenBSD: virtio.h,v 1.52 2024/07/10 09:27:33 dv Exp $ */ +/* $OpenBSD: virtio.h,v 1.53 2025/01/08 15:46:10 dv Exp $ */ /* * Copyright (c) 2015 Mike Larkin <mlarkin@openbsd.org> @@ -53,8 +53,8 @@ #define VIONET_MAX_TXLEN VIONET_HARD_MTU + ETHER_HDR_LEN /* VMM Control Interface shutdown timeout (in seconds) */ -#define VMMCI_TIMEOUT 3 -#define VMMCI_SHUTDOWN_TIMEOUT 120 +#define VMMCI_TIMEOUT_SHORT 3 +#define VMMCI_TIMEOUT_LONG 120 /* All the devices we support have either 1, 2 or 3 queues */ /* viornd - 1 queue @@ -321,8 +321,10 @@ struct vmmci_dev { enum vmmci_cmd cmd; uint32_t vm_id; int irq; - uint8_t pci_id; + + pthread_mutex_t mutex; + struct vm_dev_pipe dev_pipe; }; /* XXX to be removed once vioscsi is adapted to vectorized io. */ diff --git a/usr.sbin/vmd/vmd.h b/usr.sbin/vmd/vmd.h index b84656fc20c..ef98fa5a238 100644 --- a/usr.sbin/vmd/vmd.h +++ b/usr.sbin/vmd/vmd.h @@ -1,4 +1,4 @@ -/* $OpenBSD: vmd.h,v 1.131 2024/11/06 23:04:45 bluhm Exp $ */ +/* $OpenBSD: vmd.h,v 1.132 2025/01/08 15:46:10 dv Exp $ */ /* * Copyright (c) 2015 Mike Larkin <mlarkin@openbsd.org> @@ -424,6 +424,8 @@ enum pipe_msg_type { VIRTIO_THREAD_PAUSE, VIRTIO_THREAD_STOP, VIRTIO_THREAD_ACK, + VMMCI_SET_TIMEOUT_SHORT, + VMMCI_SET_TIMEOUT_LONG, }; static inline struct sockaddr_in * |