diff --git a/lib/libcrypto/evp/e_sm4.c b/lib/libcrypto/evp/e_sm4.c index 9de2080b2..9db45a87f 100644 --- a/lib/libcrypto/evp/e_sm4.c +++ b/lib/libcrypto/evp/e_sm4.c @@ -1,4 +1,4 @@ -/* $OpenBSD: e_sm4.c,v 1.10 2023/12/02 19:07:10 tb Exp $ */ +/* $OpenBSD: e_sm4.c,v 1.11 2024/01/02 19:54:43 tb Exp $ */ /* * Copyright (c) 2017, 2019 Ribose Inc * @@ -220,9 +220,9 @@ static const EVP_CIPHER sm4_ecb = { .do_cipher = sm4_ecb_cipher, .cleanup = NULL, .ctx_size = sizeof(EVP_SM4_KEY), - .set_asn1_parameters = 0, - .get_asn1_parameters = 0, - .ctrl = 0, + .set_asn1_parameters = NULL, + .get_asn1_parameters = NULL, + .ctrl = NULL, .app_data = NULL, }; diff --git a/lib/libcrypto/evp/evp_cipher.c b/lib/libcrypto/evp/evp_cipher.c index 751360cd7..51e83b757 100644 --- a/lib/libcrypto/evp/evp_cipher.c +++ b/lib/libcrypto/evp/evp_cipher.c @@ -1,4 +1,4 @@ -/* $OpenBSD: evp_cipher.c,v 1.3 2023/12/29 06:56:38 tb Exp $ */ +/* $OpenBSD: evp_cipher.c,v 1.13 2024/01/02 21:27:39 tb Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -618,56 +618,30 @@ EVP_CIPHER_CTX_init(EVP_CIPHER_CTX *ctx) } int -EVP_CIPHER_CTX_reset(EVP_CIPHER_CTX *a) +EVP_CIPHER_CTX_reset(EVP_CIPHER_CTX *ctx) { - return EVP_CIPHER_CTX_cleanup(a); + return EVP_CIPHER_CTX_cleanup(ctx); } int -EVP_CIPHER_CTX_cleanup(EVP_CIPHER_CTX *c) +EVP_CIPHER_CTX_cleanup(EVP_CIPHER_CTX *ctx) { - if (c->cipher != NULL) { + if (ctx->cipher != NULL) { /* XXX - Avoid leaks, so ignore return value of cleanup()... */ - if (c->cipher->cleanup != NULL) - c->cipher->cleanup(c); - if (c->cipher_data != NULL) - explicit_bzero(c->cipher_data, c->cipher->ctx_size); + if (ctx->cipher->cleanup != NULL) + ctx->cipher->cleanup(ctx); + if (ctx->cipher_data != NULL) + explicit_bzero(ctx->cipher_data, ctx->cipher->ctx_size); } /* XXX - store size of cipher_data so we can always freezero(). */ - free(c->cipher_data); + free(ctx->cipher_data); - explicit_bzero(c, sizeof(EVP_CIPHER_CTX)); + explicit_bzero(ctx, sizeof(EVP_CIPHER_CTX)); return 1; } -int -EVP_CIPHER_CTX_set_key_length(EVP_CIPHER_CTX *c, int keylen) -{ - if (c->cipher->flags & EVP_CIPH_CUSTOM_KEY_LENGTH) - return EVP_CIPHER_CTX_ctrl(c, EVP_CTRL_SET_KEY_LENGTH, - keylen, NULL); - if (c->key_len == keylen) - return 1; - if (keylen > 0 && (c->cipher->flags & EVP_CIPH_VARIABLE_LENGTH)) { - c->key_len = keylen; - return 1; - } - EVPerror(EVP_R_INVALID_KEY_LENGTH); - return 0; -} - -int -EVP_CIPHER_CTX_set_padding(EVP_CIPHER_CTX *ctx, int pad) -{ - if (pad) - ctx->flags &= ~EVP_CIPH_NO_PADDING; - else - ctx->flags |= EVP_CIPH_NO_PADDING; - return 1; -} - int EVP_CIPHER_CTX_ctrl(EVP_CIPHER_CTX *ctx, int type, int arg, void *ptr) { @@ -739,136 +713,9 @@ EVP_CIPHER_CTX_copy(EVP_CIPHER_CTX *out, const EVP_CIPHER_CTX *in) return 1; } -int -EVP_CIPHER_param_to_asn1(EVP_CIPHER_CTX *c, ASN1_TYPE *type) -{ - int ret; - - if (c->cipher->set_asn1_parameters != NULL) - ret = c->cipher->set_asn1_parameters(c, type); - else if (c->cipher->flags & EVP_CIPH_FLAG_DEFAULT_ASN1) - ret = EVP_CIPHER_set_asn1_iv(c, type); - else - ret = -1; - return (ret); -} - -int -EVP_CIPHER_asn1_to_param(EVP_CIPHER_CTX *c, ASN1_TYPE *type) -{ - int ret; - - if (c->cipher->get_asn1_parameters != NULL) - ret = c->cipher->get_asn1_parameters(c, type); - else if (c->cipher->flags & EVP_CIPH_FLAG_DEFAULT_ASN1) - ret = EVP_CIPHER_get_asn1_iv(c, type); - else - ret = -1; - return (ret); -} - -int -EVP_CIPHER_get_asn1_iv(EVP_CIPHER_CTX *c, ASN1_TYPE *type) -{ - int i = 0; - int l; - - if (type != NULL) { - l = EVP_CIPHER_CTX_iv_length(c); - if (l < 0 || l > sizeof(c->iv)) { - EVPerror(EVP_R_IV_TOO_LARGE); - return 0; - } - i = ASN1_TYPE_get_octetstring(type, c->oiv, l); - if (i != l) - return (-1); - else if (i > 0) - memcpy(c->iv, c->oiv, l); - } - return (i); -} - -int -EVP_CIPHER_set_asn1_iv(EVP_CIPHER_CTX *c, ASN1_TYPE *type) -{ - int i = 0; - int j; - - if (type != NULL) { - j = EVP_CIPHER_CTX_iv_length(c); - if (j < 0 || j > sizeof(c->iv)) { - EVPerror(EVP_R_IV_TOO_LARGE); - return 0; - } - i = ASN1_TYPE_set_octetstring(type, c->oiv, j); - } - return (i); -} - -/* Convert the various cipher NIDs and dummies to a proper OID NID */ -int -EVP_CIPHER_type(const EVP_CIPHER *ctx) -{ - int nid; - ASN1_OBJECT *otmp; - nid = EVP_CIPHER_nid(ctx); - - switch (nid) { - case NID_rc2_cbc: - case NID_rc2_64_cbc: - case NID_rc2_40_cbc: - return NID_rc2_cbc; - - case NID_rc4: - case NID_rc4_40: - return NID_rc4; - - case NID_aes_128_cfb128: - case NID_aes_128_cfb8: - case NID_aes_128_cfb1: - return NID_aes_128_cfb128; - - case NID_aes_192_cfb128: - case NID_aes_192_cfb8: - case NID_aes_192_cfb1: - return NID_aes_192_cfb128; - - case NID_aes_256_cfb128: - case NID_aes_256_cfb8: - case NID_aes_256_cfb1: - return NID_aes_256_cfb128; - - case NID_des_cfb64: - case NID_des_cfb8: - case NID_des_cfb1: - return NID_des_cfb64; - - case NID_des_ede3_cfb64: - case NID_des_ede3_cfb8: - case NID_des_ede3_cfb1: - return NID_des_cfb64; - - default: - /* Check it has an OID and it is valid */ - otmp = OBJ_nid2obj(nid); - if (!otmp || !otmp->data) - nid = NID_undef; - ASN1_OBJECT_free(otmp); - return nid; - } -} - -int -EVP_CIPHER_block_size(const EVP_CIPHER *e) -{ - return e->block_size; -} - -int -EVP_CIPHER_CTX_block_size(const EVP_CIPHER_CTX *ctx) -{ - return ctx->cipher->block_size; -} +/* + * EVP_CIPHER_CTX accessors. + */ const EVP_CIPHER * EVP_CIPHER_CTX_cipher(const EVP_CIPHER_CTX *ctx) @@ -882,102 +729,6 @@ EVP_CIPHER_CTX_encrypting(const EVP_CIPHER_CTX *ctx) return ctx->encrypt; } -unsigned long -EVP_CIPHER_flags(const EVP_CIPHER *cipher) -{ - return cipher->flags; -} - -unsigned long -EVP_CIPHER_CTX_flags(const EVP_CIPHER_CTX *ctx) -{ - return ctx->cipher->flags; -} - -void * -EVP_CIPHER_CTX_get_app_data(const EVP_CIPHER_CTX *ctx) -{ - return ctx->app_data; -} - -void -EVP_CIPHER_CTX_set_app_data(EVP_CIPHER_CTX *ctx, void *data) -{ - ctx->app_data = data; -} - -void * -EVP_CIPHER_CTX_get_cipher_data(const EVP_CIPHER_CTX *ctx) -{ - return ctx->cipher_data; -} - -void * -EVP_CIPHER_CTX_set_cipher_data(EVP_CIPHER_CTX *ctx, void *cipher_data) -{ - void *old_cipher_data; - - old_cipher_data = ctx->cipher_data; - ctx->cipher_data = cipher_data; - - return old_cipher_data; -} - -int -EVP_CIPHER_iv_length(const EVP_CIPHER *cipher) -{ - return cipher->iv_len; -} - -int -EVP_CIPHER_CTX_iv_length(const EVP_CIPHER_CTX *ctx) -{ - int iv_length = 0; - - if ((ctx->cipher->flags & EVP_CIPH_FLAG_CUSTOM_IV_LENGTH) == 0) - return ctx->cipher->iv_len; - - /* - * XXX - sanity would suggest to pass the size of the pointer along, - * but unfortunately we have to match the other crowd. - */ - if (EVP_CIPHER_CTX_ctrl((EVP_CIPHER_CTX *)ctx, EVP_CTRL_GET_IVLEN, 0, - &iv_length) != 1) - return -1; - - return iv_length; -} - -unsigned char * -EVP_CIPHER_CTX_buf_noconst(EVP_CIPHER_CTX *ctx) -{ - return ctx->buf; -} - -int -EVP_CIPHER_key_length(const EVP_CIPHER *cipher) -{ - return cipher->key_len; -} - -int -EVP_CIPHER_CTX_key_length(const EVP_CIPHER_CTX *ctx) -{ - return ctx->key_len; -} - -int -EVP_CIPHER_nid(const EVP_CIPHER *cipher) -{ - return cipher->nid; -} - -int -EVP_CIPHER_CTX_nid(const EVP_CIPHER_CTX *ctx) -{ - return ctx->cipher->nid; -} - int EVP_CIPHER_CTX_get_iv(const EVP_CIPHER_CTX *ctx, unsigned char *iv, size_t len) { @@ -1016,6 +767,57 @@ EVP_CIPHER_CTX_set_iv(EVP_CIPHER_CTX *ctx, const unsigned char *iv, size_t len) return 1; } +unsigned char * +EVP_CIPHER_CTX_buf_noconst(EVP_CIPHER_CTX *ctx) +{ + return ctx->buf; +} + +void * +EVP_CIPHER_CTX_get_app_data(const EVP_CIPHER_CTX *ctx) +{ + return ctx->app_data; +} + +void +EVP_CIPHER_CTX_set_app_data(EVP_CIPHER_CTX *ctx, void *data) +{ + ctx->app_data = data; +} + +int +EVP_CIPHER_CTX_key_length(const EVP_CIPHER_CTX *ctx) +{ + return ctx->key_len; +} + +int +EVP_CIPHER_CTX_set_key_length(EVP_CIPHER_CTX *ctx, int key_len) +{ + /* XXX - remove this. It's unused. */ + if (ctx->cipher->flags & EVP_CIPH_CUSTOM_KEY_LENGTH) + return EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_SET_KEY_LENGTH, + key_len, NULL); + if (ctx->key_len == key_len) + return 1; + if (key_len > 0 && (ctx->cipher->flags & EVP_CIPH_VARIABLE_LENGTH)) { + ctx->key_len = key_len; + return 1; + } + EVPerror(EVP_R_INVALID_KEY_LENGTH); + return 0; +} + +int +EVP_CIPHER_CTX_set_padding(EVP_CIPHER_CTX *ctx, int pad) +{ + if (pad) + ctx->flags &= ~EVP_CIPH_NO_PADDING; + else + ctx->flags |= EVP_CIPH_NO_PADDING; + return 1; +} + void EVP_CIPHER_CTX_set_flags(EVP_CIPHER_CTX *ctx, int flags) { @@ -1034,6 +836,218 @@ EVP_CIPHER_CTX_test_flags(const EVP_CIPHER_CTX *ctx, int flags) return (ctx->flags & flags); } +void * +EVP_CIPHER_CTX_get_cipher_data(const EVP_CIPHER_CTX *ctx) +{ + return ctx->cipher_data; +} + +void * +EVP_CIPHER_CTX_set_cipher_data(EVP_CIPHER_CTX *ctx, void *cipher_data) +{ + void *old_cipher_data; + + old_cipher_data = ctx->cipher_data; + ctx->cipher_data = cipher_data; + + return old_cipher_data; +} + +/* + * EVP_CIPHER_CTX getters that reach into the cipher attached to the context. + */ + +int +EVP_CIPHER_CTX_nid(const EVP_CIPHER_CTX *ctx) +{ + return ctx->cipher->nid; +} + +int +EVP_CIPHER_CTX_block_size(const EVP_CIPHER_CTX *ctx) +{ + return ctx->cipher->block_size; +} + +int +EVP_CIPHER_CTX_iv_length(const EVP_CIPHER_CTX *ctx) +{ + int iv_length = 0; + + if ((ctx->cipher->flags & EVP_CIPH_FLAG_CUSTOM_IV_LENGTH) == 0) + return ctx->cipher->iv_len; + + /* + * XXX - sanity would suggest to pass the size of the pointer along, + * but unfortunately we have to match the other crowd. + */ + if (EVP_CIPHER_CTX_ctrl((EVP_CIPHER_CTX *)ctx, EVP_CTRL_GET_IVLEN, 0, + &iv_length) != 1) + return -1; + + return iv_length; +} + +unsigned long +EVP_CIPHER_CTX_flags(const EVP_CIPHER_CTX *ctx) +{ + return ctx->cipher->flags; +} + +/* + * Used by CMS and its predecessors. Only GOST and RC2 have a custom method. + */ + +int +EVP_CIPHER_param_to_asn1(EVP_CIPHER_CTX *ctx, ASN1_TYPE *type) +{ + if (ctx->cipher->set_asn1_parameters != NULL) + return ctx->cipher->set_asn1_parameters(ctx, type); + + if ((ctx->cipher->flags & EVP_CIPH_FLAG_DEFAULT_ASN1) != 0) + return EVP_CIPHER_set_asn1_iv(ctx, type); + + return -1; +} + +int +EVP_CIPHER_asn1_to_param(EVP_CIPHER_CTX *ctx, ASN1_TYPE *type) +{ + if (ctx->cipher->get_asn1_parameters != NULL) + return ctx->cipher->get_asn1_parameters(ctx, type); + + if ((ctx->cipher->flags & EVP_CIPH_FLAG_DEFAULT_ASN1) != 0) + return EVP_CIPHER_get_asn1_iv(ctx, type); + + return -1; +} + +int +EVP_CIPHER_get_asn1_iv(EVP_CIPHER_CTX *ctx, ASN1_TYPE *type) +{ + int i = 0; + int l; + + if (type != NULL) { + l = EVP_CIPHER_CTX_iv_length(ctx); + if (l < 0 || l > sizeof(ctx->iv)) { + EVPerror(EVP_R_IV_TOO_LARGE); + return 0; + } + i = ASN1_TYPE_get_octetstring(type, ctx->oiv, l); + if (i != l) + return (-1); + else if (i > 0) + memcpy(ctx->iv, ctx->oiv, l); + } + return (i); +} + +int +EVP_CIPHER_set_asn1_iv(EVP_CIPHER_CTX *ctx, ASN1_TYPE *type) +{ + int i = 0; + int j; + + if (type != NULL) { + j = EVP_CIPHER_CTX_iv_length(ctx); + if (j < 0 || j > sizeof(ctx->iv)) { + EVPerror(EVP_R_IV_TOO_LARGE); + return 0; + } + i = ASN1_TYPE_set_octetstring(type, ctx->oiv, j); + } + return (i); +} + +/* Convert the various cipher NIDs and dummies to a proper OID NID */ +int +EVP_CIPHER_type(const EVP_CIPHER *cipher) +{ + ASN1_OBJECT *aobj; + int nid; + + nid = EVP_CIPHER_nid(cipher); + switch (nid) { + case NID_rc2_cbc: + case NID_rc2_64_cbc: + case NID_rc2_40_cbc: + return NID_rc2_cbc; + + case NID_rc4: + case NID_rc4_40: + return NID_rc4; + + case NID_aes_128_cfb128: + case NID_aes_128_cfb8: + case NID_aes_128_cfb1: + return NID_aes_128_cfb128; + + case NID_aes_192_cfb128: + case NID_aes_192_cfb8: + case NID_aes_192_cfb1: + return NID_aes_192_cfb128; + + case NID_aes_256_cfb128: + case NID_aes_256_cfb8: + case NID_aes_256_cfb1: + return NID_aes_256_cfb128; + + case NID_des_cfb64: + case NID_des_cfb8: + case NID_des_cfb1: + return NID_des_cfb64; + + case NID_des_ede3_cfb64: + case NID_des_ede3_cfb8: + case NID_des_ede3_cfb1: + return NID_des_cfb64; + + default: + /* Check it has an OID and it is valid */ + if (((aobj = OBJ_nid2obj(nid)) == NULL) || aobj->data == NULL) + nid = NID_undef; + + ASN1_OBJECT_free(aobj); + + return nid; + } +} + +/* + * Accessors. First the trivial getters, then the setters for the method API. + */ + +int +EVP_CIPHER_nid(const EVP_CIPHER *cipher) +{ + return cipher->nid; +} + +int +EVP_CIPHER_block_size(const EVP_CIPHER *cipher) +{ + return cipher->block_size; +} + +int +EVP_CIPHER_key_length(const EVP_CIPHER *cipher) +{ + return cipher->key_len; +} + +int +EVP_CIPHER_iv_length(const EVP_CIPHER *cipher) +{ + return cipher->iv_len; +} + +unsigned long +EVP_CIPHER_flags(const EVP_CIPHER *cipher) +{ + return cipher->flags; +} + EVP_CIPHER * EVP_CIPHER_meth_new(int cipher_type, int block_size, int key_len) { diff --git a/regress/sys/netinet/bindconnect/Makefile b/regress/sys/netinet/bindconnect/Makefile index e2cb3295e..50e126121 100644 --- a/regress/sys/netinet/bindconnect/Makefile +++ b/regress/sys/netinet/bindconnect/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.3 2023/12/07 23:47:48 bluhm Exp $ +# $OpenBSD: Makefile,v 1.4 2024/01/02 15:06:48 bluhm Exp $ PROG= bindconnect LDADD= -lpthread @@ -10,8 +10,6 @@ CLEANFILES= ktrace.out LOCAL_NET ?= LOCAL_NET6 ?= -REGRESS_ROOT_TARGETS += setup-maxfiles run-100000 run-localnet-connect-delete - REGRESS_SETUP_ONCE += setup-maxfiles setup-maxfiles: [[ $$(sysctl -n kern.maxfiles) -ge 110000 ]] || \ @@ -35,52 +33,64 @@ cleanup-${af}-delete: -${SUDO} time ./${PROG} \ -f ${af} -s 0 -o 0 -b 0 -c 0 -d 1 -N ${NET_${af}} -t 1 -REGRESS_TARGETS += run-${af}-bind -run-${af}-bind: - time ${KTRACE} ./${PROG} \ - -f ${af} -n 16 -s 2 -o 1 -b 6 -c 0 +.for proto in udp tcp any -REGRESS_TARGETS += run-${af}-connect -run-${af}-connect: - time ${KTRACE} ./${PROG} \ - -f ${af} -n 16 -s 2 -o 1 -b 0 -c 6 - -REGRESS_TARGETS += run-${af}-bind-connect -run-${af}-bind-connect: - time ${KTRACE} ./${PROG} \ - -f ${af} -n 16 -s 2 -o 1 -b 3 -c 3 - -REGRESS_TARGETS += run-${af}-100000 -run-${af}-100000: - ${SUDO} time ${KTRACE} ./${PROG} \ - -f ${af} -n 100000 -s 2 -o 1 -b 3 -c 3 - -REGRESS_TARGETS += run-${af}-reuseport -run-${af}-reuseport: - time ${KTRACE} ./${PROG} \ - -f ${af} -n 16 -s 2 -o 1 -b 3 -c 3 -r - -.if empty(NET_${af}) -REGRESS_SKIP_TARGETS += run-${af}-localnet-connect \ - run-${af}-localnet-bind-connect \ - run-${af}-localnet-connect-delete +.if "${proto}" != udp && "${proto}" != tcp +SUDO_${proto} = ${SUDO} +.else +SUDO_${proto} = .endif -REGRESS_TARGETS += run-${af}-localnet-connect -run-${af}-localnet-connect: - time ${KTRACE} ./${PROG} \ - -f ${af} -n 16 -s 2 -o 1 -c 6 -N ${NET_${af}} +REGRESS_TARGETS += run-${af}-${proto}-bind +run-${af}-${proto}-bind: + ${SUDO_${proto}} time ${KTRACE} ./${PROG} \ + -f ${af} -p ${proto} -n 16 -s 2 -o 1 -b 6 -c 0 -REGRESS_TARGETS += run-${af}-localnet-bind-connect -run-${af}-localnet-bind-connect: - time ${KTRACE} ./${PROG} \ - -f ${af} -n 16 -s 2 -o 1 -b 3 -c 3 -N ${NET_${af}} +REGRESS_TARGETS += run-${af}-${proto}-connect +run-${af}-${proto}-connect: + ${SUDO_${proto}} time ${KTRACE} ./${PROG} \ + -f ${af} -p ${proto} -n 16 -s 2 -o 1 -b 0 -c 6 -REGRESS_TARGETS += run-${af}-localnet-connect-delete -run-${af}-localnet-connect-delete: +REGRESS_TARGETS += run-${af}-${proto}-bind-connect +run-${af}-${proto}-bind-connect: + ${SUDO_${proto}} time ${KTRACE} ./${PROG} \ + -f ${af} -p ${proto} -n 16 -s 2 -o 1 -b 3 -c 3 + +REGRESS_TARGETS += run-${af}-${proto}-100000 +run-${af}-${proto}-100000: ${SUDO} time ${KTRACE} ./${PROG} \ - -f ${af} -n 16 -s 2 -o 1 -b 0 -c 6 -d 3 -N ${NET_${af}} + -f ${af} -p ${proto} -n 100000 -s 2 -o 1 -b 3 -c 3 + +REGRESS_TARGETS += run-${af}-${proto}-reuseport +run-${af}-${proto}-reuseport: + ${SUDO_${proto}} time ${KTRACE} ./${PROG} \ + -f ${af} -p ${proto} -n 16 -s 2 -o 1 -b 3 -c 3 -r + +.if empty(NET_${af}) +REGRESS_SKIP_TARGETS += run-${af}-${proto}-localnet-connect \ + run-${af}-${proto}-localnet-bind-connect \ + run-${af}-${proto}-localnet-connect-delete +.endif + +REGRESS_TARGETS += run-${af}-${proto}-localnet-connect +run-${af}-${proto}-localnet-connect: + ${SUDO_${proto}} time ${KTRACE} ./${PROG} \ + -f ${af} -p ${proto} -n 16 -s 2 -o 1 -c 6 -N ${NET_${af}} + +REGRESS_TARGETS += run-${af}-${proto}-localnet-bind-connect +run-${af}-${proto}-localnet-bind-connect: + ${SUDO_${proto}} time ${KTRACE} ./${PROG} \ + -f ${af} -p ${proto} -n 16 -s 2 -o 1 -b 3 -c 3 -N ${NET_${af}} + +REGRESS_TARGETS += run-${af}-${proto}-localnet-connect-delete +run-${af}-${proto}-localnet-connect-delete: + ${SUDO} time ${KTRACE} ./${PROG} \ + -f ${af} -p ${proto} -n 16 -s 2 -o 1 -b 0 -c 6 -d 3 -N ${NET_${af}} .endfor +.endfor + +REGRESS_ROOT_TARGETS += setup-maxfiles run-100000 run-localnet-connect-delete +REGRESS_ROOT_TARGETS += ${REGRESS_TARGETS:N*-udp-*:N*-tcp-*} .include diff --git a/regress/sys/netinet/bindconnect/bindconnect.c b/regress/sys/netinet/bindconnect/bindconnect.c index 7ed5eaf12..f2830e91d 100644 --- a/regress/sys/netinet/bindconnect/bindconnect.c +++ b/regress/sys/netinet/bindconnect/bindconnect.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bindconnect.c,v 1.3 2023/12/07 23:47:48 bluhm Exp $ */ +/* $OpenBSD: bindconnect.c,v 1.4 2024/01/02 15:06:48 bluhm Exp $ */ /* * Copyright (c) 2023 Alexander Bluhm @@ -25,13 +25,14 @@ #include #include +#include #include #include #include #include #include -#define MAX(a, b) ((a) > (b) ? (a) : (b)) +#define MAXIMUM(a, b) ((a) > (b) ? (a) : (b)) #define s6_addr8 __u6_addr.__u6_addr8 #define s6_addr16 __u6_addr.__u6_addr16 @@ -54,27 +55,28 @@ unsigned int run_time = 10; unsigned int socket_num = 1, close_num = 1, bind_num = 1, connect_num = 1, delroute_num = 0; int reuse_port = 0; -const char *family = "inet"; union inaddr_union addr, mask; -int af, prefix = -1, route_sock = -1; +int af = AF_INET, type, proto = IPPROTO_UDP, prefix = -1, route_sock = -1; static void __dead usage(void) { fprintf(stderr, "bindconnect [-r] [-b bind] [-c connect] [-d delroute]\n" - "[-N addr/net] [-n num] [-o close] [-s socket] [-t time]\n" + "[-f family] [-N addr/net] [-n num] [-o close] [-s socket]\n" + "[-t time]\n" " -b bind threads binding sockets, default %u\n" " -c connect threads connecting sockets, default %u\n" " -d delroute threads deleting cloned routes, default %u\n" - " -f family address family inet or inet6, default %s\n" + " -f family address family inet or inet6, default inet\n" " -N addr/net connect to any address within network\n" " -n num number of file descriptors, default %u\n" " -o close threads closing sockets, default %u\n" + " -p proto protocol udp, tcp, name or number, default udp\n" " -r set reuse port socket option\n" " -s socket threads creating sockets, default %u\n" " -t time run time in seconds, default %u\n", - bind_num, connect_num, delroute_num, family, fd_num, close_num, + bind_num, connect_num, delroute_num, fd_num, close_num, socket_num, run_time); exit(2); } @@ -164,7 +166,7 @@ thread_socket(void *arg) for (count = 0; *run; count++) { int opt; - fd = socket(af, SOCK_DGRAM, IPPROTO_UDP); + fd = socket(af, type | SOCK_NONBLOCK, proto); if (fd < 0 || !reuse_port) continue; opt = 1; @@ -286,6 +288,7 @@ int main(int argc, char *argv[]) { struct rlimit rlim; + struct protoent *pent; pthread_t *tsocket, *tclose, *tbind, *tconnect, *tdelroute; const char *errstr, *addr_net = NULL; char buf[128], *p; @@ -295,7 +298,7 @@ main(int argc, char *argv[]) delroute_count; union sockaddr_union su; - while ((ch = getopt(argc, argv, "b:c:d:f:N:n:o:rs:t:")) != -1) { + while ((ch = getopt(argc, argv, "b:c:d:f:N:n:o:p:rs:t:")) != -1) { switch (ch) { case 'b': bind_num = strtonum(optarg, 0, UINT_MAX, &errstr); @@ -313,7 +316,12 @@ main(int argc, char *argv[]) errx(1, "delroute is %s: %s", errstr, optarg); break; case 'f': - family = optarg; + if (strcmp(optarg, "inet") == 0) + af = AF_INET; + else if (strcmp(optarg, "inet6") == 0) + af = AF_INET6; + else + errx(1, "bad address family %s", optarg); break; case 'N': addr_net = optarg; @@ -328,6 +336,16 @@ main(int argc, char *argv[]) if (errstr != NULL) errx(1, "close is %s: %s", errstr, optarg); break; + case 'p': + pent = getprotobyname(optarg); + if (pent != NULL) { + proto = pent->p_proto; + break; + } + proto = strtonum(optarg, 0, IPPROTO_MAX -1 , &errstr); + if (errstr != NULL) + errx(1, "proto is %s: %s", errstr, optarg); + break; case 'r': reuse_port = 1; break; @@ -350,13 +368,6 @@ main(int argc, char *argv[]) if (argc > 0) usage(); - if (strcmp(family, "inet") == 0) - af = AF_INET; - else if (strcmp(family, "inet6") == 0) - af = AF_INET6; - else - errx(1, "bad address family %s", family); - /* split addr/net into addr, mask, prefix */ if (addr_net != NULL) { prefix = inet_net_pton(af, addr_net, &addr, sizeof(addr)); @@ -394,7 +405,18 @@ main(int argc, char *argv[]) } /* detect lowest file desciptor, test bind, close everything above */ - fd_base = socket(af, SOCK_DGRAM, IPPROTO_UDP); + switch (proto) { + case IPPROTO_TCP: + type = SOCK_STREAM; + break; + case IPPROTO_UDP: + type = SOCK_DGRAM; + break; + default: + type = SOCK_RAW; + break; + } + fd_base = socket(af, type, proto); if (fd_base < 0) err(1, "socket fd_base"); if (fd_base > INT_MAX - (int)fd_num) @@ -407,7 +429,7 @@ main(int argc, char *argv[]) if (getrlimit(RLIMIT_NOFILE, &rlim) < 0) err(1, "getrlimit"); - rlim.rlim_max = MAX(rlim.rlim_max, fd_base + fd_num); + rlim.rlim_max = MAXIMUM(rlim.rlim_max, fd_base + fd_num); rlim.rlim_cur = fd_base + fd_num; if (setrlimit(RLIMIT_NOFILE, &rlim) < 0) err(1, "setrlimit %llu", rlim.rlim_cur); diff --git a/share/zoneinfo/datfiles/africa b/share/zoneinfo/datfiles/africa index e6b5f9313..aae8bf6b9 100644 --- a/share/zoneinfo/datfiles/africa +++ b/share/zoneinfo/datfiles/africa @@ -1,4 +1,4 @@ -# $OpenBSD: africa,v 1.73 2023/03/23 16:12:10 millert Exp $ +# $OpenBSD: africa,v 1.74 2024/01/02 22:43:20 millert Exp $ # tzdb data for Africa and environs # This file is in the public domain, so clarified as of @@ -341,13 +341,6 @@ Rule Egypt 2007 only - Sep Thu>=1 24:00 0 - # reproduced by other (more accessible) sites[, e.g.,]... # http://elgornal.net/news/news.aspx?id=4699258 -# From Paul Eggert (2014-06-04): -# Sarah El Deeb and Lee Keath of AP report that the Egyptian government says -# the change is because of blackouts in Cairo, even though Ahram Online (cited -# above) says DST had no affect on electricity consumption. There is -# no information about when DST will end this fall. See: -# http://abcnews.go.com/International/wireStory/el-sissi-pushes-egyptians-line-23614833 - # From Steffen Thorsen (2015-04-08): # Egypt will start DST on midnight after Thursday, April 30, 2015. # This is based on a law (no 35) from May 15, 2014 saying it starts the last diff --git a/share/zoneinfo/datfiles/antarctica b/share/zoneinfo/datfiles/antarctica index a3564cb35..d64ecaf16 100644 --- a/share/zoneinfo/datfiles/antarctica +++ b/share/zoneinfo/datfiles/antarctica @@ -1,4 +1,4 @@ -# $OpenBSD: antarctica,v 1.47 2023/03/23 16:12:10 millert Exp $ +# $OpenBSD: antarctica,v 1.48 2024/01/02 22:43:20 millert Exp $ # tzdb data for Antarctica and environs # This file is in the public domain, so clarified as of @@ -81,6 +81,11 @@ # - 2018 Oct 7 4:00 - 2019 Mar 17 3:00 - 2019 Oct 4 3:00 - 2020 Mar 8 3:00 # and now - 2020 Oct 4 0:01 +# From Paul Eggert (2023-12-20): +# Transitions from 2021 on are taken from: +# https://www.timeanddate.com/time/zone/antarctica/casey +# retrieved at various dates. + # Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Antarctica/Casey 0 - -00 1969 8:00 - +08 2009 Oct 18 2:00 @@ -94,7 +99,12 @@ Zone Antarctica/Casey 0 - -00 1969 8:00 - +08 2019 Oct 4 3:00 11:00 - +11 2020 Mar 8 3:00 8:00 - +08 2020 Oct 4 0:01 - 11:00 - +11 + 11:00 - +11 2021 Mar 14 0:00 + 8:00 - +08 2021 Oct 3 0:01 + 11:00 - +11 2022 Mar 13 0:00 + 8:00 - +08 2022 Oct 2 0:01 + 11:00 - +11 2023 Mar 9 3:00 + 8:00 - +08 Zone Antarctica/Davis 0 - -00 1957 Jan 13 7:00 - +07 1964 Nov 0 - -00 1969 Feb @@ -254,9 +264,50 @@ Zone Antarctica/Troll 0 - -00 2005 Feb 12 # year-round from 1960/61 to 1992 # Vostok, since 1957-12-16, temporarily closed 1994-02/1994-11 +# From Craig Mundell (1994-12-15): +# http://quest.arc.nasa.gov/antarctica/QA/computers/Directions,Time,ZIP +# Vostok, which is one of the Russian stations, is set on the same +# time as Moscow, Russia. +# +# From Lee Hotz (2001-03-08): +# I queried the folks at Columbia who spent the summer at Vostok and this is +# what they had to say about time there: +# "in the US Camp (East Camp) we have been on New Zealand (McMurdo) +# time, which is 12 hours ahead of GMT. The Russian Station Vostok was +# 6 hours behind that (although only 2 miles away, i.e. 6 hours ahead +# of GMT). This is a time zone I think two hours east of Moscow. The +# natural time zone is in between the two: 8 hours ahead of GMT." +# +# From Paul Eggert (2001-05-04): +# This seems to be hopelessly confusing, so I asked Lee Hotz about it +# in person. He said that some Antarctic locations set their local +# time so that noon is the warmest part of the day, and that this +# changes during the year and does not necessarily correspond to mean +# solar noon. So the Vostok time might have been whatever the clocks +# happened to be during their visit. So we still don't really know what time +# it is at Vostok. +# +# From Zakhary V. Akulov (2023-12-17 22:00:48 +0700): +# ... from December, 18, 2023 00:00 by my decision the local time of +# the Antarctic research base Vostok will correspond to UTC+5. +# (2023-12-19): We constantly interact with Progress base, with company who +# builds new wintering station, with sledge convoys, with aviation - they all +# use UTC+5. Besides, difference between Moscow time is just 2 hours now, not 4. +# (2023-12-19, in response to the question "Has local time at Vostok +# been UTC+6 ever since 1957, or has it changed before?"): No. At least +# since my antarctic career start, 10 years ago, Vostok base has UTC+7. +# (In response to a 2023-12-18 question "from 02:00 to 00:00 today"): This. +# +# From Paul Eggert (2023-12-18): +# For lack of better info, guess Vostok was at +07 from founding through today, +# except when closed. + # Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Antarctica/Vostok 0 - -00 1957 Dec 16 - 6:00 - +06 + 7:00 - +07 1994 Feb + 0 - -00 1994 Nov + 7:00 - +07 2023 Dec 18 2:00 + 5:00 - +05 # S Africa - year-round bases # Marion Island, -4653+03752 diff --git a/share/zoneinfo/datfiles/asia b/share/zoneinfo/datfiles/asia index 3a3584317..f25472ce5 100644 --- a/share/zoneinfo/datfiles/asia +++ b/share/zoneinfo/datfiles/asia @@ -1,4 +1,4 @@ -# $OpenBSD: asia,v 1.107 2023/03/28 23:07:46 millert Exp $ +# $OpenBSD: asia,v 1.108 2024/01/02 22:43:20 millert Exp $ # tzdb data for Asia and environs # This file is in the public domain, so clarified as of @@ -677,7 +677,6 @@ Zone Asia/Shanghai 8:05:43 - LMT 1901 8:00 PRC C%sT # Xinjiang time, used by many in western China; represented by Ürümqi / Ürümchi # / Wulumuqi. (Please use Asia/Shanghai if you prefer Beijing time.) -# Vostok base in Antarctica matches this since 1970. Zone Asia/Urumqi 5:50:20 - LMT 1928 6:00 - +06 @@ -3478,6 +3477,9 @@ Zone Asia/Karachi 4:28:12 - LMT 1907 # From Heba Hamad (2023-03-22): # ... summer time will begin in Palestine from Saturday 04-29-2023, # 02:00 AM by 60 minutes forward. +# From Heba Hemad (2023-10-09): +# ... winter time will begin in Palestine from Saturday 10-28-2023, +# 02:00 AM by 60 minutes back. # # From Paul Eggert (2023-03-22): # For now, guess that spring and fall transitions will normally @@ -3599,13 +3601,13 @@ Rule Palestine 2070 only - Oct 4 2:00 0 - Rule Palestine 2071 only - Sep 19 2:00 0 - Rule Palestine 2072 only - Sep 10 2:00 0 - Rule Palestine 2072 only - Oct 15 2:00 1:00 S +Rule Palestine 2072 max - Oct Sat<=30 2:00 0 - Rule Palestine 2073 only - Sep 2 2:00 0 - Rule Palestine 2073 only - Oct 7 2:00 1:00 S Rule Palestine 2074 only - Aug 18 2:00 0 - Rule Palestine 2074 only - Sep 29 2:00 1:00 S Rule Palestine 2075 only - Aug 10 2:00 0 - Rule Palestine 2075 only - Sep 14 2:00 1:00 S -Rule Palestine 2075 max - Oct Sat<=30 2:00 0 - Rule Palestine 2076 only - Jul 25 2:00 0 - Rule Palestine 2076 only - Sep 5 2:00 1:00 S Rule Palestine 2077 only - Jul 17 2:00 0 - diff --git a/share/zoneinfo/datfiles/australasia b/share/zoneinfo/datfiles/australasia index 1a004b42b..eab7e3c97 100644 --- a/share/zoneinfo/datfiles/australasia +++ b/share/zoneinfo/datfiles/australasia @@ -1,4 +1,4 @@ -# $OpenBSD: australasia,v 1.77 2023/03/23 16:12:10 millert Exp $ +# $OpenBSD: australasia,v 1.78 2024/01/02 22:43:20 millert Exp $ # tzdb data for Australasia and environs, and for much of the Pacific # This file is in the public domain, so clarified as of @@ -402,8 +402,14 @@ Zone Indian/Cocos 6:27:40 - LMT 1900 # Please note that there will not be any daylight savings time change # in Fiji for 2022-2023.... # https://www.facebook.com/FijianGovernment/posts/pfbid0mmWVTYmTibn66ybpFda75pDcf34SSpoSaskJW5gXwaKo5Sgc7273Q4fXWc6kQV6Hl + +# From Almaz Mingaleev (2023-10-06): +# Cabinet approved the suspension of Daylight Saving and appropriate +# legislative changes will be considered including the repeal of the +# Daylight Saving Act 1998 +# https://www.fiji.gov.fj/Media-Centre/Speeches/English/CABINET-DECISIONS-3-OCTOBER-2023 # -# From Paul Eggert (2022-10-27): +# From Paul Eggert (2023-10-06): # For now, assume DST is suspended indefinitely. # Rule NAME FROM TO - IN ON AT SAVE LETTER/S diff --git a/share/zoneinfo/datfiles/europe b/share/zoneinfo/datfiles/europe index 63f23b0e0..16c11c78d 100644 --- a/share/zoneinfo/datfiles/europe +++ b/share/zoneinfo/datfiles/europe @@ -1,4 +1,4 @@ -# $OpenBSD: europe,v 1.90 2023/03/23 16:12:10 millert Exp $ +# $OpenBSD: europe,v 1.91 2024/01/02 22:43:20 millert Exp $ # tzdb data for Europe and environs # This file is in the public domain, so clarified as of @@ -1185,6 +1185,23 @@ Zone Atlantic/Faroe -0:27:04 - LMT 1908 Jan 11 # Tórshavn # 2. The shift *from* DST in 2023 happens as normal, but coincides with the # shift to UTC-02 normaltime (people will not change their clocks here). # 3. After this, DST is still observed, but as -02/-01 instead of -03/-02. +# +# From Múte Bourup Egede via Jógvan Svabo Samuelsen (2023-03-15): +# Greenland will not switch to Daylight Saving Time this year, 2023, +# because the standard time for Greenland will change from UTC -3 to UTC -2. +# However, Greenland will change to Daylight Saving Time again in 2024 +# and onwards. + +# From a contributor who wishes to remain anonymous for now (2023-10-29): +# https://www.dr.dk/nyheder/seneste/i-nat-skal-uret-stilles-en-time-tilbage-men-foerste-gang-sker-det-ikke-i-groenland +# with a link to that page: +# https://naalakkersuisut.gl/Nyheder/2023/10/2710_sommertid +# ... Ittoqqortoormiit joins the time of Nuuk at March 2024. +# What would mean that America/Scoresbysund would either be in -01 year round +# or in -02/-01 like America/Nuuk, but no longer in -01/+00. +# +# From Paul Eggert (2023-10-29): +# For now, assume it will be like America/Nuuk. # Rule NAME FROM TO - IN ON AT SAVE LETTER/S Rule Thule 1991 1992 - Mar lastSun 2:00 1:00 D @@ -1205,10 +1222,12 @@ Zone America/Danmarkshavn -1:14:40 - LMT 1916 Jul 28 Zone America/Scoresbysund -1:27:52 - LMT 1916 Jul 28 # Ittoqqortoormiit -2:00 - -02 1980 Apr 6 2:00 -2:00 C-Eur -02/-01 1981 Mar 29 - -1:00 EU -01/+00 + -1:00 EU -01/+00 2024 Mar 31 + -2:00 EU -02/-01 Zone America/Nuuk -3:26:56 - LMT 1916 Jul 28 # Godthåb -3:00 - -03 1980 Apr 6 2:00 - -3:00 EU -03/-02 2023 Oct 29 1:00u + -3:00 EU -03/-02 2023 Mar 26 1:00u + -2:00 - -02 2023 Oct 29 1:00u -2:00 EU -02/-01 Zone America/Thule -4:35:08 - LMT 1916 Jul 28 # Pituffik -4:00 Thule A%sT @@ -3929,11 +3948,7 @@ Zone Europe/Istanbul 1:55:52 - LMT 1880 # and not at 3:00 as would have been under EU rules. # This is why I have set the change to EU rules into May 1996, # so that the change in March is stil covered by the Ukraine rule. -# The next change in October 1996 happened under EU rules.... -# TZ database holds three other zones for Ukraine.... I have not yet -# worked out the consequences for these three zones, as we (me and my -# US colleague David Cochrane) are still trying to get more -# information upon these local deviations from Kiev rules. +# The next change in October 1996 happened under EU rules. # # From Paul Eggert (2022-08-27): # For now, assume that Ukraine's zones all followed the same rules, diff --git a/share/zoneinfo/datfiles/iso3166.tab b/share/zoneinfo/datfiles/iso3166.tab index e6d27b69b..4ea4c6cb8 100644 --- a/share/zoneinfo/datfiles/iso3166.tab +++ b/share/zoneinfo/datfiles/iso3166.tab @@ -1,20 +1,25 @@ -# $OpenBSD: iso3166.tab,v 1.31 2023/03/23 16:12:11 millert Exp $ +# $OpenBSD: iso3166.tab,v 1.32 2024/01/02 22:43:20 millert Exp $ # ISO 3166 alpha-2 country codes # # This file is in the public domain, so clarified as of # 2009-05-17 by Arthur David Olson. # -# From Paul Eggert (2022-11-18): +# From Paul Eggert (2023-09-06): # This file contains a table of two-letter country codes. Columns are # separated by a single tab. Lines beginning with '#' are comments. # All text uses UTF-8 encoding. The columns of the table are as follows: # # 1. ISO 3166-1 alpha-2 country code, current as of -# ISO 3166-1 N1087 (2022-09-02). See: Updates on ISO 3166-1 -# https://isotc.iso.org/livelink/livelink/Open/16944257 -# 2. The usual English name for the coded region, -# chosen so that alphabetic sorting of subsets produces helpful lists. -# This is not the same as the English name in the ISO 3166 tables. +# ISO/TC 46 N1108 (2023-04-05). See: ISO/TC 46 Documents +# https://www.iso.org/committee/48750.html?view=documents +# 2. The usual English name for the coded region. This sometimes +# departs from ISO-listed names, sometimes so that sorted subsets +# of names are useful (e.g., "Samoa (American)" and "Samoa +# (western)" rather than "American Samoa" and "Samoa"), +# sometimes to avoid confusion among non-experts (e.g., +# "Czech Republic" and "Turkey" rather than "Czechia" and "Türkiye"), +# and sometimes to omit needless detail or churn (e.g., "Netherlands" +# rather than "Netherlands (the)" or "Netherlands (Kingdom of the)"). # # The table is sorted by country code. # diff --git a/share/zoneinfo/datfiles/leap-seconds.list b/share/zoneinfo/datfiles/leap-seconds.list index c25034655..d7c2cc2b6 100644 --- a/share/zoneinfo/datfiles/leap-seconds.list +++ b/share/zoneinfo/datfiles/leap-seconds.list @@ -1,4 +1,4 @@ -# $OpenBSD: leap-seconds.list,v 1.1 2023/11/17 21:51:37 millert Exp $ +# $OpenBSD: leap-seconds.list,v 1.2 2024/01/02 22:43:20 millert Exp $ # # In the following text, the symbol '#' introduces # a comment, which continues from that symbol until @@ -205,10 +205,10 @@ # current -- the update time stamp, the data and the name of the file # will not change. # -# Updated through IERS Bulletin C65 -# File expires on: 28 December 2023 +# Updated through IERS Bulletin C66 +# File expires on: 28 June 2024 # -#@ 3912710400 +#@ 3928521600 # 2272060800 10 # 1 Jan 1972 2287785600 11 # 1 Jul 1972 @@ -253,4 +253,4 @@ # the hash line is also ignored in the # computation. # -#h e76a99dc 65f15cc7 e613e040 f5078b5e b23834fe +#h 16edd0f0 3666784f 37db6bdd e74ced87 59af48f1 diff --git a/share/zoneinfo/datfiles/northamerica b/share/zoneinfo/datfiles/northamerica index 564c88692..7d28a647c 100644 --- a/share/zoneinfo/datfiles/northamerica +++ b/share/zoneinfo/datfiles/northamerica @@ -1,4 +1,4 @@ -# $OpenBSD: northamerica,v 1.84 2023/03/23 16:12:11 millert Exp $ +# $OpenBSD: northamerica,v 1.85 2024/01/02 22:43:20 millert Exp $ # tzdb data for North and Central America and environs # This file is in the public domain, so clarified as of @@ -1454,7 +1454,7 @@ Rule StJohns 1989 2006 - Apr Sun>=1 0:01 1:00 D Rule StJohns 2007 2011 - Mar Sun>=8 0:01 1:00 D Rule StJohns 2007 2010 - Nov Sun>=1 0:01 0 S # -# St John's has an apostrophe, but Posix file names can't have apostrophes. +# St John's has an apostrophe, but POSIX file names can't have apostrophes. # Zone NAME STDOFF RULES FORMAT [UNTIL] Zone America/St_Johns -3:30:52 - LMT 1884 -3:30:52 StJohns N%sT 1918 diff --git a/share/zoneinfo/datfiles/southamerica b/share/zoneinfo/datfiles/southamerica index 576b182bb..77265ec32 100644 --- a/share/zoneinfo/datfiles/southamerica +++ b/share/zoneinfo/datfiles/southamerica @@ -1,4 +1,4 @@ -# $OpenBSD: southamerica,v 1.79 2023/03/23 16:12:11 millert Exp $ +# $OpenBSD: southamerica,v 1.80 2024/01/02 22:43:20 millert Exp $ # tzdb data for South America and environs # This file is in the public domain, so clarified as of @@ -1711,6 +1711,12 @@ Rule Para 2010 2012 - Apr Sun>=8 0:00 0 - # From Carlos Raúl Perasso (2014-02-28): # Decree 1264 can be found at: # http://www.presidencia.gov.py/archivos/documentos/DECRETO1264_ey9r8zai.pdf +# +# From Paul Eggert (2023-07-26): +# Transition dates are now set by Law No. 7115, not by presidential decree. +# https://www.abc.com.py/politica/2023/07/12/promulgacion-el-cambio-de-hora-sera-por-ley/ +# From Carlos Raúl Perasso (2023-07-27): +# http://silpy.congreso.gov.py/descarga/ley-144138 Rule Para 2013 max - Mar Sun>=22 0:00 0 - # Zone NAME STDOFF RULES FORMAT [UNTIL] diff --git a/share/zoneinfo/datfiles/zone.tab b/share/zoneinfo/datfiles/zone.tab index 7689ea868..59dd95213 100644 --- a/share/zoneinfo/datfiles/zone.tab +++ b/share/zoneinfo/datfiles/zone.tab @@ -1,4 +1,4 @@ -# $OpenBSD: zone.tab,v 1.75 2023/03/23 16:12:11 millert Exp $ +# $OpenBSD: zone.tab,v 1.76 2024/01/02 22:43:21 millert Exp $ # tzdb timezone descriptions (deprecated version) # # This file is in the public domain, so clarified as of @@ -49,7 +49,7 @@ AR -3124-06411 America/Argentina/Cordoba Argentina (most areas: CB, CC, CN, ER, AR -2447-06525 America/Argentina/Salta Salta (SA, LP, NQ, RN) AR -2411-06518 America/Argentina/Jujuy Jujuy (JY) AR -2649-06513 America/Argentina/Tucuman Tucuman (TM) -AR -2828-06547 America/Argentina/Catamarca Catamarca (CT); Chubut (CH) +AR -2828-06547 America/Argentina/Catamarca Catamarca (CT), Chubut (CH) AR -2926-06651 America/Argentina/La_Rioja La Rioja (LR) AR -3132-06831 America/Argentina/San_Juan San Juan (SJ) AR -3253-06849 America/Argentina/Mendoza Mendoza (MZ) @@ -88,7 +88,7 @@ BN +0456+11455 Asia/Brunei BO -1630-06809 America/La_Paz BQ +120903-0681636 America/Kralendijk BR -0351-03225 America/Noronha Atlantic islands -BR -0127-04829 America/Belem Para (east); Amapa +BR -0127-04829 America/Belem Para (east), Amapa BR -0343-03830 America/Fortaleza Brazil (northeast: MA, PI, CE, RN, PB) BR -0803-03454 America/Recife Pernambuco BR -0712-04812 America/Araguaina Tocantins @@ -108,21 +108,21 @@ BT +2728+08939 Asia/Thimphu BW -2439+02555 Africa/Gaborone BY +5354+02734 Europe/Minsk BZ +1730-08812 America/Belize -CA +4734-05243 America/St_Johns Newfoundland; Labrador (southeast) -CA +4439-06336 America/Halifax Atlantic - NS (most areas); PE +CA +4734-05243 America/St_Johns Newfoundland, Labrador (SE) +CA +4439-06336 America/Halifax Atlantic - NS (most areas), PE CA +4612-05957 America/Glace_Bay Atlantic - NS (Cape Breton) CA +4606-06447 America/Moncton Atlantic - New Brunswick CA +5320-06025 America/Goose_Bay Atlantic - Labrador (most areas) CA +5125-05707 America/Blanc-Sablon AST - QC (Lower North Shore) -CA +4339-07923 America/Toronto Eastern - ON, QC (most areas) +CA +4339-07923 America/Toronto Eastern - ON & QC (most areas) CA +6344-06828 America/Iqaluit Eastern - NU (most areas) -CA +484531-0913718 America/Atikokan EST - ON (Atikokan); NU (Coral H) -CA +4953-09709 America/Winnipeg Central - ON (west); Manitoba +CA +484531-0913718 America/Atikokan EST - ON (Atikokan), NU (Coral H) +CA +4953-09709 America/Winnipeg Central - ON (west), Manitoba CA +744144-0944945 America/Resolute Central - NU (Resolute) CA +624900-0920459 America/Rankin_Inlet Central - NU (central) CA +5024-10439 America/Regina CST - SK (most areas) CA +5017-10750 America/Swift_Current CST - SK (midwest) -CA +5333-11328 America/Edmonton Mountain - AB; BC (E); NT (E); SK (W) +CA +5333-11328 America/Edmonton Mountain - AB, BC(E), NT(E), SK(W) CA +690650-1050310 America/Cambridge_Bay Mountain - NU (west) CA +682059-1334300 America/Inuvik Mountain - NT (west) CA +4906-11631 America/Creston MST - BC (Creston) @@ -208,8 +208,8 @@ HT +1832-07220 America/Port-au-Prince HU +4730+01905 Europe/Budapest ID -0610+10648 Asia/Jakarta Java, Sumatra ID -0002+10920 Asia/Pontianak Borneo (west, central) -ID -0507+11924 Asia/Makassar Borneo (east, south); Sulawesi/Celebes, Bali, Nusa Tengarra; Timor (west) -ID -0232+14042 Asia/Jayapura New Guinea (West Papua / Irian Jaya); Malukus/Moluccas +ID -0507+11924 Asia/Makassar Borneo (east, south), Sulawesi/Celebes, Bali, Nusa Tengarra, Timor (west) +ID -0232+14042 Asia/Jayapura New Guinea (West Papua / Irian Jaya), Malukus/Moluccas IE +5320-00615 Europe/Dublin IL +314650+0351326 Asia/Jerusalem IM +5409-00428 Europe/Isle_of_Man @@ -356,7 +356,7 @@ RU +4310+13156 Asia/Vladivostok MSK+07 - Amur River RU +643337+1431336 Asia/Ust-Nera MSK+07 - Oymyakonsky RU +5934+15048 Asia/Magadan MSK+08 - Magadan RU +4658+14242 Asia/Sakhalin MSK+08 - Sakhalin Island -RU +6728+15343 Asia/Srednekolymsk MSK+08 - Sakha (E); N Kuril Is +RU +6728+15343 Asia/Srednekolymsk MSK+08 - Sakha (E), N Kuril Is RU +5301+15839 Asia/Kamchatka MSK+09 - Kamchatka RU +6445+17729 Asia/Anadyr MSK+09 - Bering Sea RW -0157+03004 Africa/Kigali @@ -419,7 +419,7 @@ US +470659-1011757 America/North_Dakota/Center Central - ND (Oliver) US +465042-1012439 America/North_Dakota/New_Salem Central - ND (Morton rural) US +471551-1014640 America/North_Dakota/Beulah Central - ND (Mercer) US +394421-1045903 America/Denver Mountain (most areas) -US +433649-1161209 America/Boise Mountain - ID (south); OR (east) +US +433649-1161209 America/Boise Mountain - ID (south), OR (east) US +332654-1120424 America/Phoenix MST - AZ (except Navajo) US +340308-1181434 America/Los_Angeles Pacific US +611305-1495401 America/Anchorage Alaska (most areas) diff --git a/share/zoneinfo/datfiles/zone1970.tab b/share/zoneinfo/datfiles/zone1970.tab index 493801dfb..d720524c4 100644 --- a/share/zoneinfo/datfiles/zone1970.tab +++ b/share/zoneinfo/datfiles/zone1970.tab @@ -1,4 +1,4 @@ -# $OpenBSD: zone1970.tab,v 1.28 2023/03/23 16:12:11 millert Exp $ +# $OpenBSD: zone1970.tab,v 1.29 2024/01/02 22:43:21 millert Exp $ # tzdb timezone descriptions # # This file is in the public domain. @@ -38,7 +38,7 @@ #country- #codes coordinates TZ comments AD +4230+00131 Europe/Andorra -AE,OM,RE,SC,TF +2518+05518 Asia/Dubai Crozet, Scattered Is +AE,OM,RE,SC,TF +2518+05518 Asia/Dubai Crozet AF +3431+06912 Asia/Kabul AL +4120+01950 Europe/Tirane AM +4011+04430 Asia/Yerevan @@ -48,12 +48,13 @@ AQ -6736+06253 Antarctica/Mawson Mawson AQ -6448-06406 Antarctica/Palmer Palmer AQ -6734-06808 Antarctica/Rothera Rothera AQ -720041+0023206 Antarctica/Troll Troll +AQ -7824+10654 Antarctica/Vostok Vostok AR -3436-05827 America/Argentina/Buenos_Aires Buenos Aires (BA, CF) AR -3124-06411 America/Argentina/Cordoba most areas: CB, CC, CN, ER, FM, MN, SE, SF AR -2447-06525 America/Argentina/Salta Salta (SA, LP, NQ, RN) AR -2411-06518 America/Argentina/Jujuy Jujuy (JY) AR -2649-06513 America/Argentina/Tucuman Tucumán (TM) -AR -2828-06547 America/Argentina/Catamarca Catamarca (CT); Chubut (CH) +AR -2828-06547 America/Argentina/Catamarca Catamarca (CT), Chubut (CH) AR -2926-06651 America/Argentina/La_Rioja La Rioja (LR) AR -3132-06831 America/Argentina/San_Juan San Juan (SJ) AR -3253-06849 America/Argentina/Mendoza Mendoza (MZ) @@ -82,7 +83,7 @@ BG +4241+02319 Europe/Sofia BM +3217-06446 Atlantic/Bermuda BO -1630-06809 America/La_Paz BR -0351-03225 America/Noronha Atlantic islands -BR -0127-04829 America/Belem Pará (east); Amapá +BR -0127-04829 America/Belem Pará (east), Amapá BR -0343-03830 America/Fortaleza Brazil (northeast: MA, PI, CE, RN, PB) BR -0803-03454 America/Recife Pernambuco BR -0712-04812 America/Araguaina Tocantins @@ -100,19 +101,19 @@ BR -0958-06748 America/Rio_Branco Acre BT +2728+08939 Asia/Thimphu BY +5354+02734 Europe/Minsk BZ +1730-08812 America/Belize -CA +4734-05243 America/St_Johns Newfoundland; Labrador (southeast) -CA +4439-06336 America/Halifax Atlantic - NS (most areas); PE +CA +4734-05243 America/St_Johns Newfoundland, Labrador (SE) +CA +4439-06336 America/Halifax Atlantic - NS (most areas), PE CA +4612-05957 America/Glace_Bay Atlantic - NS (Cape Breton) CA +4606-06447 America/Moncton Atlantic - New Brunswick CA +5320-06025 America/Goose_Bay Atlantic - Labrador (most areas) -CA,BS +4339-07923 America/Toronto Eastern - ON, QC (most areas) +CA,BS +4339-07923 America/Toronto Eastern - ON & QC (most areas) CA +6344-06828 America/Iqaluit Eastern - NU (most areas) -CA +4953-09709 America/Winnipeg Central - ON (west); Manitoba +CA +4953-09709 America/Winnipeg Central - ON (west), Manitoba CA +744144-0944945 America/Resolute Central - NU (Resolute) CA +624900-0920459 America/Rankin_Inlet Central - NU (central) CA +5024-10439 America/Regina CST - SK (most areas) CA +5017-10750 America/Swift_Current CST - SK (midwest) -CA +5333-11328 America/Edmonton Mountain - AB; BC (E); NT (E); SK (W) +CA +5333-11328 America/Edmonton Mountain - AB, BC(E), NT(E), SK(W) CA +690650-1050310 America/Cambridge_Bay Mountain - NU (west) CA +682059-1334300 America/Inuvik Mountain - NT (west) CA +5546-12014 America/Dawson_Creek MST - BC (Dawson Cr, Ft St John) @@ -127,7 +128,7 @@ CL -3327-07040 America/Santiago most of Chile CL -5309-07055 America/Punta_Arenas Region of Magallanes CL -2709-10926 Pacific/Easter Easter Island CN +3114+12128 Asia/Shanghai Beijing Time -CN,AQ +4348+08735 Asia/Urumqi Xinjiang Time, Vostok +CN +4348+08735 Asia/Urumqi Xinjiang Time CO +0436-07405 America/Bogota CR +0956-08405 America/Costa_Rica CU +2308-08222 America/Havana @@ -172,8 +173,8 @@ HT +1832-07220 America/Port-au-Prince HU +4730+01905 Europe/Budapest ID -0610+10648 Asia/Jakarta Java, Sumatra ID -0002+10920 Asia/Pontianak Borneo (west, central) -ID -0507+11924 Asia/Makassar Borneo (east, south); Sulawesi/Celebes, Bali, Nusa Tengarra; Timor (west) -ID -0232+14042 Asia/Jayapura New Guinea (West Papua / Irian Jaya); Malukus/Moluccas +ID -0507+11924 Asia/Makassar Borneo (east, south), Sulawesi/Celebes, Bali, Nusa Tengarra, Timor (west) +ID -0232+14042 Asia/Jayapura New Guinea (West Papua / Irian Jaya), Malukus/Moluccas IE +5320-00615 Europe/Dublin IL +314650+0351326 Asia/Jerusalem IN +2232+08822 Asia/Kolkata @@ -252,7 +253,7 @@ PK +2452+06703 Asia/Karachi PL +5215+02100 Europe/Warsaw PM +4703-05620 America/Miquelon PN -2504-13005 Pacific/Pitcairn -PR,AG,CA,AI,AW,BL,BQ,CW,DM,GD,GP,KN,LC,MF,MS,SX,TT,VC,VG,VI +182806-0660622 America/Puerto_Rico AST +PR,AG,CA,AI,AW,BL,BQ,CW,DM,GD,GP,KN,LC,MF,MS,SX,TT,VC,VG,VI +182806-0660622 America/Puerto_Rico AST - QC (Lower North Shore) PS +3130+03428 Asia/Gaza Gaza Strip PS +313200+0350542 Asia/Hebron West Bank PT +3843-00908 Europe/Lisbon Portugal (mainland) @@ -288,7 +289,7 @@ RU +4310+13156 Asia/Vladivostok MSK+07 - Amur River RU +643337+1431336 Asia/Ust-Nera MSK+07 - Oymyakonsky RU +5934+15048 Asia/Magadan MSK+08 - Magadan RU +4658+14242 Asia/Sakhalin MSK+08 - Sakhalin Island -RU +6728+15343 Asia/Srednekolymsk MSK+08 - Sakha (E); N Kuril Is +RU +6728+15343 Asia/Srednekolymsk MSK+08 - Sakha (E), N Kuril Is RU +5301+15839 Asia/Kamchatka MSK+09 - Kamchatka RU +6445+17729 Asia/Anadyr MSK+09 - Bering Sea SA,AQ,KW,YE +2438+04643 Asia/Riyadh Syowa @@ -330,7 +331,7 @@ US +470659-1011757 America/North_Dakota/Center Central - ND (Oliver) US +465042-1012439 America/North_Dakota/New_Salem Central - ND (Morton rural) US +471551-1014640 America/North_Dakota/Beulah Central - ND (Mercer) US +394421-1045903 America/Denver Mountain (most areas) -US +433649-1161209 America/Boise Mountain - ID (south); OR (east) +US +433649-1161209 America/Boise Mountain - ID (south), OR (east) US,CA +332654-1120424 America/Phoenix MST - AZ (most areas), Creston BC US +340308-1181434 America/Los_Angeles Pacific US +611305-1495401 America/Anchorage Alaska (most areas) diff --git a/sys/conf/GENERIC b/sys/conf/GENERIC index f8aaca098..c2575622a 100644 --- a/sys/conf/GENERIC +++ b/sys/conf/GENERIC @@ -1,4 +1,4 @@ -# $OpenBSD: GENERIC,v 1.291 2023/10/04 18:07:13 bluhm Exp $ +# $OpenBSD: GENERIC,v 1.293 2024/01/02 16:40:03 bluhm Exp $ # # Machine-independent option; used by all architectures for their # GENERIC kernel diff --git a/sys/conf/newvers.sh b/sys/conf/newvers.sh index 94fc1f3d2..ea2abaf15 100644 --- a/sys/conf/newvers.sh +++ b/sys/conf/newvers.sh @@ -1,6 +1,6 @@ #!/bin/sh - # -# $OpenBSD: newvers.sh,v 1.198 2023/10/04 15:40:13 bluhm Exp $ +# $OpenBSD: newvers.sh,v 1.200 2024/01/02 16:40:03 bluhm Exp $ # $NetBSD: newvers.sh,v 1.17.2.1 1995/10/12 05:17:11 jtc Exp $ # # Copyright (c) 1984, 1986, 1990, 1993 diff --git a/sys/dev/dt/dt_dev.c b/sys/dev/dt/dt_dev.c index a103c4067..12c5390cd 100644 --- a/sys/dev/dt/dt_dev.c +++ b/sys/dev/dt/dt_dev.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dt_dev.c,v 1.28 2023/07/14 07:07:08 claudio Exp $ */ +/* $OpenBSD: dt_dev.c,v 1.29 2024/01/02 16:32:48 bluhm Exp $ */ /* * Copyright (c) 2019 Martin Pieuchot @@ -160,13 +160,13 @@ int dtopen(dev_t dev, int flags, int mode, struct proc *p) { struct dt_softc *sc; + struct dt_evt *queue; + size_t qlen; int unit = minor(dev); if (!allowdt) return EPERM; - KASSERT(dtlookup(unit) == NULL); - sc = malloc(sizeof(*sc), M_DEVBUF, M_WAITOK|M_CANFAIL|M_ZERO); if (sc == NULL) return ENOMEM; @@ -174,16 +174,26 @@ dtopen(dev_t dev, int flags, int mode, struct proc *p) /* * Enough space to empty 2 full rings of events in a single read. */ - sc->ds_bufqlen = 2 * DT_EVTRING_SIZE; - sc->ds_bufqueue = mallocarray(sc->ds_bufqlen, sizeof(*sc->ds_bufqueue), - M_DEVBUF, M_WAITOK|M_CANFAIL); - if (sc->ds_bufqueue == NULL) - goto bad; + qlen = 2 * DT_EVTRING_SIZE; + queue = mallocarray(qlen, sizeof(*queue), M_DEVBUF, M_WAITOK|M_CANFAIL); + if (queue == NULL) { + free(sc, M_DEVBUF, sizeof(*sc)); + return ENOMEM; + } + + /* no sleep after this point */ + if (dtlookup(unit) != NULL) { + free(queue, M_DEVBUF, qlen * sizeof(*queue)); + free(sc, M_DEVBUF, sizeof(*sc)); + return EBUSY; + } sc->ds_unit = unit; sc->ds_pid = p->p_p->ps_pid; TAILQ_INIT(&sc->ds_pcbs); mtx_init(&sc->ds_mtx, IPL_HIGH); + sc->ds_bufqlen = qlen; + sc->ds_bufqueue = queue; sc->ds_evtcnt = 0; sc->ds_readevt = 0; sc->ds_dropevt = 0; @@ -193,10 +203,6 @@ dtopen(dev_t dev, int flags, int mode, struct proc *p) DPRINTF("dt%d: pid %d open\n", sc->ds_unit, sc->ds_pid); return 0; - -bad: - free(sc, M_DEVBUF, sizeof(*sc)); - return ENOMEM; } int diff --git a/sys/dev/ic/qwx.c b/sys/dev/ic/qwx.c index 3ed1b4e91..e9c4dbf2d 100644 --- a/sys/dev/ic/qwx.c +++ b/sys/dev/ic/qwx.c @@ -1,4 +1,4 @@ -/* $OpenBSD: qwx.c,v 1.1 2023/12/28 17:36:29 stsp Exp $ */ +/* $OpenBSD: qwx.c,v 1.2 2024/01/02 17:39:08 stsp Exp $ */ /* * Copyright 2023 Stefan Sperling @@ -208,6 +208,8 @@ qwx_init(struct ifnet *ifp) ieee80211_begin_scan(ifp); } else { + sc->attached = 1; + /* Configure MAC address at boot-time. */ error = if_setlladdr(ifp, ic->ic_myaddr); if (error) @@ -18329,8 +18331,6 @@ qwx_attach(struct qwx_softc *sc) if (error) return error; - sc->attached = 1; - /* Turn device off until interface comes up. */ qwx_core_deinit(sc); diff --git a/usr.sbin/pkg_add/OpenBSD/PkgAdd.pm b/usr.sbin/pkg_add/OpenBSD/PkgAdd.pm index 082ed64db..01b59404e 100644 --- a/usr.sbin/pkg_add/OpenBSD/PkgAdd.pm +++ b/usr.sbin/pkg_add/OpenBSD/PkgAdd.pm @@ -1,7 +1,7 @@ #! /usr/bin/perl # ex:ts=8 sw=4: -# $OpenBSD: PkgAdd.pm,v 1.149 2023/12/03 16:38:28 espie Exp $ +# $OpenBSD: PkgAdd.pm,v 1.150 2024/01/02 10:25:48 espie Exp $ # # Copyright (c) 2003-2014 Marc Espie # @@ -1164,11 +1164,17 @@ sub quirk_set($state) sub do_quirks($self, $state) { - my $set = quirk_set($state); - $self->process_set($set, $state); + my $list = [quirk_set($state)]; + $state->tracker->todo(@$list); + while (my $set = shift @$list) { + $state->status->what->set($set); + $set = $set->real_set; + next if $set->{finished}; + $state->progress->set_header('Checking packages'); + unshift(@$list, $self->process_set($set, $state)); + } } - sub process_parameters($self, $state) { my $add_hints = $state->{fuzzy} ? "add_hints" : "add_hints2";