From 074e641852f63549a6de41a2e3cfb3258de45ea1 Mon Sep 17 00:00:00 2001 From: purplerain Date: Thu, 3 Oct 2024 15:29:20 +0000 Subject: [PATCH] sync with OpenBSD -current --- lib/libcrypto/crypto.h | 3 +- lib/libcrypto/ec/ec_asn1.c | 49 +- lib/libcrypto/ec/ec_local.h | 5 +- lib/libcrypto/err/err.c | 952 ++++++++++----------- lib/libcrypto/man/X509V3_EXT_get_nid.3 | 6 +- regress/lib/libcrypto/Makefile | 3 +- regress/lib/libcrypto/err/Makefile | 9 + regress/lib/libcrypto/err/err_test.c | 201 +++++ regress/lib/libcrypto/exdata/exdata_test.c | 7 +- share/zoneinfo/datfiles/africa | 75 +- share/zoneinfo/datfiles/antarctica | 60 +- share/zoneinfo/datfiles/asia | 444 +++++----- share/zoneinfo/datfiles/australasia | 132 +-- share/zoneinfo/datfiles/backward | 17 +- share/zoneinfo/datfiles/etcetera | 56 +- share/zoneinfo/datfiles/europe | 715 ++++++++++------ share/zoneinfo/datfiles/leap-seconds.list | 32 +- share/zoneinfo/datfiles/northamerica | 147 +++- share/zoneinfo/datfiles/southamerica | 488 +++++------ share/zoneinfo/datfiles/zone.tab | 5 +- share/zoneinfo/datfiles/zone1970.tab | 5 +- share/zoneinfo/datfiles/zonenow.tab | 8 +- share/zoneinfo/ziguard.awk | 32 +- sys/arch/amd64/amd64/pmap.c | 22 +- sys/arch/amd64/include/vmmvar.h | 5 +- sys/arch/arm/arm/pmap7.c | 54 +- sys/conf/GENERIC | 4 +- sys/dev/acpi/qciic.c | 10 +- sys/dev/pci/drm/drm_drv.c | 103 ++- sys/dev/pci/drm/drm_file.c | 2 +- sys/dev/pci/drm/drm_internal.h | 4 - sys/dev/pci/drm/include/drm/drm_accel.h | 2 + sys/dev/pci/drm/include/drm/drm_file.h | 5 + sys/dev/pci/drm/include/linux/fs.h | 1 + sys/dev/pci/drm/include/linux/xarray.h | 7 + sys/dev/pv/if_vio.c | 64 +- sys/kern/kern_resource.c | 18 +- sys/kern/kern_sig.c | 10 +- sys/kern/kern_time.c | 8 +- sys/kern/sys_process.c | 9 +- sys/sys/proc.h | 7 +- sys/sys/resourcevar.h | 4 +- sys/uvm/uvm_pdaemon.c | 27 +- sys/uvm/uvm_pmemrange.c | 18 +- sys/uvm/uvm_pmemrange.h | 4 +- usr.bin/ctfconv/generate.c | 4 +- usr.bin/tmux/cmd-send-keys.c | 8 +- usr.bin/tmux/input-keys.c | 9 +- usr.bin/tmux/mode-tree.c | 57 +- usr.bin/tmux/options-table.c | 4 +- usr.bin/tmux/screen.c | 16 +- usr.bin/tmux/server-client.c | 64 +- usr.bin/tmux/session.c | 9 +- usr.bin/tmux/tmux.1 | 8 +- usr.bin/tmux/tmux.c | 4 +- usr.bin/tmux/tmux.h | 19 +- usr.bin/tmux/tty-keys.c | 49 +- usr.bin/tmux/window-copy.c | 3 +- usr.bin/tmux/window.c | 46 +- usr.sbin/bgpctl/output.c | 4 +- usr.sbin/bgpctl/output_json.c | 6 +- usr.sbin/bgpd/bgpd.c | 13 +- usr.sbin/bgpd/bgpd.h | 6 +- usr.sbin/bgpd/config.c | 8 +- usr.sbin/bgpd/control.c | 30 +- usr.sbin/bgpd/parse.y | 96 +-- usr.sbin/bgpd/pfkey.c | 267 +++--- usr.sbin/bgpd/printconf.c | 76 +- usr.sbin/bgpd/session.c | 55 +- usr.sbin/bgpd/session.h | 32 +- usr.sbin/pkg_add/OpenBSD/Log.pm | 26 +- usr.sbin/pkg_add/pkg_add.1 | 11 +- usr.sbin/vmd/pci.c | 6 +- usr.sbin/vmd/pci.h | 5 +- usr.sbin/vmd/x86_vm.c | 16 +- 75 files changed, 2693 insertions(+), 2103 deletions(-) create mode 100644 regress/lib/libcrypto/err/Makefile create mode 100644 regress/lib/libcrypto/err/err_test.c diff --git a/lib/libcrypto/crypto.h b/lib/libcrypto/crypto.h index bcca5a0ac..33b6fe419 100644 --- a/lib/libcrypto/crypto.h +++ b/lib/libcrypto/crypto.h @@ -1,4 +1,4 @@ -/* $OpenBSD: crypto.h,v 1.75 2024/08/31 12:43:58 jsing Exp $ */ +/* $OpenBSD: crypto.h,v 1.76 2024/10/03 03:47:40 tb Exp $ */ /* ==================================================================== * Copyright (c) 1998-2006 The OpenSSL Project. All rights reserved. * @@ -416,6 +416,7 @@ int CRYPTO_memcmp(const void *a, const void *b, size_t len); #define OPENSSL_INIT_reserved_internal _OPENSSL_INIT_FLAG_NOOP #define OPENSSL_INIT_ATFORK _OPENSSL_INIT_FLAG_NOOP #define OPENSSL_INIT_ENGINE_ALL_BUILTIN _OPENSSL_INIT_FLAG_NOOP +#define OPENSSL_INIT_NO_ATEXIT _OPENSSL_INIT_FLAG_NOOP int OPENSSL_init_crypto(uint64_t opts, const void *settings); void OPENSSL_cleanup(void); diff --git a/lib/libcrypto/ec/ec_asn1.c b/lib/libcrypto/ec/ec_asn1.c index 2ce7d785c..825f4f389 100644 --- a/lib/libcrypto/ec/ec_asn1.c +++ b/lib/libcrypto/ec/ec_asn1.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ec_asn1.c,v 1.53 2024/04/17 23:24:18 tb Exp $ */ +/* $OpenBSD: ec_asn1.c,v 1.57 2024/10/03 05:07:49 tb Exp $ */ /* * Written by Nils Larsch for the OpenSSL project. */ @@ -405,7 +405,7 @@ static const ASN1_TEMPLATE ECPARAMETERS_seq_tt[] = { }, }; -const ASN1_ITEM ECPARAMETERS_it = { +static const ASN1_ITEM ECPARAMETERS_it = { .itype = ASN1_ITYPE_SEQUENCE, .utype = V_ASN1_SEQUENCE, .templates = ECPARAMETERS_seq_tt, @@ -451,7 +451,7 @@ static const ASN1_TEMPLATE ECPKPARAMETERS_ch_tt[] = { }, }; -const ASN1_ITEM ECPKPARAMETERS_it = { +static const ASN1_ITEM ECPKPARAMETERS_it = { .itype = ASN1_ITYPE_CHOICE, .utype = offsetof(ECPKPARAMETERS, type), .templates = ECPKPARAMETERS_ch_tt, @@ -760,20 +760,19 @@ ec_asn1_group2parameters(const EC_GROUP *group, ECPARAMETERS *param) ECerror(ERR_R_ASN1_LIB); goto err; } - /* set the order */ if (!EC_GROUP_get_order(group, tmp, NULL)) { ECerror(ERR_R_EC_LIB); goto err; } - ret->order = BN_to_ASN1_INTEGER(tmp, ret->order); - if (ret->order == NULL) { + ASN1_INTEGER_free(ret->order); + if ((ret->order = BN_to_ASN1_INTEGER(tmp, NULL)) == NULL) { ECerror(ERR_R_ASN1_LIB); goto err; } - /* set the cofactor (optional) */ + ASN1_INTEGER_free(ret->cofactor); + ret->cofactor = NULL; if (EC_GROUP_get_cofactor(group, tmp, NULL)) { - ret->cofactor = BN_to_ASN1_INTEGER(tmp, ret->cofactor); - if (ret->cofactor == NULL) { + if ((ret->cofactor = BN_to_ASN1_INTEGER(tmp, NULL)) == NULL) { ECerror(ERR_R_ASN1_LIB); goto err; } @@ -842,9 +841,9 @@ ec_asn1_parameters2group(const ECPARAMETERS *params) { int ok = 0, tmp; EC_GROUP *ret = NULL; - BIGNUM *p = NULL, *a = NULL, *b = NULL; + BIGNUM *p = NULL, *a = NULL, *b = NULL, *order = NULL, *cofactor = NULL; EC_POINT *point = NULL; - long field_bits; + int field_bits; if (!params->fieldID || !params->fieldID->fieldType || !params->fieldID->p.ptr) { @@ -933,29 +932,26 @@ ec_asn1_parameters2group(const ECPARAMETERS *params) ECerror(ERR_R_EC_LIB); goto err; } - /* extract the order */ - if ((a = ASN1_INTEGER_to_BN(params->order, a)) == NULL) { + if ((order = ASN1_INTEGER_to_BN(params->order, NULL)) == NULL) { ECerror(ERR_R_ASN1_LIB); goto err; } - if (BN_is_negative(a) || BN_is_zero(a)) { + if (BN_is_negative(order) || BN_is_zero(order)) { ECerror(EC_R_INVALID_GROUP_ORDER); goto err; } - if (BN_num_bits(a) > (int) field_bits + 1) { /* Hasse bound */ + if (BN_num_bits(order) > field_bits + 1) { /* Hasse bound */ ECerror(EC_R_INVALID_GROUP_ORDER); goto err; } - /* extract the cofactor (optional) */ - if (params->cofactor == NULL) { - BN_free(b); - b = NULL; - } else if ((b = ASN1_INTEGER_to_BN(params->cofactor, b)) == NULL) { - ECerror(ERR_R_ASN1_LIB); - goto err; + if (params->cofactor != NULL) { + if ((cofactor = ASN1_INTEGER_to_BN(params->cofactor, + NULL)) == NULL) { + ECerror(ERR_R_ASN1_LIB); + goto err; + } } - /* set the generator, order and cofactor (if present) */ - if (!EC_GROUP_set_generator(ret, point, a, b)) { + if (!EC_GROUP_set_generator(ret, point, order, cofactor)) { ECerror(ERR_R_EC_LIB); goto err; } @@ -969,8 +965,11 @@ ec_asn1_parameters2group(const ECPARAMETERS *params) BN_free(p); BN_free(a); BN_free(b); + BN_free(order); + BN_free(cofactor); EC_POINT_free(point); - return (ret); + + return ret; } EC_GROUP * diff --git a/lib/libcrypto/ec/ec_local.h b/lib/libcrypto/ec/ec_local.h index 6ea78eaac..c2befdede 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.27 2023/11/29 21:35:57 tb Exp $ */ +/* $OpenBSD: ec_local.h,v 1.28 2024/10/03 06:24:07 tb Exp $ */ /* * Originally written by Bodo Moeller for the OpenSSL project. */ @@ -216,9 +216,6 @@ struct ec_group_st { /* Montgomery context and values used by EC_GFp_mont_method. */ BN_MONT_CTX *mont_ctx; BIGNUM *mont_one; - - int (*field_mod_func)(BIGNUM *, const BIGNUM *, const BIGNUM *, - BN_CTX *); } /* EC_GROUP */; struct ec_key_st { diff --git a/lib/libcrypto/err/err.c b/lib/libcrypto/err/err.c index d8ad4f8ba..f0001cd88 100644 --- a/lib/libcrypto/err/err.c +++ b/lib/libcrypto/err/err.c @@ -1,4 +1,4 @@ -/* $OpenBSD: err.c,v 1.63 2024/08/31 10:09:15 tb Exp $ */ +/* $OpenBSD: err.c,v 1.65 2024/10/02 15:21:39 jsing Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -140,11 +140,6 @@ typedef struct err_state_st { int top, bottom; } ERR_STATE; -static void err_load_strings(int lib, ERR_STRING_DATA *str); - -static ERR_STATE *ERR_get_state(void); -static void ERR_STATE_free(ERR_STATE *s); - #ifndef OPENSSL_NO_ERR static ERR_STRING_DATA ERR_str_libraries[] = { {ERR_PACK(ERR_LIB_NONE,0,0), "unknown library"}, @@ -238,90 +233,26 @@ static ERR_STRING_DATA ERR_str_reasons[] = { }; #endif +static void ERR_STATE_free(ERR_STATE *s); -/* Define the predeclared (but externally opaque) "ERR_FNS" type */ -struct st_ERR_FNS { - /* Works on the "error_hash" string table */ - LHASH_OF(ERR_STRING_DATA) *(*cb_err_get)(int create); - void (*cb_err_del)(void); - const ERR_STRING_DATA *(*cb_err_get_item)(const ERR_STRING_DATA *); - const ERR_STRING_DATA *(*cb_err_set_item)(const ERR_STRING_DATA *); - const ERR_STRING_DATA *(*cb_err_del_item)(const ERR_STRING_DATA *); - /* Works on the "thread_hash" error-state table */ - LHASH_OF(ERR_STATE) *(*cb_thread_get)(int create); - void (*cb_thread_release)(LHASH_OF(ERR_STATE) **hash); - ERR_STATE *(*cb_thread_get_item)(const ERR_STATE *); - ERR_STATE *(*cb_thread_set_item)(ERR_STATE *); - void (*cb_thread_del_item)(const ERR_STATE *); - /* Returns the next available error "library" numbers */ - int (*cb_get_next_lib)(void); -}; - -/* Predeclarations of the "err_defaults" functions */ -static LHASH_OF(ERR_STRING_DATA) *int_err_get(int create); -static void int_err_del(void); -static const ERR_STRING_DATA *int_err_get_item(const ERR_STRING_DATA *); -static const ERR_STRING_DATA *int_err_set_item(const ERR_STRING_DATA *); -static const ERR_STRING_DATA *int_err_del_item(const ERR_STRING_DATA *); -static LHASH_OF(ERR_STATE) *int_thread_get(int create); -static void int_thread_release(LHASH_OF(ERR_STATE) **hash); -static ERR_STATE *int_thread_get_item(const ERR_STATE *); -static ERR_STATE *int_thread_set_item(ERR_STATE *); -static void int_thread_del_item(const ERR_STATE *); -static int int_err_get_next_lib(void); - -/* The static ERR_FNS table using these defaults functions */ -static const ERR_FNS err_defaults = { - int_err_get, - int_err_del, - int_err_get_item, - int_err_set_item, - int_err_del_item, - int_thread_get, - int_thread_release, - int_thread_get_item, - int_thread_set_item, - int_thread_del_item, - int_err_get_next_lib -}; - -/* The replacable table of ERR_FNS functions we use at run-time */ -static const ERR_FNS *err_fns = NULL; - -/* Eg. rather than using "err_get()", use "ERRFN(err_get)()". */ -#define ERRFN(a) err_fns->cb_##a - -/* The internal state used by "err_defaults" - as such, the setting, reading, +/* + * The internal state used by "err_defaults" - as such, the setting, reading, * creating, and deleting of this data should only be permitted via the * "err_defaults" functions. This way, a linked module can completely defer all * ERR state operation (together with requisite locking) to the implementations - * and state in the loading application. */ -static LHASH_OF(ERR_STRING_DATA) *int_error_hash = NULL; -static LHASH_OF(ERR_STATE) *int_thread_hash = NULL; -static int int_thread_hash_references = 0; -static int int_err_library_number = ERR_LIB_USER; + * and state in the loading application. + */ +static LHASH_OF(ERR_STRING_DATA) *err_error_hash = NULL; +static LHASH_OF(ERR_STATE) *err_thread_hash = NULL; +static int err_thread_hash_references = 0; +static int err_library_number = ERR_LIB_USER; static pthread_t err_init_thread; -/* Internal function that checks whether "err_fns" is set and if not, sets it to - * the defaults. */ -static void -err_fns_check(void) -{ - if (err_fns) - return; - - CRYPTO_w_lock(CRYPTO_LOCK_ERR); - if (!err_fns) - err_fns = &err_defaults; - CRYPTO_w_unlock(CRYPTO_LOCK_ERR); -} - -/* These are the callbacks provided to "lh_new()" when creating the LHASH tables - * internal to the "err_defaults" implementation. */ - -static unsigned long get_error_values(int inc, int top, const char **file, - int *line, const char **data, int *flags); +/* + * These are the callbacks provided to "lh_new()" when creating the LHASH tables + * internal to the "err_defaults" implementation. + */ /* The internal functions used in the "err_defaults" implementation */ @@ -344,39 +275,38 @@ err_string_data_cmp(const ERR_STRING_DATA *a, const ERR_STRING_DATA *b) static IMPLEMENT_LHASH_COMP_FN(err_string_data, ERR_STRING_DATA) static LHASH_OF(ERR_STRING_DATA) * -int_err_get(int create) +err_get(int create) { LHASH_OF(ERR_STRING_DATA) *ret = NULL; CRYPTO_w_lock(CRYPTO_LOCK_ERR); - if (!int_error_hash && create) - int_error_hash = lh_ERR_STRING_DATA_new(); - if (int_error_hash) - ret = int_error_hash; + if (!err_error_hash && create) + err_error_hash = lh_ERR_STRING_DATA_new(); + if (err_error_hash) + ret = err_error_hash; CRYPTO_w_unlock(CRYPTO_LOCK_ERR); return ret; } static void -int_err_del(void) +err_del(void) { CRYPTO_w_lock(CRYPTO_LOCK_ERR); - if (int_error_hash) { - lh_ERR_STRING_DATA_free(int_error_hash); - int_error_hash = NULL; + if (err_error_hash) { + lh_ERR_STRING_DATA_free(err_error_hash); + err_error_hash = NULL; } CRYPTO_w_unlock(CRYPTO_LOCK_ERR); } static const ERR_STRING_DATA * -int_err_get_item(const ERR_STRING_DATA *d) +err_get_item(const ERR_STRING_DATA *d) { ERR_STRING_DATA *p; LHASH_OF(ERR_STRING_DATA) *hash; - err_fns_check(); - hash = ERRFN(err_get)(0); + hash = err_get(0); if (!hash) return NULL; @@ -388,13 +318,12 @@ int_err_get_item(const ERR_STRING_DATA *d) } static const ERR_STRING_DATA * -int_err_set_item(const ERR_STRING_DATA *d) +err_set_item(const ERR_STRING_DATA *d) { const ERR_STRING_DATA *p; LHASH_OF(ERR_STRING_DATA) *hash; - err_fns_check(); - hash = ERRFN(err_get)(1); + hash = err_get(1); if (!hash) return NULL; @@ -406,13 +335,12 @@ int_err_set_item(const ERR_STRING_DATA *d) } static const ERR_STRING_DATA * -int_err_del_item(const ERR_STRING_DATA *d) +err_del_item(const ERR_STRING_DATA *d) { ERR_STRING_DATA *p; LHASH_OF(ERR_STRING_DATA) *hash; - err_fns_check(); - hash = ERRFN(err_get)(0); + hash = err_get(0); if (!hash) return NULL; @@ -438,30 +366,30 @@ err_state_cmp(const ERR_STATE *a, const ERR_STATE *b) static IMPLEMENT_LHASH_COMP_FN(err_state, ERR_STATE) static LHASH_OF(ERR_STATE) * -int_thread_get(int create) +err_thread_get(int create) { LHASH_OF(ERR_STATE) *ret = NULL; CRYPTO_w_lock(CRYPTO_LOCK_ERR); - if (!int_thread_hash && create) - int_thread_hash = lh_ERR_STATE_new(); - if (int_thread_hash) { - int_thread_hash_references++; - ret = int_thread_hash; + if (!err_thread_hash && create) + err_thread_hash = lh_ERR_STATE_new(); + if (err_thread_hash) { + err_thread_hash_references++; + ret = err_thread_hash; } CRYPTO_w_unlock(CRYPTO_LOCK_ERR); return ret; } static void -int_thread_release(LHASH_OF(ERR_STATE) **hash) +err_thread_release(LHASH_OF(ERR_STATE) **hash) { int i; if (hash == NULL || *hash == NULL) return; - i = CRYPTO_add(&int_thread_hash_references, -1, CRYPTO_LOCK_ERR); + i = CRYPTO_add(&err_thread_hash_references, -1, CRYPTO_LOCK_ERR); if (i > 0) return; @@ -469,13 +397,12 @@ int_thread_release(LHASH_OF(ERR_STATE) **hash) } static ERR_STATE * -int_thread_get_item(const ERR_STATE *d) +err_thread_get_item(const ERR_STATE *d) { ERR_STATE *p; LHASH_OF(ERR_STATE) *hash; - err_fns_check(); - hash = ERRFN(thread_get)(0); + hash = err_thread_get(0); if (!hash) return NULL; @@ -483,18 +410,17 @@ int_thread_get_item(const ERR_STATE *d) p = lh_ERR_STATE_retrieve(hash, d); CRYPTO_r_unlock(CRYPTO_LOCK_ERR); - ERRFN(thread_release)(&hash); + err_thread_release(&hash); return p; } static ERR_STATE * -int_thread_set_item(ERR_STATE *d) +err_thread_set_item(ERR_STATE *d) { ERR_STATE *p; LHASH_OF(ERR_STATE) *hash; - err_fns_check(); - hash = ERRFN(thread_get)(1); + hash = err_thread_get(1); if (!hash) return NULL; @@ -502,43 +428,42 @@ int_thread_set_item(ERR_STATE *d) p = lh_ERR_STATE_insert(hash, d); CRYPTO_w_unlock(CRYPTO_LOCK_ERR); - ERRFN(thread_release)(&hash); + err_thread_release(&hash); return p; } static void -int_thread_del_item(const ERR_STATE *d) +err_thread_del_item(const ERR_STATE *d) { ERR_STATE *p; LHASH_OF(ERR_STATE) *hash; - err_fns_check(); - hash = ERRFN(thread_get)(0); + hash = err_thread_get(0); if (!hash) return; CRYPTO_w_lock(CRYPTO_LOCK_ERR); p = lh_ERR_STATE_delete(hash, d); /* make sure we don't leak memory */ - if (int_thread_hash_references == 1 && - int_thread_hash && lh_ERR_STATE_num_items(int_thread_hash) == 0) { - lh_ERR_STATE_free(int_thread_hash); - int_thread_hash = NULL; + if (err_thread_hash_references == 1 && + err_thread_hash && lh_ERR_STATE_num_items(err_thread_hash) == 0) { + lh_ERR_STATE_free(err_thread_hash); + err_thread_hash = NULL; } CRYPTO_w_unlock(CRYPTO_LOCK_ERR); - ERRFN(thread_release)(&hash); + err_thread_release(&hash); if (p) ERR_STATE_free(p); } static int -int_err_get_next_lib(void) +err_get_next_lib(void) { int ret; CRYPTO_w_lock(CRYPTO_LOCK_ERR); - ret = int_err_library_number++; + ret = err_library_number++; CRYPTO_w_unlock(CRYPTO_LOCK_ERR); return ret; @@ -643,196 +568,55 @@ ERR_STATE_free(ERR_STATE *s) free(s); } -void -ERR_load_ERR_strings_internal(void) +static ERR_STATE * +ERR_get_state(void) { - err_init_thread = pthread_self(); - err_fns_check(); -#ifndef OPENSSL_NO_ERR - err_load_strings(0, ERR_str_libraries); - err_load_strings(0, ERR_str_reasons); - err_load_strings(ERR_LIB_SYS, ERR_str_functs); - build_SYS_str_reasons(); - err_load_strings(ERR_LIB_SYS, SYS_str_reasons); -#endif + static ERR_STATE fallback; + ERR_STATE *ret, tmp, *tmpp = NULL; + int i; + CRYPTO_THREADID tid; + + CRYPTO_THREADID_current(&tid); + CRYPTO_THREADID_cpy(&tmp.tid, &tid); + ret = err_thread_get_item(&tmp); + + /* ret == the error state, if NULL, make a new one */ + if (ret == NULL) { + ret = malloc(sizeof(ERR_STATE)); + if (ret == NULL) + return (&fallback); + CRYPTO_THREADID_cpy(&ret->tid, &tid); + ret->top = 0; + ret->bottom = 0; + for (i = 0; i < ERR_NUM_ERRORS; i++) { + ret->err_data[i] = NULL; + ret->err_data_flags[i] = 0; + } + tmpp = err_thread_set_item(ret); + /* To check if insertion failed, do a get. */ + if (err_thread_get_item(ret) != ret) { + ERR_STATE_free(ret); /* could not insert it */ + return (&fallback); + } + /* If a race occurred in this function and we came second, tmpp + * is the first one that we just replaced. */ + if (tmpp) + ERR_STATE_free(tmpp); + } + return ret; } - -void -ERR_load_ERR_strings(void) -{ - static pthread_once_t once = PTHREAD_ONCE_INIT; - - if (pthread_equal(pthread_self(), err_init_thread)) - return; /* don't recurse */ - - /* Prayer and clean living lets you ignore errors, OpenSSL style */ - (void) OPENSSL_init_crypto(0, NULL); - - (void) pthread_once(&once, ERR_load_ERR_strings_internal); -} -LCRYPTO_ALIAS(ERR_load_ERR_strings); - static void err_load_strings(int lib, ERR_STRING_DATA *str) { while (str->error) { if (lib) str->error |= ERR_PACK(lib, 0, 0); - ERRFN(err_set_item)(str); + err_set_item(str); str++; } } -void -ERR_load_strings(int lib, ERR_STRING_DATA *str) -{ - ERR_load_ERR_strings(); - err_load_strings(lib, str); -} -LCRYPTO_ALIAS(ERR_load_strings); - -void -ERR_load_const_strings(const ERR_STRING_DATA *str) -{ - ERR_load_ERR_strings(); - while (str->error) { - ERRFN(err_set_item)(str); - str++; - } -} - -void -ERR_unload_strings(int lib, ERR_STRING_DATA *str) -{ - /* Prayer and clean living lets you ignore errors, OpenSSL style */ - (void) OPENSSL_init_crypto(0, NULL); - - while (str->error) { - if (lib) - str->error |= ERR_PACK(lib, 0, 0); - ERRFN(err_del_item)(str); - str++; - } -} -LCRYPTO_ALIAS(ERR_unload_strings); - -void -ERR_free_strings(void) -{ - /* Prayer and clean living lets you ignore errors, OpenSSL style */ - (void) OPENSSL_init_crypto(0, NULL); - - err_fns_check(); - ERRFN(err_del)(); -} -LCRYPTO_ALIAS(ERR_free_strings); - -/********************************************************/ - -void -ERR_put_error(int lib, int func, int reason, const char *file, int line) -{ - ERR_STATE *es; - int save_errno = errno; - - es = ERR_get_state(); - - es->top = (es->top + 1) % ERR_NUM_ERRORS; - if (es->top == es->bottom) - es->bottom = (es->bottom + 1) % ERR_NUM_ERRORS; - es->err_flags[es->top] = 0; - es->err_buffer[es->top] = ERR_PACK(lib, func, reason); - es->err_file[es->top] = file; - es->err_line[es->top] = line; - err_clear_data(es, es->top); - errno = save_errno; -} -LCRYPTO_ALIAS(ERR_put_error); - -void -ERR_clear_error(void) -{ - int i; - ERR_STATE *es; - - es = ERR_get_state(); - - for (i = 0; i < ERR_NUM_ERRORS; i++) { - err_clear(es, i); - } - es->top = es->bottom = 0; -} -LCRYPTO_ALIAS(ERR_clear_error); - - -unsigned long -ERR_get_error(void) -{ - return (get_error_values(1, 0, NULL, NULL, NULL, NULL)); -} -LCRYPTO_ALIAS(ERR_get_error); - -unsigned long -ERR_get_error_line(const char **file, int *line) -{ - return (get_error_values(1, 0, file, line, NULL, NULL)); -} -LCRYPTO_ALIAS(ERR_get_error_line); - -unsigned long -ERR_get_error_line_data(const char **file, int *line, - const char **data, int *flags) -{ - return (get_error_values(1, 0, file, line, data, flags)); -} -LCRYPTO_ALIAS(ERR_get_error_line_data); - - -unsigned long -ERR_peek_error(void) -{ - return (get_error_values(0, 0, NULL, NULL, NULL, NULL)); -} -LCRYPTO_ALIAS(ERR_peek_error); - -unsigned long -ERR_peek_error_line(const char **file, int *line) -{ - return (get_error_values(0, 0, file, line, NULL, NULL)); -} -LCRYPTO_ALIAS(ERR_peek_error_line); - -unsigned long -ERR_peek_error_line_data(const char **file, int *line, - const char **data, int *flags) -{ - return (get_error_values(0, 0, file, line, data, flags)); -} -LCRYPTO_ALIAS(ERR_peek_error_line_data); - -unsigned long -ERR_peek_last_error(void) -{ - return (get_error_values(0, 1, NULL, NULL, NULL, NULL)); -} -LCRYPTO_ALIAS(ERR_peek_last_error); - -unsigned long -ERR_peek_last_error_line(const char **file, int *line) -{ - return (get_error_values(0, 1, file, line, NULL, NULL)); -} -LCRYPTO_ALIAS(ERR_peek_last_error_line); - -unsigned long -ERR_peek_last_error_line_data(const char **file, int *line, - const char **data, int *flags) -{ - return (get_error_values(0, 1, file, line, data, flags)); -} -LCRYPTO_ALIAS(ERR_peek_last_error_line_data); - static unsigned long get_error_values(int inc, int top, const char **file, int *line, const char **data, int *flags) @@ -899,6 +683,350 @@ get_error_values(int inc, int top, const char **file, int *line, return ret; } +void +ERR_load_ERR_strings_internal(void) +{ + err_init_thread = pthread_self(); +#ifndef OPENSSL_NO_ERR + err_load_strings(0, ERR_str_libraries); + err_load_strings(0, ERR_str_reasons); + err_load_strings(ERR_LIB_SYS, ERR_str_functs); + build_SYS_str_reasons(); + err_load_strings(ERR_LIB_SYS, SYS_str_reasons); +#endif +} + +void +ERR_load_ERR_strings(void) +{ + static pthread_once_t once = PTHREAD_ONCE_INIT; + + if (pthread_equal(pthread_self(), err_init_thread)) + return; /* don't recurse */ + + /* Prayer and clean living lets you ignore errors, OpenSSL style */ + (void) OPENSSL_init_crypto(0, NULL); + + (void) pthread_once(&once, ERR_load_ERR_strings_internal); +} +LCRYPTO_ALIAS(ERR_load_ERR_strings); + +void +ERR_load_strings(int lib, ERR_STRING_DATA *str) +{ + ERR_load_ERR_strings(); + err_load_strings(lib, str); +} +LCRYPTO_ALIAS(ERR_load_strings); + +void +ERR_load_const_strings(const ERR_STRING_DATA *str) +{ + ERR_load_ERR_strings(); + while (str->error) { + err_set_item(str); + str++; + } +} + +void +ERR_unload_strings(int lib, ERR_STRING_DATA *str) +{ + /* Prayer and clean living lets you ignore errors, OpenSSL style */ + (void) OPENSSL_init_crypto(0, NULL); + + while (str->error) { + if (lib) + str->error |= ERR_PACK(lib, 0, 0); + err_del_item(str); + str++; + } +} +LCRYPTO_ALIAS(ERR_unload_strings); + +void +ERR_free_strings(void) +{ + /* Prayer and clean living lets you ignore errors, OpenSSL style */ + (void) OPENSSL_init_crypto(0, NULL); + + err_del(); +} +LCRYPTO_ALIAS(ERR_free_strings); + +int +ERR_get_next_error_library(void) +{ + return err_get_next_lib(); +} +LCRYPTO_ALIAS(ERR_get_next_error_library); + +void +ERR_remove_thread_state(const CRYPTO_THREADID *id) +{ + ERR_STATE tmp; + + if (id) + CRYPTO_THREADID_cpy(&tmp.tid, id); + else + CRYPTO_THREADID_current(&tmp.tid); + /* err_thread_del_item automatically destroys the LHASH if the number of + * items reaches zero. */ + err_thread_del_item(&tmp); +} +LCRYPTO_ALIAS(ERR_remove_thread_state); + +void +ERR_remove_state(unsigned long pid) +{ + ERR_remove_thread_state(NULL); +} +LCRYPTO_ALIAS(ERR_remove_state); + +int +ERR_set_mark(void) +{ + ERR_STATE *es; + + es = ERR_get_state(); + + if (es->bottom == es->top) + return 0; + es->err_flags[es->top] |= ERR_FLAG_MARK; + return 1; +} +LCRYPTO_ALIAS(ERR_set_mark); + +int +ERR_pop_to_mark(void) +{ + ERR_STATE *es; + + es = ERR_get_state(); + + while (es->bottom != es->top && + (es->err_flags[es->top] & ERR_FLAG_MARK) == 0) { + err_clear(es, es->top); + es->top -= 1; + if (es->top == -1) + es->top = ERR_NUM_ERRORS - 1; + } + + if (es->bottom == es->top) + return 0; + es->err_flags[es->top]&=~ERR_FLAG_MARK; + return 1; +} +LCRYPTO_ALIAS(ERR_pop_to_mark); + +void +ERR_clear_error(void) +{ + int i; + ERR_STATE *es; + + es = ERR_get_state(); + + for (i = 0; i < ERR_NUM_ERRORS; i++) { + err_clear(es, i); + } + es->top = es->bottom = 0; +} +LCRYPTO_ALIAS(ERR_clear_error); + +void +err_clear_last_constant_time(int clear) +{ + ERR_STATE *es; + int top; + + es = ERR_get_state(); + if (es == NULL) + return; + + top = es->top; + + es->err_flags[top] &= ~(0 - clear); + es->err_buffer[top] &= ~(0UL - clear); + es->err_file[top] = (const char *)((uintptr_t)es->err_file[top] & + ~((uintptr_t)0 - clear)); + es->err_line[top] |= 0 - clear; + + es->top = (top + ERR_NUM_ERRORS - clear) % ERR_NUM_ERRORS; +} + +void +ERR_put_error(int lib, int func, int reason, const char *file, int line) +{ + ERR_STATE *es; + int save_errno = errno; + + es = ERR_get_state(); + + es->top = (es->top + 1) % ERR_NUM_ERRORS; + if (es->top == es->bottom) + es->bottom = (es->bottom + 1) % ERR_NUM_ERRORS; + es->err_flags[es->top] = 0; + es->err_buffer[es->top] = ERR_PACK(lib, func, reason); + es->err_file[es->top] = file; + es->err_line[es->top] = line; + err_clear_data(es, es->top); + errno = save_errno; +} +LCRYPTO_ALIAS(ERR_put_error); + +void +ERR_asprintf_error_data(char * format, ...) +{ + char *errbuf = NULL; + va_list ap; + int r; + + va_start(ap, format); + r = vasprintf(&errbuf, format, ap); + va_end(ap); + if (r == -1) + ERR_set_error_data("malloc failed", ERR_TXT_STRING); + else + ERR_set_error_data(errbuf, ERR_TXT_MALLOCED|ERR_TXT_STRING); +} +LCRYPTO_ALIAS(ERR_asprintf_error_data); + +void +ERR_set_error_data(char *data, int flags) +{ + ERR_STATE *es; + int i; + + es = ERR_get_state(); + + i = es->top; + if (i == 0) + i = ERR_NUM_ERRORS - 1; + + err_clear_data(es, i); + es->err_data[i] = data; + es->err_data_flags[i] = flags; +} +LCRYPTO_ALIAS(ERR_set_error_data); + +unsigned long +ERR_get_error(void) +{ + return (get_error_values(1, 0, NULL, NULL, NULL, NULL)); +} +LCRYPTO_ALIAS(ERR_get_error); + +unsigned long +ERR_get_error_line(const char **file, int *line) +{ + return (get_error_values(1, 0, file, line, NULL, NULL)); +} +LCRYPTO_ALIAS(ERR_get_error_line); + +unsigned long +ERR_get_error_line_data(const char **file, int *line, + const char **data, int *flags) +{ + return (get_error_values(1, 0, file, line, data, flags)); +} +LCRYPTO_ALIAS(ERR_get_error_line_data); + +unsigned long +ERR_peek_error(void) +{ + return (get_error_values(0, 0, NULL, NULL, NULL, NULL)); +} +LCRYPTO_ALIAS(ERR_peek_error); + +unsigned long +ERR_peek_error_line(const char **file, int *line) +{ + return (get_error_values(0, 0, file, line, NULL, NULL)); +} +LCRYPTO_ALIAS(ERR_peek_error_line); + +unsigned long +ERR_peek_error_line_data(const char **file, int *line, + const char **data, int *flags) +{ + return (get_error_values(0, 0, file, line, data, flags)); +} +LCRYPTO_ALIAS(ERR_peek_error_line_data); + +unsigned long +ERR_peek_last_error(void) +{ + return (get_error_values(0, 1, NULL, NULL, NULL, NULL)); +} +LCRYPTO_ALIAS(ERR_peek_last_error); + +unsigned long +ERR_peek_last_error_line(const char **file, int *line) +{ + return (get_error_values(0, 1, file, line, NULL, NULL)); +} +LCRYPTO_ALIAS(ERR_peek_last_error_line); + +unsigned long +ERR_peek_last_error_line_data(const char **file, int *line, + const char **data, int *flags) +{ + return (get_error_values(0, 1, file, line, data, flags)); +} +LCRYPTO_ALIAS(ERR_peek_last_error_line_data); + +const char * +ERR_lib_error_string(unsigned long e) +{ + const ERR_STRING_DATA *p; + ERR_STRING_DATA d; + unsigned long l; + + if (!OPENSSL_init_crypto(0, NULL)) + return NULL; + + l = ERR_GET_LIB(e); + d.error = ERR_PACK(l, 0, 0); + p = err_get_item(&d); + return ((p == NULL) ? NULL : p->string); +} +LCRYPTO_ALIAS(ERR_lib_error_string); + +const char * +ERR_func_error_string(unsigned long e) +{ + const ERR_STRING_DATA *p; + ERR_STRING_DATA d; + unsigned long l, f; + + l = ERR_GET_LIB(e); + f = ERR_GET_FUNC(e); + d.error = ERR_PACK(l, f, 0); + p = err_get_item(&d); + return ((p == NULL) ? NULL : p->string); +} +LCRYPTO_ALIAS(ERR_func_error_string); + +const char * +ERR_reason_error_string(unsigned long e) +{ + const ERR_STRING_DATA *p = NULL; + ERR_STRING_DATA d; + unsigned long l, r; + + l = ERR_GET_LIB(e); + r = ERR_GET_REASON(e); + d.error = ERR_PACK(l, 0, r); + p = err_get_item(&d); + if (!p) { + d.error = ERR_PACK(0, 0, r); + p = err_get_item(&d); + } + return ((p == NULL) ? NULL : p->string); +} +LCRYPTO_ALIAS(ERR_reason_error_string); + void ERR_error_string_n(unsigned long e, char *buf, size_t len) { @@ -970,219 +1098,3 @@ ERR_error_string(unsigned long e, char *ret) return ret; } LCRYPTO_ALIAS(ERR_error_string); - -const char * -ERR_lib_error_string(unsigned long e) -{ - const ERR_STRING_DATA *p; - ERR_STRING_DATA d; - unsigned long l; - - if (!OPENSSL_init_crypto(0, NULL)) - return NULL; - - err_fns_check(); - l = ERR_GET_LIB(e); - d.error = ERR_PACK(l, 0, 0); - p = ERRFN(err_get_item)(&d); - return ((p == NULL) ? NULL : p->string); -} -LCRYPTO_ALIAS(ERR_lib_error_string); - -const char * -ERR_func_error_string(unsigned long e) -{ - const ERR_STRING_DATA *p; - ERR_STRING_DATA d; - unsigned long l, f; - - err_fns_check(); - l = ERR_GET_LIB(e); - f = ERR_GET_FUNC(e); - d.error = ERR_PACK(l, f, 0); - p = ERRFN(err_get_item)(&d); - return ((p == NULL) ? NULL : p->string); -} -LCRYPTO_ALIAS(ERR_func_error_string); - -const char * -ERR_reason_error_string(unsigned long e) -{ - const ERR_STRING_DATA *p = NULL; - ERR_STRING_DATA d; - unsigned long l, r; - - err_fns_check(); - l = ERR_GET_LIB(e); - r = ERR_GET_REASON(e); - d.error = ERR_PACK(l, 0, r); - p = ERRFN(err_get_item)(&d); - if (!p) { - d.error = ERR_PACK(0, 0, r); - p = ERRFN(err_get_item)(&d); - } - return ((p == NULL) ? NULL : p->string); -} -LCRYPTO_ALIAS(ERR_reason_error_string); - -void -ERR_remove_thread_state(const CRYPTO_THREADID *id) -{ - ERR_STATE tmp; - - if (id) - CRYPTO_THREADID_cpy(&tmp.tid, id); - else - CRYPTO_THREADID_current(&tmp.tid); - err_fns_check(); - /* thread_del_item automatically destroys the LHASH if the number of - * items reaches zero. */ - ERRFN(thread_del_item)(&tmp); -} -LCRYPTO_ALIAS(ERR_remove_thread_state); - -void -ERR_remove_state(unsigned long pid) -{ - ERR_remove_thread_state(NULL); -} -LCRYPTO_ALIAS(ERR_remove_state); - -static ERR_STATE * -ERR_get_state(void) -{ - static ERR_STATE fallback; - ERR_STATE *ret, tmp, *tmpp = NULL; - int i; - CRYPTO_THREADID tid; - - err_fns_check(); - CRYPTO_THREADID_current(&tid); - CRYPTO_THREADID_cpy(&tmp.tid, &tid); - ret = ERRFN(thread_get_item)(&tmp); - - /* ret == the error state, if NULL, make a new one */ - if (ret == NULL) { - ret = malloc(sizeof(ERR_STATE)); - if (ret == NULL) - return (&fallback); - CRYPTO_THREADID_cpy(&ret->tid, &tid); - ret->top = 0; - ret->bottom = 0; - for (i = 0; i < ERR_NUM_ERRORS; i++) { - ret->err_data[i] = NULL; - ret->err_data_flags[i] = 0; - } - tmpp = ERRFN(thread_set_item)(ret); - /* To check if insertion failed, do a get. */ - if (ERRFN(thread_get_item)(ret) != ret) { - ERR_STATE_free(ret); /* could not insert it */ - return (&fallback); - } - /* If a race occurred in this function and we came second, tmpp - * is the first one that we just replaced. */ - if (tmpp) - ERR_STATE_free(tmpp); - } - return ret; -} - -int -ERR_get_next_error_library(void) -{ - err_fns_check(); - return ERRFN(get_next_lib)(); -} -LCRYPTO_ALIAS(ERR_get_next_error_library); - -void -ERR_set_error_data(char *data, int flags) -{ - ERR_STATE *es; - int i; - - es = ERR_get_state(); - - i = es->top; - if (i == 0) - i = ERR_NUM_ERRORS - 1; - - err_clear_data(es, i); - es->err_data[i] = data; - es->err_data_flags[i] = flags; -} -LCRYPTO_ALIAS(ERR_set_error_data); - -void -ERR_asprintf_error_data(char * format, ...) -{ - char *errbuf = NULL; - va_list ap; - int r; - - va_start(ap, format); - r = vasprintf(&errbuf, format, ap); - va_end(ap); - if (r == -1) - ERR_set_error_data("malloc failed", ERR_TXT_STRING); - else - ERR_set_error_data(errbuf, ERR_TXT_MALLOCED|ERR_TXT_STRING); -} -LCRYPTO_ALIAS(ERR_asprintf_error_data); - -int -ERR_set_mark(void) -{ - ERR_STATE *es; - - es = ERR_get_state(); - - if (es->bottom == es->top) - return 0; - es->err_flags[es->top] |= ERR_FLAG_MARK; - return 1; -} -LCRYPTO_ALIAS(ERR_set_mark); - -int -ERR_pop_to_mark(void) -{ - ERR_STATE *es; - - es = ERR_get_state(); - - while (es->bottom != es->top && - (es->err_flags[es->top] & ERR_FLAG_MARK) == 0) { - err_clear(es, es->top); - es->top -= 1; - if (es->top == -1) - es->top = ERR_NUM_ERRORS - 1; - } - - if (es->bottom == es->top) - return 0; - es->err_flags[es->top]&=~ERR_FLAG_MARK; - return 1; -} -LCRYPTO_ALIAS(ERR_pop_to_mark); - -void -err_clear_last_constant_time(int clear) -{ - ERR_STATE *es; - int top; - - es = ERR_get_state(); - if (es == NULL) - return; - - top = es->top; - - es->err_flags[top] &= ~(0 - clear); - es->err_buffer[top] &= ~(0UL - clear); - es->err_file[top] = (const char *)((uintptr_t)es->err_file[top] & - ~((uintptr_t)0 - clear)); - es->err_line[top] |= 0 - clear; - - es->top = (top + ERR_NUM_ERRORS - clear) % ERR_NUM_ERRORS; -} diff --git a/lib/libcrypto/man/X509V3_EXT_get_nid.3 b/lib/libcrypto/man/X509V3_EXT_get_nid.3 index 2b73f5bbc..a47a3ef45 100644 --- a/lib/libcrypto/man/X509V3_EXT_get_nid.3 +++ b/lib/libcrypto/man/X509V3_EXT_get_nid.3 @@ -1,4 +1,4 @@ -.\" $OpenBSD: X509V3_EXT_get_nid.3,v 1.4 2024/05/14 06:57:10 tb Exp $ +.\" $OpenBSD: X509V3_EXT_get_nid.3,v 1.5 2024/10/03 03:31:47 tb Exp $ .\" .\" Copyright (c) 2024 Theo Buehler .\" @@ -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: May 14 2024 $ +.Dd $Mdocdate: October 3 2024 $ .Dt X509V3_EXT_GET_NID 3 .Os .Sh NAME @@ -43,7 +43,7 @@ The library's .Vt X509V3_EXT_METHOD type, which is not yet documented in detail, -contains a numeric identifier to represent the OID and various +contains a numeric identifier (NID) to represent the OID and various handlers for encoding, decoding, printing, and configuring the extension's value. Criticality is handled separately, for example as an argument to diff --git a/regress/lib/libcrypto/Makefile b/regress/lib/libcrypto/Makefile index d812cd9db..387469853 100644 --- a/regress/lib/libcrypto/Makefile +++ b/regress/lib/libcrypto/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.59 2024/08/31 08:23:32 tb Exp $ +# $OpenBSD: Makefile,v 1.60 2024/10/02 14:50:58 jsing Exp $ SUBDIR += aead SUBDIR += aes @@ -23,6 +23,7 @@ SUBDIR += dsa SUBDIR += ec SUBDIR += ecdh SUBDIR += ecdsa +SUBDIR += err SUBDIR += evp SUBDIR += exdata SUBDIR += free diff --git a/regress/lib/libcrypto/err/Makefile b/regress/lib/libcrypto/err/Makefile new file mode 100644 index 000000000..bfac64cc0 --- /dev/null +++ b/regress/lib/libcrypto/err/Makefile @@ -0,0 +1,9 @@ +# $OpenBSD: Makefile,v 1.1 2024/10/02 14:41:46 jsing Exp $ + +PROG = err_test +LDADD = -lcrypto +DPADD = ${LIBCRYPTO} +WARNINGS = Yes +CFLAGS += -DLIBRESSL_INTERNAL -Werror + +.include diff --git a/regress/lib/libcrypto/err/err_test.c b/regress/lib/libcrypto/err/err_test.c new file mode 100644 index 000000000..16fd675e1 --- /dev/null +++ b/regress/lib/libcrypto/err/err_test.c @@ -0,0 +1,201 @@ +/* $OpenBSD: err_test.c,v 1.1 2024/10/02 14:41:46 jsing Exp $ */ +/* + * Copyright (c) 2024 Joel Sing + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#include + +#include +#include +#include + +/* + * This should also test: + * - error handling with more than ERR_NUM_ERRORS. + * - multi-threaded use. + */ + +static int +err_test(void) +{ + const char *file, *s; + char buf[2048]; + unsigned long err; + int line; + int failed = 1; + + ERR_load_crypto_strings(); + + ERR_remove_state(0); + + ERR_clear_error(); + + if ((err = ERR_peek_error()) != 0) { + fprintf(stderr, "FAIL: ERR_peek_error() = %lx, want " + "0x0\n", err); + goto failure; + } + if ((err = ERR_get_error()) != 0) { + fprintf(stderr, "FAIL: ERR_get_error() = %lx, want " + "0x0\n", err); + goto failure; + } + + ERR_put_error(ERR_LIB_SYS, SYS_F_SOCKET, ERR_R_MALLOC_FAILURE, + "sys.c", 100); + ERR_put_error(ERR_LIB_BN, BN_F_BN_USUB, BN_R_DIV_BY_ZERO, + "bn.c", 200); + + if ((err = ERR_peek_error()) != 0x2004041UL) { + fprintf(stderr, "FAIL: ERR_peek_error() = %lx, want " + "0x2004041UL\n", err); + goto failure; + } + if ((err = ERR_peek_error_line(&file, &line)) != 0x2004041UL) { + fprintf(stderr, "FAIL: ERR_peek_error_line() = %lx, want " + "0x2004041\n", err); + goto failure; + } + if (strcmp(file, "sys.c") != 0) { + fprintf(stderr, "FAIL: got file '%s', want 'sys.c'", file); + goto failure; + } + if (line != 100) { + fprintf(stderr, "FAIL: line = %d, want 100", line); + goto failure; + } + + if ((err = ERR_peek_last_error()) != 0x3073067UL) { + fprintf(stderr, "FAIL: ERR_peek_error() = %lx, want " + "0x3073067\n", err); + goto failure; + } + if ((err = ERR_peek_last_error_line(&file, &line)) != 0x3073067UL) { + fprintf(stderr, "FAIL: ERR_peek_last_error_line() = %lx, want " + "0x3073067\n", err); + goto failure; + } + if (strcmp(file, "bn.c") != 0) { + fprintf(stderr, "FAIL: got file '%s', want 'bn.c'", file); + goto failure; + } + if (line != 200) { + fprintf(stderr, "FAIL: line = %d, want 200", line); + goto failure; + } + + if ((err = ERR_get_error()) != 0x2004041UL) { + fprintf(stderr, "FAIL: ERR_get_error() = %lx, want " + "0x2004041\n", err); + goto failure; + } + + if ((err = ERR_peek_error()) != 0x3073067UL) { + fprintf(stderr, "FAIL: ERR_peek_error() = %lx, want " + "0x3073067\n", err); + goto failure; + } + + if ((err = ERR_get_error_line(&file, &line)) != 0x3073067UL) { + fprintf(stderr, "FAIL: ERR_get_error_line() = %lx, want " + "0x3073067\n", err); + goto failure; + } + if (strcmp(file, "bn.c") != 0) { + fprintf(stderr, "FAIL: got file '%s', want 'bn.c'", file); + goto failure; + } + if (line != 200) { + fprintf(stderr, "FAIL: line = %d, want 200", line); + goto failure; + } + + if ((err = ERR_get_error()) != 0) { + fprintf(stderr, "FAIL: ERR_get_error() = %lx, want " + "0x0\n", err); + goto failure; + } + + ERR_clear_error(); + + s = ERR_lib_error_string(0x3fff067UL); + if (strcmp(s, "bignum routines") != 0) { + fprintf(stderr, "FAIL: ERR_lib_error_string() = '%s', " + "want 'bignum routines'\n", s); + goto failure; + } + + s = ERR_func_error_string(0x3fff067UL); + if (strcmp(s, "CRYPTO_internal") != 0) { + fprintf(stderr, "FAIL: ERR_func_error_string() = '%s', " + "want 'CRYPTO_internal'\n", s); + goto failure; + } + + s = ERR_reason_error_string(0x3fff067UL); + if (strcmp(s, "div by zero") != 0) { + fprintf(stderr, "FAIL: ERR_reason_error_string() = '%s', " + "want 'div by zero'\n", s); + goto failure; + } + + ERR_remove_state(0); + + s = ERR_error_string(0x3fff067UL, NULL); + if (strcmp(s, "error:03FFF067:bignum routines:CRYPTO_internal:div by zero") != 0) { + fprintf(stderr, "FAIL: ERR_error_string() = '%s', " + "want 'error:03FFF067:bignum routines:CRYPTO_internal:div by zero'\n", s); + goto failure; + } + memset(buf, 0xdb, sizeof(buf)); + s = ERR_error_string(0x3fff067UL, buf); + if (s != buf) { + fprintf(stderr, "FAIL: ERR_error_string() did not " + "return buffer\n"); + goto failure; + } + if (strcmp(s, "error:03FFF067:bignum routines:CRYPTO_internal:div by zero") != 0) { + fprintf(stderr, "FAIL: ERR_error_string() = '%s', " + "want 'error:03FFF067:bignum routines:CRYPTO_internal:div by zero'\n", s); + goto failure; + } + + memset(buf, 0xdb, sizeof(buf)); + ERR_error_string_n(0x3fff067UL, buf, sizeof(buf)); + if (strcmp(s, "error:03FFF067:bignum routines:CRYPTO_internal:div by zero") != 0) { + fprintf(stderr, "FAIL: ERR_error_string() = '%s', " + "want 'error:03FFF067:bignum routines:CRYPTO_internal:div by zero'\n", s); + goto failure; + } + + failed = 0; + + failure: + + return failed; +} + +int +main(int argc, char **argv) +{ + int failed = 0; + + failed |= err_test(); + + /* Force a clean up. */ + OPENSSL_cleanup(); + + return failed; +} diff --git a/regress/lib/libcrypto/exdata/exdata_test.c b/regress/lib/libcrypto/exdata/exdata_test.c index 22483f706..a82cb4a66 100644 --- a/regress/lib/libcrypto/exdata/exdata_test.c +++ b/regress/lib/libcrypto/exdata/exdata_test.c @@ -1,4 +1,4 @@ -/* $OpenBSD: exdata_test.c,v 1.2 2024/03/25 10:41:36 jsing Exp $ */ +/* $OpenBSD: exdata_test.c,v 1.3 2024/10/02 14:12:21 jsing Exp $ */ /* * Copyright (c) 2023 Joel Sing * @@ -231,8 +231,6 @@ ex_data_test(void) return failed; } -#if 0 -/* This insanity currently succeeds... */ static int ex_new_index_test(void) { @@ -257,7 +255,6 @@ ex_new_index_test(void) failure: return failed; } -#endif int main(int argc, char **argv) @@ -265,9 +262,7 @@ main(int argc, char **argv) int failed = 0; failed |= ex_data_test(); -#if 0 failed |= ex_new_index_test(); -#endif /* Force a clean up. */ CRYPTO_cleanup_all_ex_data(); diff --git a/share/zoneinfo/datfiles/africa b/share/zoneinfo/datfiles/africa index ca70bd1b4..9ae95d85e 100644 --- a/share/zoneinfo/datfiles/africa +++ b/share/zoneinfo/datfiles/africa @@ -1,4 +1,4 @@ -# $OpenBSD: africa,v 1.75 2024/02/05 17:07:23 millert Exp $ +# $OpenBSD: africa,v 1.76 2024/10/02 17:08:47 millert Exp $ # tzdb data for Africa and environs # This file is in the public domain, so clarified as of @@ -139,17 +139,16 @@ Zone Africa/Douala 0:38:48 - LMT 1912 # Cape Verde / Cabo Verde # -# From Paul Eggert (2018-02-16): -# Shanks gives 1907 for the transition to +02. -# For now, ignore that and follow the 1911-05-26 Portuguese decree -# (see Europe/Lisbon). +# From Tim Parenti (2024-07-01), per Paul Eggert (2018-02-16): +# For timestamps before independence, see commentary for Europe/Lisbon. +# Shanks gives 1907 instead for the transition to -02. # # Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Atlantic/Cape_Verde -1:34:04 - LMT 1912 Jan 01 2:00u # Praia - -2:00 - -02 1942 Sep - -2:00 1:00 -01 1945 Oct 15 - -2:00 - -02 1975 Nov 25 2:00 - -1:00 - -01 + -2:00 - %z 1942 Sep + -2:00 1:00 %z 1945 Oct 15 + -2:00 - %z 1975 Nov 25 2:00 + -1:00 - %z # Central African Republic # Zone NAME STDOFF RULES FORMAT [UNTIL] @@ -459,14 +458,12 @@ Zone Africa/Conakry -0:54:52 - LMT 1912 # Guinea-Bissau # -# From Paul Eggert (2018-02-16): -# Shanks gives 1911-05-26 for the transition to WAT, -# evidently confusing the date of the Portuguese decree -# (see Europe/Lisbon) with the date that it took effect. +# From Tim Parenti (2024-07-01), per Paul Eggert (2018-02-16): +# For timestamps before independence, see commentary for Europe/Lisbon. # # Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Africa/Bissau -1:02:20 - LMT 1912 Jan 1 1:00u - -1:00 - -01 1975 + -1:00 - %z 1975 0:00 - GMT # Kenya @@ -522,10 +519,10 @@ Zone Africa/Bissau -1:02:20 - LMT 1912 Jan 1 1:00u # Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Africa/Nairobi 2:27:16 - LMT 1908 May - 2:30 - +0230 1928 Jun 30 24:00 + 2:30 - %z 1928 Jun 30 24:00 3:00 - EAT 1930 Jan 4 24:00 - 2:30 - +0230 1936 Dec 31 24:00 - 2:45 - +0245 1942 Jul 31 24:00 + 2:30 - %z 1936 Dec 31 24:00 + 2:45 - %z 1942 Jul 31 24:00 3:00 - EAT # Lesotho @@ -732,7 +729,7 @@ Rule Mauritius 2008 only - Oct lastSun 2:00 1:00 - Rule Mauritius 2009 only - Mar lastSun 2:00 0 - # Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Indian/Mauritius 3:50:00 - LMT 1907 # Port Louis - 4:00 Mauritius +04/+05 + 4:00 Mauritius %z # Agalega Is, Rodriguez # no information; probably like Indian/Mauritius @@ -1219,10 +1216,10 @@ Rule Morocco 2087 only - May 11 2:00 0 - # Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Africa/Casablanca -0:30:20 - LMT 1913 Oct 26 - 0:00 Morocco +00/+01 1984 Mar 16 - 1:00 - +01 1986 - 0:00 Morocco +00/+01 2018 Oct 28 3:00 - 1:00 Morocco +01/+00 + 0:00 Morocco %z 1984 Mar 16 + 1:00 - %z 1986 + 0:00 Morocco %z 2018 Oct 28 3:00 + 1:00 Morocco %z # Western Sahara # @@ -1236,19 +1233,33 @@ Zone Africa/Casablanca -0:30:20 - LMT 1913 Oct 26 # since most of it was then controlled by Morocco. Zone Africa/El_Aaiun -0:52:48 - LMT 1934 Jan # El Aaiún - -1:00 - -01 1976 Apr 14 - 0:00 Morocco +00/+01 2018 Oct 28 3:00 - 1:00 Morocco +01/+00 + -1:00 - %z 1976 Apr 14 + 0:00 Morocco %z 2018 Oct 28 3:00 + 1:00 Morocco %z # Mozambique # -# Shanks gives 1903-03-01 for the transition to CAT. -# Perhaps the 1911-05-26 Portuguese decree -# https://dre.pt/pdf1sdip/1911/05/12500/23132313.pdf -# merely made it official? +# From Tim Parenti (2024-07-01): +# For timestamps before Mozambique's independence, see commentary for +# Europe/Lisbon. +# +# From Paul Eggert (2024-05-24): +# The London Gazette, 1903-04-03, page 2245, says that +# as of 1903-03-03 a time ball at the port of Lourenço Marques +# (as Maputo was then called) was dropped daily at 13:00:00 LMT, +# corresponding to 22:49:41.7 GMT, so local time was +02:10:18.3. +# Conversely, the newspaper South Africa, 1909-02-09, page 321, +# says the port had just installed an apparatus that communicated +# "from the controlling clock in the new Observatory at Reuben Point ... +# exact mean South African time, i.e., 30 deg., or 2 hours East of Greenwich". +# Although Shanks gives 1903-03-01 for the transition to CAT, +# evidently the port transitioned to CAT after 1903-03-03 but before +# the Portuguese legal transition of 1912-01-01 (see Europe/Lisbon commentary). +# For lack of better info, list 1909 as the transition date. # # Zone NAME STDOFF RULES FORMAT [UNTIL] -Zone Africa/Maputo 2:10:20 - LMT 1903 Mar + #STDOFF 2:10:18.3 +Zone Africa/Maputo 2:10:18 - LMT 1909 2:00 - CAT # Namibia @@ -1313,7 +1324,7 @@ Rule Namibia 1995 2017 - Apr Sun>=1 2:00 -1:00 WAT # Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Africa/Windhoek 1:08:24 - LMT 1892 Feb 8 - 1:30 - +0130 1903 Mar + 1:30 - %z 1903 Mar 2:00 - SAST 1942 Sep 20 2:00 2:00 1:00 SAST 1943 Mar 21 2:00 2:00 - SAST 1990 Mar 21 # independence @@ -1398,7 +1409,7 @@ Zone Africa/Niamey 0:08:28 - LMT 1912 Zone Africa/Lagos 0:13:35 - LMT 1905 Jul 1 0:00 - GMT 1908 Jul 1 0:13:35 - LMT 1914 Jan 1 - 0:30 - +0030 1919 Sep 1 + 0:30 - %z 1919 Sep 1 1:00 - WAT # Réunion diff --git a/share/zoneinfo/datfiles/antarctica b/share/zoneinfo/datfiles/antarctica index d64ecaf16..d4ac5801e 100644 --- a/share/zoneinfo/datfiles/antarctica +++ b/share/zoneinfo/datfiles/antarctica @@ -1,4 +1,4 @@ -# $OpenBSD: antarctica,v 1.48 2024/01/02 22:43:20 millert Exp $ +# $OpenBSD: antarctica,v 1.49 2024/10/02 17:08:47 millert Exp $ # tzdb data for Antarctica and environs # This file is in the public domain, so clarified as of @@ -88,34 +88,34 @@ # Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Antarctica/Casey 0 - -00 1969 - 8:00 - +08 2009 Oct 18 2:00 - 11:00 - +11 2010 Mar 5 2:00 - 8:00 - +08 2011 Oct 28 2:00 - 11:00 - +11 2012 Feb 21 17:00u - 8:00 - +08 2016 Oct 22 - 11:00 - +11 2018 Mar 11 4:00 - 8:00 - +08 2018 Oct 7 4:00 - 11:00 - +11 2019 Mar 17 3:00 - 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 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 + 8:00 - %z 2009 Oct 18 2:00 + 11:00 - %z 2010 Mar 5 2:00 + 8:00 - %z 2011 Oct 28 2:00 + 11:00 - %z 2012 Feb 21 17:00u + 8:00 - %z 2016 Oct 22 + 11:00 - %z 2018 Mar 11 4:00 + 8:00 - %z 2018 Oct 7 4:00 + 11:00 - %z 2019 Mar 17 3:00 + 8:00 - %z 2019 Oct 4 3:00 + 11:00 - %z 2020 Mar 8 3:00 + 8:00 - %z 2020 Oct 4 0:01 + 11:00 - %z 2021 Mar 14 0:00 + 8:00 - %z 2021 Oct 3 0:01 + 11:00 - %z 2022 Mar 13 0:00 + 8:00 - %z 2022 Oct 2 0:01 + 11:00 - %z 2023 Mar 9 3:00 + 8:00 - %z Zone Antarctica/Davis 0 - -00 1957 Jan 13 - 7:00 - +07 1964 Nov + 7:00 - %z 1964 Nov 0 - -00 1969 Feb - 7:00 - +07 2009 Oct 18 2:00 - 5:00 - +05 2010 Mar 10 20:00u - 7:00 - +07 2011 Oct 28 2:00 - 5:00 - +05 2012 Feb 21 20:00u - 7:00 - +07 + 7:00 - %z 2009 Oct 18 2:00 + 5:00 - %z 2010 Mar 10 20:00u + 7:00 - %z 2011 Oct 28 2:00 + 5:00 - %z 2012 Feb 21 20:00u + 7:00 - %z Zone Antarctica/Mawson 0 - -00 1954 Feb 13 - 6:00 - +06 2009 Oct 18 2:00 - 5:00 - +05 + 6:00 - %z 2009 Oct 18 2:00 + 5:00 - %z # References: # Casey Weather (1998-02-26) # http://www.antdiv.gov.au/aad/exop/sfo/casey/casey_aws.html @@ -304,10 +304,10 @@ Zone Antarctica/Troll 0 - -00 2005 Feb 12 # Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Antarctica/Vostok 0 - -00 1957 Dec 16 - 7:00 - +07 1994 Feb + 7:00 - %z 1994 Feb 0 - -00 1994 Nov - 7:00 - +07 2023 Dec 18 2:00 - 5:00 - +05 + 7:00 - %z 2023 Dec 18 2:00 + 5:00 - %z # S Africa - year-round bases # Marion Island, -4653+03752 @@ -340,7 +340,7 @@ Zone Antarctica/Vostok 0 - -00 1957 Dec 16 # # Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Antarctica/Rothera 0 - -00 1976 Dec 1 - -3:00 - -03 + -3:00 - %z # Uruguay - year round base # Artigas, King George Island, -621104-0585107 diff --git a/share/zoneinfo/datfiles/asia b/share/zoneinfo/datfiles/asia index 99e738473..1724d131e 100644 --- a/share/zoneinfo/datfiles/asia +++ b/share/zoneinfo/datfiles/asia @@ -1,4 +1,4 @@ -# $OpenBSD: asia,v 1.109 2024/02/05 17:07:23 millert Exp $ +# $OpenBSD: asia,v 1.110 2024/10/02 17:08:47 millert Exp $ # tzdb data for Asia and environs # This file is in the public domain, so clarified as of @@ -84,8 +84,8 @@ Rule RussiaAsia 1996 2010 - Oct lastSun 2:00s 0 - # Afghanistan # Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Asia/Kabul 4:36:48 - LMT 1890 - 4:00 - +04 1945 - 4:30 - +0430 + 4:00 - %z 1945 + 4:30 - %z # Armenia # From Paul Eggert (2006-03-22): @@ -117,12 +117,12 @@ Rule Armenia 2011 only - Mar lastSun 2:00s 1:00 - Rule Armenia 2011 only - Oct lastSun 2:00s 0 - # Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Asia/Yerevan 2:58:00 - LMT 1924 May 2 - 3:00 - +03 1957 Mar - 4:00 RussiaAsia +04/+05 1991 Mar 31 2:00s - 3:00 RussiaAsia +03/+04 1995 Sep 24 2:00s - 4:00 - +04 1997 - 4:00 RussiaAsia +04/+05 2011 - 4:00 Armenia +04/+05 + 3:00 - %z 1957 Mar + 4:00 RussiaAsia %z 1991 Mar 31 2:00s + 3:00 RussiaAsia %z 1995 Sep 24 2:00s + 4:00 - %z 1997 + 4:00 RussiaAsia %z 2011 + 4:00 Armenia %z # Azerbaijan @@ -143,12 +143,12 @@ Rule Azer 1997 2015 - Mar lastSun 4:00 1:00 - Rule Azer 1997 2015 - Oct lastSun 5:00 0 - # Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Asia/Baku 3:19:24 - LMT 1924 May 2 - 3:00 - +03 1957 Mar - 4:00 RussiaAsia +04/+05 1991 Mar 31 2:00s - 3:00 RussiaAsia +03/+04 1992 Sep lastSun 2:00s - 4:00 - +04 1996 - 4:00 EUAsia +04/+05 1997 - 4:00 Azer +04/+05 + 3:00 - %z 1957 Mar + 4:00 RussiaAsia %z 1991 Mar 31 2:00s + 3:00 RussiaAsia %z 1992 Sep lastSun 2:00s + 4:00 - %z 1996 + 4:00 EUAsia %z 1997 + 4:00 Azer %z # Bahrain # Zone NAME STDOFF RULES FORMAT [UNTIL] @@ -236,17 +236,17 @@ Rule Dhaka 2009 only - Dec 31 24:00 0 - # Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Asia/Dhaka 6:01:40 - LMT 1890 5:53:20 - HMT 1941 Oct # Howrah Mean Time? - 6:30 - +0630 1942 May 15 - 5:30 - +0530 1942 Sep - 6:30 - +0630 1951 Sep 30 - 6:00 - +06 2009 - 6:00 Dhaka +06/+07 + 6:30 - %z 1942 May 15 + 5:30 - %z 1942 Sep + 6:30 - %z 1951 Sep 30 + 6:00 - %z 2009 + 6:00 Dhaka %z # Bhutan # Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Asia/Thimphu 5:58:36 - LMT 1947 Aug 15 # or Thimbu - 5:30 - +0530 1987 Oct - 6:00 - +06 + 5:30 - %z 1987 Oct + 6:00 - %z # British Indian Ocean Territory # Whitman and the 1995 CIA time zone map say 5:00, but the @@ -256,8 +256,8 @@ Zone Asia/Thimphu 5:58:36 - LMT 1947 Aug 15 # or Thimbu # then contained the Chagos Archipelago). # Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Indian/Chagos 4:49:40 - LMT 1907 - 5:00 - +05 1996 - 6:00 - +06 + 5:00 - %z 1996 + 6:00 - %z # Brunei # Zone NAME STDOFF RULES FORMAT [UNTIL] @@ -278,9 +278,9 @@ Zone Asia/Brunei 7:39:40 - LMT 1926 Mar # Bandar Seri Begawan # Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Asia/Yangon 6:24:47 - LMT 1880 # or Rangoon 6:24:47 - RMT 1920 # Rangoon local time - 6:30 - +0630 1942 May - 9:00 - +09 1945 May 3 - 6:30 - +0630 + 6:30 - %z 1942 May + 9:00 - %z 1945 May 3 + 6:30 - %z # Cambodia # Zone NAME STDOFF RULES FORMAT [UNTIL] @@ -678,7 +678,7 @@ Zone Asia/Shanghai 8:05:43 - LMT 1901 # Xinjiang time, used by many in western China; represented by Ürümqi / Ürümchi # / Wulumuqi. (Please use Asia/Shanghai if you prefer Beijing time.) Zone Asia/Urumqi 5:50:20 - LMT 1928 - 6:00 - +06 + 6:00 - %z # Hong Kong @@ -1136,7 +1136,7 @@ Rule Macau 1979 only - Oct Sun>=16 03:30 0 S # Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Asia/Macau 7:34:10 - LMT 1904 Oct 30 8:00 - CST 1941 Dec 21 23:00 - 9:00 Macau +09/+10 1945 Sep 30 24:00 + 9:00 Macau %z 1945 Sep 30 24:00 8:00 Macau C%sT @@ -1179,7 +1179,7 @@ Zone Asia/Nicosia 2:13:28 - LMT 1921 Nov 14 Zone Asia/Famagusta 2:15:48 - LMT 1921 Nov 14 2:00 Cyprus EE%sT 1998 Sep 2:00 EUAsia EE%sT 2016 Sep 8 - 3:00 - +03 2017 Oct 29 1:00u + 3:00 - %z 2017 Oct 29 1:00u 2:00 EUAsia EE%sT # Georgia @@ -1220,18 +1220,25 @@ Zone Asia/Famagusta 2:15:48 - LMT 1921 Nov 14 # Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Asia/Tbilisi 2:59:11 - LMT 1880 2:59:11 - TBMT 1924 May 2 # Tbilisi Mean Time - 3:00 - +03 1957 Mar - 4:00 RussiaAsia +04/+05 1991 Mar 31 2:00s - 3:00 RussiaAsia +03/+04 1992 - 3:00 E-EurAsia +03/+04 1994 Sep lastSun - 4:00 E-EurAsia +04/+05 1996 Oct lastSun - 4:00 1:00 +05 1997 Mar lastSun - 4:00 E-EurAsia +04/+05 2004 Jun 27 - 3:00 RussiaAsia +03/+04 2005 Mar lastSun 2:00 - 4:00 - +04 + 3:00 - %z 1957 Mar + 4:00 RussiaAsia %z 1991 Mar 31 2:00s + 3:00 RussiaAsia %z 1992 + 3:00 E-EurAsia %z 1994 Sep lastSun + 4:00 E-EurAsia %z 1996 Oct lastSun + 4:00 1:00 %z 1997 Mar lastSun + 4:00 E-EurAsia %z 2004 Jun 27 + 3:00 RussiaAsia %z 2005 Mar lastSun 2:00 + 4:00 - %z # East Timor +# From Tim Parenti (2024-07-01): +# The 1912-01-01 transition occurred at 00:00 new time, per the 1911-05-24 +# Portuguese decree (see Europe/Lisbon). A provision in article 5(c) of the +# decree prescribed that Timor "will keep counting time in harmony with +# neighboring foreign colonies, [for] as long as they do not adopt the time +# that belongs to them in [the Washington Convention] system." + # See Indonesia for the 1945 transition. # From João Carrascalão, brother of the former governor of East Timor, in @@ -1255,11 +1262,11 @@ Zone Asia/Tbilisi 2:59:11 - LMT 1880 # midnight on Saturday, September 16. # Zone NAME STDOFF RULES FORMAT [UNTIL] -Zone Asia/Dili 8:22:20 - LMT 1912 Jan 1 - 8:00 - +08 1942 Feb 21 23:00 - 9:00 - +09 1976 May 3 - 8:00 - +08 2000 Sep 17 0:00 - 9:00 - +09 +Zone Asia/Dili 8:22:20 - LMT 1911 Dec 31 16:00u + 8:00 - %z 1942 Feb 21 23:00 + 9:00 - %z 1976 May 3 + 8:00 - %z 2000 Sep 17 0:00 + 9:00 - %z # India @@ -1325,9 +1332,9 @@ Zone Asia/Kolkata 5:53:28 - LMT 1854 Jun 28 # Kolkata 5:53:20 - HMT 1870 # Howrah Mean Time? 5:21:10 - MMT 1906 Jan 1 # Madras local time 5:30 - IST 1941 Oct - 5:30 1:00 +0630 1942 May 15 + 5:30 1:00 %z 1942 May 15 5:30 - IST 1942 Sep - 5:30 1:00 +0630 1945 Oct 15 + 5:30 1:00 %z 1945 Oct 15 5:30 - IST # Since 1970 the following are like Asia/Kolkata: # Andaman Is @@ -1379,33 +1386,33 @@ Zone Asia/Jakarta 7:07:12 - LMT 1867 Aug 10 # Shanks & Pottenger say the next transition was at 1924 Jan 1 0:13, # but this must be a typo. 7:07:12 - BMT 1923 Dec 31 16:40u # Batavia - 7:20 - +0720 1932 Nov - 7:30 - +0730 1942 Mar 23 - 9:00 - +09 1945 Sep 23 - 7:30 - +0730 1948 May - 8:00 - +08 1950 May - 7:30 - +0730 1964 + 7:20 - %z 1932 Nov + 7:30 - %z 1942 Mar 23 + 9:00 - %z 1945 Sep 23 + 7:30 - %z 1948 May + 8:00 - %z 1950 May + 7:30 - %z 1964 7:00 - WIB # west and central Borneo Zone Asia/Pontianak 7:17:20 - LMT 1908 May 7:17:20 - PMT 1932 Nov # Pontianak MT - 7:30 - +0730 1942 Jan 29 - 9:00 - +09 1945 Sep 23 - 7:30 - +0730 1948 May - 8:00 - +08 1950 May - 7:30 - +0730 1964 + 7:30 - %z 1942 Jan 29 + 9:00 - %z 1945 Sep 23 + 7:30 - %z 1948 May + 8:00 - %z 1950 May + 7:30 - %z 1964 8:00 - WITA 1988 Jan 1 7:00 - WIB # Sulawesi, Lesser Sundas, east and south Borneo Zone Asia/Makassar 7:57:36 - LMT 1920 7:57:36 - MMT 1932 Nov # Macassar MT - 8:00 - +08 1942 Feb 9 - 9:00 - +09 1945 Sep 23 + 8:00 - %z 1942 Feb 9 + 9:00 - %z 1945 Sep 23 8:00 - WITA # Maluku Islands, West Papua, Papua Zone Asia/Jayapura 9:22:48 - LMT 1932 Nov - 9:00 - +09 1944 Sep 1 - 9:30 - +0930 1964 + 9:00 - %z 1944 Sep 1 + 9:30 - %z 1964 9:00 - WIT # Iran @@ -1641,9 +1648,9 @@ Rule Iran 2021 2022 - Sep 21 24:00 0 - # Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Asia/Tehran 3:25:44 - LMT 1916 3:25:44 - TMT 1935 Jun 13 # Tehran Mean Time - 3:30 Iran +0330/+0430 1977 Oct 20 24:00 - 4:00 Iran +04/+05 1979 - 3:30 Iran +0330/+0430 + 3:30 Iran %z 1977 Oct 20 24:00 + 4:00 Iran %z 1979 + 3:30 Iran %z # Iraq @@ -1686,8 +1693,8 @@ Rule Iraq 1991 2007 - Oct 1 3:00s 0 - # Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Asia/Baghdad 2:57:40 - LMT 1890 2:57:36 - BMT 1918 # Baghdad Mean Time? - 3:00 - +03 1982 May - 3:00 Iraq +03/+04 + 3:00 - %z 1982 May + 3:00 Iraq %z ############################################################################### @@ -2284,7 +2291,7 @@ Rule Jordan 2022 only - Feb lastThu 24:00 1:00 S # Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Asia/Amman 2:23:44 - LMT 1931 2:00 Jordan EE%sT 2022 Oct 28 0:00s - 3:00 - +03 + 3:00 - %z # Kazakhstan @@ -2495,88 +2502,88 @@ Zone Asia/Amman 2:23:44 - LMT 1931 # Almaty (formerly Alma-Ata), representing most locations in Kazakhstan # This includes Abai/Abay (ISO 3166-2 code KZ-10), Aqmola/Akmola (KZ-11), # Almaty (KZ-19), Almaty city (KZ-75), Astana city (KZ-71), -# East Kazkhstan (KZ-63), Jambyl/Zhambyl (KZ-31), Jetisu/Zhetysu (KZ-33), +# East Kazakhstan (KZ-63), Jambyl/Zhambyl (KZ-31), Jetisu/Zhetysu (KZ-33), # Karaganda (KZ-35), North Kazakhstan (KZ-59), Pavlodar (KZ-55), -# Shyumkent city (KZ-79), Turkistan (KZ-61), and Ulytau (KZ-62). +# Shymkent city (KZ-79), Turkistan (KZ-61), and Ulytau (KZ-62). Zone Asia/Almaty 5:07:48 - LMT 1924 May 2 # or Alma-Ata - 5:00 - +05 1930 Jun 21 - 6:00 RussiaAsia +06/+07 1991 Mar 31 2:00s - 5:00 RussiaAsia +05/+06 1992 Jan 19 2:00s - 6:00 RussiaAsia +06/+07 2004 Oct 31 2:00s - 6:00 - +06 2024 Mar 1 0:00 - 5:00 - +05 + 5:00 - %z 1930 Jun 21 + 6:00 RussiaAsia %z 1991 Mar 31 2:00s + 5:00 RussiaAsia %z 1992 Jan 19 2:00s + 6:00 RussiaAsia %z 2004 Oct 31 2:00s + 6:00 - %z 2024 Mar 1 0:00 + 5:00 - %z # Qyzylorda (aka Kyzylorda, Kizilorda, Kzyl-Orda, etc.) (KZ-43) Zone Asia/Qyzylorda 4:21:52 - LMT 1924 May 2 - 4:00 - +04 1930 Jun 21 - 5:00 - +05 1981 Apr 1 - 5:00 1:00 +06 1981 Oct 1 - 6:00 - +06 1982 Apr 1 - 5:00 RussiaAsia +05/+06 1991 Mar 31 2:00s - 4:00 RussiaAsia +04/+05 1991 Sep 29 2:00s - 5:00 RussiaAsia +05/+06 1992 Jan 19 2:00s - 6:00 RussiaAsia +06/+07 1992 Mar 29 2:00s - 5:00 RussiaAsia +05/+06 2004 Oct 31 2:00s - 6:00 - +06 2018 Dec 21 0:00 - 5:00 - +05 + 4:00 - %z 1930 Jun 21 + 5:00 - %z 1981 Apr 1 + 5:00 1:00 %z 1981 Oct 1 + 6:00 - %z 1982 Apr 1 + 5:00 RussiaAsia %z 1991 Mar 31 2:00s + 4:00 RussiaAsia %z 1991 Sep 29 2:00s + 5:00 RussiaAsia %z 1992 Jan 19 2:00s + 6:00 RussiaAsia %z 1992 Mar 29 2:00s + 5:00 RussiaAsia %z 2004 Oct 31 2:00s + 6:00 - %z 2018 Dec 21 0:00 + 5:00 - %z # Qostanay (aka Kostanay, Kustanay) (KZ-39) # The 1991/2 rules are unclear partly because of the 1997 Turgai # reorganization. Zone Asia/Qostanay 4:14:28 - LMT 1924 May 2 - 4:00 - +04 1930 Jun 21 - 5:00 - +05 1981 Apr 1 - 5:00 1:00 +06 1981 Oct 1 - 6:00 - +06 1982 Apr 1 - 5:00 RussiaAsia +05/+06 1991 Mar 31 2:00s - 4:00 RussiaAsia +04/+05 1992 Jan 19 2:00s - 5:00 RussiaAsia +05/+06 2004 Oct 31 2:00s - 6:00 - +06 2024 Mar 1 0:00 - 5:00 - +05 + 4:00 - %z 1930 Jun 21 + 5:00 - %z 1981 Apr 1 + 5:00 1:00 %z 1981 Oct 1 + 6:00 - %z 1982 Apr 1 + 5:00 RussiaAsia %z 1991 Mar 31 2:00s + 4:00 RussiaAsia %z 1992 Jan 19 2:00s + 5:00 RussiaAsia %z 2004 Oct 31 2:00s + 6:00 - %z 2024 Mar 1 0:00 + 5:00 - %z # Aqtöbe (aka Aktobe, formerly Aktyubinsk) (KZ-15) Zone Asia/Aqtobe 3:48:40 - LMT 1924 May 2 - 4:00 - +04 1930 Jun 21 - 5:00 - +05 1981 Apr 1 - 5:00 1:00 +06 1981 Oct 1 - 6:00 - +06 1982 Apr 1 - 5:00 RussiaAsia +05/+06 1991 Mar 31 2:00s - 4:00 RussiaAsia +04/+05 1992 Jan 19 2:00s - 5:00 RussiaAsia +05/+06 2004 Oct 31 2:00s - 5:00 - +05 + 4:00 - %z 1930 Jun 21 + 5:00 - %z 1981 Apr 1 + 5:00 1:00 %z 1981 Oct 1 + 6:00 - %z 1982 Apr 1 + 5:00 RussiaAsia %z 1991 Mar 31 2:00s + 4:00 RussiaAsia %z 1992 Jan 19 2:00s + 5:00 RussiaAsia %z 2004 Oct 31 2:00s + 5:00 - %z # Mangghystaū (KZ-47) # Aqtau was not founded until 1963, but it represents an inhabited region, # so include timestamps before 1963. Zone Asia/Aqtau 3:21:04 - LMT 1924 May 2 - 4:00 - +04 1930 Jun 21 - 5:00 - +05 1981 Oct 1 - 6:00 - +06 1982 Apr 1 - 5:00 RussiaAsia +05/+06 1991 Mar 31 2:00s - 4:00 RussiaAsia +04/+05 1992 Jan 19 2:00s - 5:00 RussiaAsia +05/+06 1994 Sep 25 2:00s - 4:00 RussiaAsia +04/+05 2004 Oct 31 2:00s - 5:00 - +05 + 4:00 - %z 1930 Jun 21 + 5:00 - %z 1981 Oct 1 + 6:00 - %z 1982 Apr 1 + 5:00 RussiaAsia %z 1991 Mar 31 2:00s + 4:00 RussiaAsia %z 1992 Jan 19 2:00s + 5:00 RussiaAsia %z 1994 Sep 25 2:00s + 4:00 RussiaAsia %z 2004 Oct 31 2:00s + 5:00 - %z # Atyraū (KZ-23) is like Mangghystaū except it switched from # +04/+05 to +05/+06 in spring 1999, not fall 1994. Zone Asia/Atyrau 3:27:44 - LMT 1924 May 2 - 3:00 - +03 1930 Jun 21 - 5:00 - +05 1981 Oct 1 - 6:00 - +06 1982 Apr 1 - 5:00 RussiaAsia +05/+06 1991 Mar 31 2:00s - 4:00 RussiaAsia +04/+05 1992 Jan 19 2:00s - 5:00 RussiaAsia +05/+06 1999 Mar 28 2:00s - 4:00 RussiaAsia +04/+05 2004 Oct 31 2:00s - 5:00 - +05 + 3:00 - %z 1930 Jun 21 + 5:00 - %z 1981 Oct 1 + 6:00 - %z 1982 Apr 1 + 5:00 RussiaAsia %z 1991 Mar 31 2:00s + 4:00 RussiaAsia %z 1992 Jan 19 2:00s + 5:00 RussiaAsia %z 1999 Mar 28 2:00s + 4:00 RussiaAsia %z 2004 Oct 31 2:00s + 5:00 - %z # West Kazakhstan (KZ-27) # From Paul Eggert (2016-03-18): # The 1989 transition is from USSR act No. 227 (1989-03-14). Zone Asia/Oral 3:25:24 - LMT 1924 May 2 # or Ural'sk - 3:00 - +03 1930 Jun 21 - 5:00 - +05 1981 Apr 1 - 5:00 1:00 +06 1981 Oct 1 - 6:00 - +06 1982 Apr 1 - 5:00 RussiaAsia +05/+06 1989 Mar 26 2:00s - 4:00 RussiaAsia +04/+05 1992 Jan 19 2:00s - 5:00 RussiaAsia +05/+06 1992 Mar 29 2:00s - 4:00 RussiaAsia +04/+05 2004 Oct 31 2:00s - 5:00 - +05 + 3:00 - %z 1930 Jun 21 + 5:00 - %z 1981 Apr 1 + 5:00 1:00 %z 1981 Oct 1 + 6:00 - %z 1982 Apr 1 + 5:00 RussiaAsia %z 1989 Mar 26 2:00s + 4:00 RussiaAsia %z 1992 Jan 19 2:00s + 5:00 RussiaAsia %z 1992 Mar 29 2:00s + 4:00 RussiaAsia %z 2004 Oct 31 2:00s + 5:00 - %z # Kyrgyzstan (Kirgizstan) # Transitions through 1991 are from Shanks & Pottenger. @@ -2597,11 +2604,11 @@ Rule Kyrgyz 1997 2005 - Mar lastSun 2:30 1:00 - Rule Kyrgyz 1997 2004 - Oct lastSun 2:30 0 - # Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Asia/Bishkek 4:58:24 - LMT 1924 May 2 - 5:00 - +05 1930 Jun 21 - 6:00 RussiaAsia +06/+07 1991 Mar 31 2:00s - 5:00 RussiaAsia +05/+06 1991 Aug 31 2:00 - 5:00 Kyrgyz +05/+06 2005 Aug 12 - 6:00 - +06 + 5:00 - %z 1930 Jun 21 + 6:00 RussiaAsia %z 1991 Mar 31 2:00s + 5:00 RussiaAsia %z 1991 Aug 31 2:00 + 5:00 Kyrgyz %z 2005 Aug 12 + 6:00 - %z ############################################################################### @@ -2832,16 +2839,16 @@ Zone Asia/Kuala_Lumpur 6:46:46 - LMT 1901 Jan 1 # and 1982 transition dates are from Mok Ly Yng. # Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Asia/Kuching 7:21:20 - LMT 1926 Mar - 7:30 - +0730 1933 - 8:00 NBorneo +08/+0820 1942 Feb 16 - 9:00 - +09 1945 Sep 12 - 8:00 - +08 + 7:30 - %z 1933 + 8:00 NBorneo %z 1942 Feb 16 + 9:00 - %z 1945 Sep 12 + 8:00 - %z # Maldives # Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Indian/Maldives 4:54:00 - LMT 1880 # Malé 4:54:00 - MMT 1960 # Malé Mean Time - 5:00 - +05 + 5:00 - %z # Mongolia @@ -2943,9 +2950,37 @@ Zone Indian/Maldives 4:54:00 - LMT 1880 # Malé # From Arthur David Olson (2008-05-19): # Assume that Choibalsan is indeed offset by 8:00. -# XXX--in the absence of better information, assume that transition -# was at the start of 2008-03-31 (the day of Steffen Thorsen's report); -# this is almost surely wrong. + +# From Heitor David Pinto (2024-06-23): +# Sources about time zones in Mongolia seem to list one of two conflicting +# configurations. The first configuration, mentioned in a comment to the TZ +# database in 1999, citing a Mongolian government website, lists the provinces +# of Bayan-Ölgii, Khovd and Uvs in UTC+7, and the rest of the country in +# UTC+8. The second configuration, mentioned in a comment to the database in +# 2001, lists Bayan-Ölgii, Khovd, Uvs, Govi-Altai and Zavkhan in UTC+7, Dornod +# and Sükhbaatar in UTC+9, and the rest of the country in UTC+8. +# +# The first configuration is still mentioned by several Mongolian travel +# agencies: +# https://www.adventurerider.mn/en/page/about_mongolia +# http://www.naturetours.mn/nt/mongolia.php +# https://www.newjuulchin.mn/web/content/7506?unique=fa24a0f6e96e022a3578ee5195ac879638c734ce +# +# It also matches these flight schedules in 2013: +# http://web.archive.org/web/20130722023600/https://www.hunnuair.com/en/timetabled +# The flight times imply that the airports of Uliastai (Zavkhan), Choibalsan +# (Dornod) and Altai (Govi-Altai) are in the same time zone as Ulaanbaatar, +# and Khovd is one hour behind.... +# +# The second configuration was mentioned by an official of the Mongolian +# standards agency in an interview in 2014: https://ikon.mn/n/9v6 +# And it's still listed by the Mongolian aviation agency: +# https://ais.mn/files/aip/eAIP/2023-12-25/html/eSUP/ZM-eSUP-23-04-en-MN.html +# +# ... I believe that the first configuration is what is actually observed in +# Mongolia and has been so all along, at least since 1999. The second +# configuration closely matches the ideal time zone boundaries at 97.5° E and +# 112.5° E but it doesn't seem to be used in practice. # From Ganbold Tsagaankhuu (2015-03-10): # It seems like yesterday Mongolian Government meeting has concluded to use @@ -2984,25 +3019,18 @@ Rule Mongol 2015 2016 - Sep lastSat 0:00 0 - # Zone NAME STDOFF RULES FORMAT [UNTIL] # Hovd, a.k.a. Chovd, Dund-Us, Dzhargalant, Khovd, Jirgalanta Zone Asia/Hovd 6:06:36 - LMT 1905 Aug - 6:00 - +06 1978 - 7:00 Mongol +07/+08 + 6:00 - %z 1978 + 7:00 Mongol %z # Ulaanbaatar, a.k.a. Ulan Bataar, Ulan Bator, Urga Zone Asia/Ulaanbaatar 7:07:32 - LMT 1905 Aug - 7:00 - +07 1978 - 8:00 Mongol +08/+09 -# Choibalsan, a.k.a. Bajan Tümen, Bajan Tumen, Chojbalsan, -# Choybalsan, Sanbejse, Tchoibalsan -Zone Asia/Choibalsan 7:38:00 - LMT 1905 Aug - 7:00 - +07 1978 - 8:00 - +08 1983 Apr - 9:00 Mongol +09/+10 2008 Mar 31 - 8:00 Mongol +08/+09 + 7:00 - %z 1978 + 8:00 Mongol %z # Nepal # Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Asia/Kathmandu 5:41:16 - LMT 1920 - 5:30 - +0530 1986 - 5:45 - +0545 + 5:30 - %z 1986 + 5:45 - %z # Oman # Zone NAME STDOFF RULES FORMAT [UNTIL] @@ -3153,10 +3181,10 @@ Rule Pakistan 2009 only - Apr 15 0:00 1:00 S # Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Asia/Karachi 4:28:12 - LMT 1907 - 5:30 - +0530 1942 Sep - 5:30 1:00 +0630 1945 Oct 15 - 5:30 - +0530 1951 Sep 30 - 5:00 - +05 1971 Mar 26 + 5:30 - %z 1942 Sep + 5:30 1:00 %z 1945 Oct 15 + 5:30 - %z 1951 Sep 30 + 5:00 - %z 1971 Mar 26 5:00 Pakistan PK%sT # Pakistan Time # Palestine @@ -3704,14 +3732,14 @@ Zone Asia/Hebron 2:20:23 - LMT 1900 Oct # Philippine Star 2014-08-05 # http://www.philstar.com/headlines/2014/08/05/1354152/pnoy-urged-declare-use-daylight-saving-time -# From Paul Goyette (2018-06-15): +# From Paul Goyette (2018-06-15) with URLs updated by Guy Harris (2024-02-15): # In the Philippines, there is a national law, Republic Act No. 10535 # which declares the official time here as "Philippine Standard Time". # The act [1] even specifies use of PST as the abbreviation, although # the FAQ provided by PAGASA [2] uses the "acronym PhST to distinguish # it from the Pacific Standard Time (PST)." -# [1] http://www.officialgazette.gov.ph/2013/05/15/republic-act-no-10535/ -# [2] https://www1.pagasa.dost.gov.ph/index.php/astronomy/philippine-standard-time#republic-act-10535 +# [1] https://www.officialgazette.gov.ph/2013/05/15/republic-act-no-10535/ +# [2] https://prsd.pagasa.dost.gov.ph/index.php/28-astronomy/302-philippine-standard-time # # From Paul Eggert (2018-06-19): # I surveyed recent news reports, and my impression is that "PST" is @@ -3743,8 +3771,8 @@ Zone Asia/Manila -15:56:00 - LMT 1844 Dec 31 # Qatar # Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Asia/Qatar 3:26:08 - LMT 1920 # Al Dawhah / Doha - 4:00 - +04 1972 Jun - 3:00 - +03 + 4:00 - %z 1972 Jun + 3:00 - %z # Saudi Arabia # @@ -3792,7 +3820,7 @@ Zone Asia/Qatar 3:26:08 - LMT 1920 # Al Dawhah / Doha # # Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Asia/Riyadh 3:06:52 - LMT 1947 Mar 14 - 3:00 - +03 + 3:00 - %z # Singapore # taken from Mok Ly Yng (2003-10-30) @@ -3800,13 +3828,13 @@ Zone Asia/Riyadh 3:06:52 - LMT 1947 Mar 14 # Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Asia/Singapore 6:55:25 - LMT 1901 Jan 1 6:55:25 - SMT 1905 Jun 1 # Singapore M.T. - 7:00 - +07 1933 Jan 1 - 7:00 0:20 +0720 1936 Jan 1 - 7:20 - +0720 1941 Sep 1 - 7:30 - +0730 1942 Feb 16 - 9:00 - +09 1945 Sep 12 - 7:30 - +0730 1981 Dec 31 16:00u - 8:00 - +08 + 7:00 - %z 1933 Jan 1 + 7:00 0:20 %z 1936 Jan 1 + 7:20 - %z 1941 Sep 1 + 7:30 - %z 1942 Feb 16 + 9:00 - %z 1945 Sep 12 + 7:30 - %z 1981 Dec 31 16:00u + 8:00 - %z # Spratly Is # no information @@ -3864,13 +3892,13 @@ Zone Asia/Singapore 6:55:25 - LMT 1901 Jan 1 # Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Asia/Colombo 5:19:24 - LMT 1880 5:19:32 - MMT 1906 # Moratuwa Mean Time - 5:30 - +0530 1942 Jan 5 - 5:30 0:30 +06 1942 Sep - 5:30 1:00 +0630 1945 Oct 16 2:00 - 5:30 - +0530 1996 May 25 0:00 - 6:30 - +0630 1996 Oct 26 0:30 - 6:00 - +06 2006 Apr 15 0:30 - 5:30 - +0530 + 5:30 - %z 1942 Jan 5 + 5:30 0:30 %z 1942 Sep + 5:30 1:00 %z 1945 Oct 16 2:00 + 5:30 - %z 1996 May 25 0:00 + 6:30 - %z 1996 Oct 26 0:30 + 6:00 - %z 2006 Apr 15 0:30 + 5:30 - %z # Syria # Rule NAME FROM TO - IN ON AT SAVE LETTER/S @@ -4041,56 +4069,56 @@ Rule Syria 2009 2022 - Oct lastFri 0:00 0 - # Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Asia/Damascus 2:25:12 - LMT 1920 # Dimashq 2:00 Syria EE%sT 2022 Oct 28 0:00 - 3:00 - +03 + 3:00 - %z # Tajikistan # From Shanks & Pottenger. # Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Asia/Dushanbe 4:35:12 - LMT 1924 May 2 - 5:00 - +05 1930 Jun 21 - 6:00 RussiaAsia +06/+07 1991 Mar 31 2:00s - 5:00 1:00 +06 1991 Sep 9 2:00s - 5:00 - +05 + 5:00 - %z 1930 Jun 21 + 6:00 RussiaAsia %z 1991 Mar 31 2:00s + 5:00 1:00 %z 1991 Sep 9 2:00s + 5:00 - %z # Thailand # Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Asia/Bangkok 6:42:04 - LMT 1880 6:42:04 - BMT 1920 Apr # Bangkok Mean Time - 7:00 - +07 + 7:00 - %z # Turkmenistan # From Shanks & Pottenger. # Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Asia/Ashgabat 3:53:32 - LMT 1924 May 2 # or Ashkhabad - 4:00 - +04 1930 Jun 21 - 5:00 RussiaAsia +05/+06 1991 Mar 31 2:00 - 4:00 RussiaAsia +04/+05 1992 Jan 19 2:00 - 5:00 - +05 + 4:00 - %z 1930 Jun 21 + 5:00 RussiaAsia %z 1991 Mar 31 2:00 + 4:00 RussiaAsia %z 1992 Jan 19 2:00 + 5:00 - %z # United Arab Emirates # # The Crozet Is also observe Réunion time; see the 'antarctica' file. # Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Asia/Dubai 3:41:12 - LMT 1920 - 4:00 - +04 + 4:00 - %z # Uzbekistan # Byalokoz 1919 says Uzbekistan was 4:27:53. # Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Asia/Samarkand 4:27:53 - LMT 1924 May 2 - 4:00 - +04 1930 Jun 21 - 5:00 - +05 1981 Apr 1 - 5:00 1:00 +06 1981 Oct 1 - 6:00 - +06 1982 Apr 1 - 5:00 RussiaAsia +05/+06 1992 - 5:00 - +05 + 4:00 - %z 1930 Jun 21 + 5:00 - %z 1981 Apr 1 + 5:00 1:00 %z 1981 Oct 1 + 6:00 - %z 1982 Apr 1 + 5:00 RussiaAsia %z 1992 + 5:00 - %z # Milne says Tashkent was 4:37:10.8. #STDOFF 4:37:10.8 Zone Asia/Tashkent 4:37:11 - LMT 1924 May 2 - 5:00 - +05 1930 Jun 21 - 6:00 RussiaAsia +06/+07 1991 Mar 31 2:00 - 5:00 RussiaAsia +05/+06 1992 - 5:00 - +05 + 5:00 - %z 1930 Jun 21 + 6:00 RussiaAsia %z 1991 Mar 31 2:00 + 5:00 RussiaAsia %z 1992 + 5:00 - %z # Vietnam (southern) @@ -4148,7 +4176,7 @@ Zone Asia/Tashkent 4:37:11 - LMT 1924 May 2 # Võ Nguyên Giáp, Việt Nam Dân Quốc Công Báo, No. 1 (1945-09-29), page 13 # http://baochi.nlv.gov.vn/baochi/cgi-bin/baochi?a=d&d=JwvzO19450929.2.5&dliv=none # It says that on 1945-09-01 at 24:00, Vietnam moved back two hours, to +07. -# It also mentions a 1945-03-29 decree (by a Japanese Goveror-General) +# It also mentions a 1945-03-29 decree (by a Japanese Governor-General) # to set the time zone to +09, but does not say whether that decree # merely legalized an earlier change to +09. # @@ -4169,14 +4197,14 @@ Zone Asia/Tashkent 4:37:11 - LMT 1924 May 2 #STDOFF 7:06:30.13 Zone Asia/Ho_Chi_Minh 7:06:30 - LMT 1906 Jul 1 7:06:30 - PLMT 1911 May 1 # Phù Liễn MT - 7:00 - +07 1942 Dec 31 23:00 - 8:00 - +08 1945 Mar 14 23:00 - 9:00 - +09 1945 Sep 1 24:00 - 7:00 - +07 1947 Apr 1 - 8:00 - +08 1955 Jul 1 01:00 - 7:00 - +07 1959 Dec 31 23:00 - 8:00 - +08 1975 Jun 13 - 7:00 - +07 + 7:00 - %z 1942 Dec 31 23:00 + 8:00 - %z 1945 Mar 14 23:00 + 9:00 - %z 1945 Sep 1 24:00 + 7:00 - %z 1947 Apr 1 + 8:00 - %z 1955 Jul 1 01:00 + 7:00 - %z 1959 Dec 31 23:00 + 8:00 - %z 1975 Jun 13 + 7:00 - %z # From Paul Eggert (2019-02-19): # diff --git a/share/zoneinfo/datfiles/australasia b/share/zoneinfo/datfiles/australasia index 9bd68e21f..e9cee36db 100644 --- a/share/zoneinfo/datfiles/australasia +++ b/share/zoneinfo/datfiles/australasia @@ -1,4 +1,4 @@ -# $OpenBSD: australasia,v 1.79 2024/02/05 17:07:23 millert Exp $ +# $OpenBSD: australasia,v 1.80 2024/10/02 17:08:47 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 @@ -44,8 +44,8 @@ Zone Australia/Perth 7:43:24 - LMT 1895 Dec 8:00 Aus AW%sT 1943 Jul 8:00 AW AW%sT Zone Australia/Eucla 8:35:28 - LMT 1895 Dec - 8:45 Aus +0845/+0945 1943 Jul - 8:45 AW +0845/+0945 + 8:45 Aus %z 1943 Jul + 8:45 AW %z # Queensland # @@ -210,8 +210,8 @@ Rule LH 2008 max - Apr Sun>=1 2:00 0 - Rule LH 2008 max - Oct Sun>=1 2:00 0:30 - Zone Australia/Lord_Howe 10:36:20 - LMT 1895 Feb 10:00 - AEST 1981 Mar - 10:30 LH +1030/+1130 1985 Jul - 10:30 LH +1030/+11 + 10:30 LH %z 1985 Jul + 10:30 LH %z # Australian miscellany # @@ -427,16 +427,16 @@ Rule Fiji 2019 only - Nov Sun>=8 2:00 1:00 - Rule Fiji 2020 only - Dec 20 2:00 1:00 - # Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Pacific/Fiji 11:55:44 - LMT 1915 Oct 26 # Suva - 12:00 Fiji +12/+13 + 12:00 Fiji %z # French Polynesia # Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Pacific/Gambier -8:59:48 - LMT 1912 Oct 1 # Rikitea - -9:00 - -09 + -9:00 - %z Zone Pacific/Marquesas -9:18:00 - LMT 1912 Oct 1 - -9:30 - -0930 + -9:30 - %z Zone Pacific/Tahiti -9:58:16 - LMT 1912 Oct 1 # Papeete - -10:00 - -10 + -10:00 - %z # Clipperton (near North America) is administered from French Polynesia; # it is uninhabited. @@ -478,7 +478,7 @@ Rule Guam 1977 only - Aug 28 2:00 0 S Zone Pacific/Guam -14:21:00 - LMT 1844 Dec 31 9:39:00 - LMT 1901 # Agana 10:00 - GST 1941 Dec 10 # Guam - 9:00 - +09 1944 Jul 31 + 9:00 - %z 1944 Jul 31 10:00 Guam G%sT 2000 Dec 23 10:00 - ChST # Chamorro Standard Time @@ -486,18 +486,18 @@ Zone Pacific/Guam -14:21:00 - LMT 1844 Dec 31 # Kiribati (Gilbert Is) # Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Pacific/Tarawa 11:32:04 - LMT 1901 # Bairiki - 12:00 - +12 + 12:00 - %z # Kiribati (except Gilbert Is) # Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Pacific/Kanton 0 - -00 1937 Aug 31 - -12:00 - -12 1979 Oct - -11:00 - -11 1994 Dec 31 - 13:00 - +13 + -12:00 - %z 1979 Oct + -11:00 - %z 1994 Dec 31 + 13:00 - %z Zone Pacific/Kiritimati -10:29:20 - LMT 1901 - -10:40 - -1040 1979 Oct - -10:00 - -10 1994 Dec 31 - 14:00 - +14 + -10:40 - %z 1979 Oct + -10:00 - %z 1994 Dec 31 + 14:00 - %z # N Mariana Is # Zone NAME STDOFF RULES FORMAT [UNTIL] @@ -520,12 +520,12 @@ Zone Pacific/Majuro 11:24:48 - LMT 1901 # Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Pacific/Kwajalein 11:09:20 - LMT 1901 - 11:00 - +11 1937 - 10:00 - +10 1941 Apr 1 - 9:00 - +09 1944 Feb 6 - 11:00 - +11 1969 Oct - -12:00 - -12 1993 Aug 20 24:00 - 12:00 - +12 + 11:00 - %z 1937 + 10:00 - %z 1941 Apr 1 + 9:00 - %z 1944 Feb 6 + 11:00 - %z 1969 Oct + -12:00 - %z 1993 Aug 20 24:00 + 12:00 - %z # Micronesia # Zone NAME STDOFF RULES FORMAT [UNTIL] @@ -550,22 +550,22 @@ Zone Pacific/Pohnpei -13:27:08 - LMT 1844 Dec 31 # Kolonia # Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Pacific/Kosrae -13:08:04 - LMT 1844 Dec 31 10:51:56 - LMT 1901 - 11:00 - +11 1914 Oct - 9:00 - +09 1919 Feb 1 - 11:00 - +11 1937 - 10:00 - +10 1941 Apr 1 - 9:00 - +09 1945 Aug - 11:00 - +11 1969 Oct - 12:00 - +12 1999 - 11:00 - +11 + 11:00 - %z 1914 Oct + 9:00 - %z 1919 Feb 1 + 11:00 - %z 1937 + 10:00 - %z 1941 Apr 1 + 9:00 - %z 1945 Aug + 11:00 - %z 1969 Oct + 12:00 - %z 1999 + 11:00 - %z # Nauru # Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Pacific/Nauru 11:07:40 - LMT 1921 Jan 15 # Uaobe - 11:30 - +1130 1942 Aug 29 - 9:00 - +09 1945 Sep 8 - 11:30 - +1130 1979 Feb 10 2:00 - 12:00 - +12 + 11:30 - %z 1942 Aug 29 + 9:00 - %z 1945 Sep 8 + 11:30 - %z 1979 Feb 10 2:00 + 12:00 - %z # New Caledonia # Rule NAME FROM TO - IN ON AT SAVE LETTER/S @@ -576,7 +576,7 @@ Rule NC 1996 only - Dec 1 2:00s 1:00 - Rule NC 1997 only - Mar 2 2:00s 0 - # Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Pacific/Noumea 11:05:48 - LMT 1912 Jan 13 # Nouméa - 11:00 NC +11/+12 + 11:00 NC %z ############################################################################### @@ -624,8 +624,8 @@ Zone Antarctica/McMurdo 0 - -00 1956 12:00 NZ NZ%sT Zone Pacific/Chatham 12:13:48 - LMT 1868 Nov 2 - 12:15 - +1215 1946 Jan 1 - 12:45 Chatham +1245/+1345 + 12:15 - %z 1946 Jan 1 + 12:45 Chatham %z # Auckland Is # uninhabited; Māori and Moriori, colonial settlers, pastoralists, sealers, @@ -678,8 +678,8 @@ Rule Cook 1979 1990 - Oct lastSun 0:00 0:30 - # Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Pacific/Rarotonga 13:20:56 - LMT 1899 Dec 26 # Avarua -10:39:04 - LMT 1952 Oct 16 - -10:30 - -1030 1978 Nov 12 - -10:00 Cook -10/-0930 + -10:30 - %z 1978 Nov 12 + -10:00 Cook %z ############################################################################### @@ -696,30 +696,30 @@ Zone Pacific/Rarotonga 13:20:56 - LMT 1899 Dec 26 # Avarua # Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Pacific/Niue -11:19:40 - LMT 1952 Oct 16 # Alofi - -11:20 - -1120 1964 Jul - -11:00 - -11 + -11:20 - %z 1964 Jul + -11:00 - %z # Norfolk # Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Pacific/Norfolk 11:11:52 - LMT 1901 # Kingston - 11:12 - +1112 1951 - 11:30 - +1130 1974 Oct 27 02:00s - 11:30 1:00 +1230 1975 Mar 2 02:00s - 11:30 - +1130 2015 Oct 4 02:00s - 11:00 - +11 2019 Jul - 11:00 AN +11/+12 + 11:12 - %z 1951 + 11:30 - %z 1974 Oct 27 02:00s + 11:30 1:00 %z 1975 Mar 2 02:00s + 11:30 - %z 2015 Oct 4 02:00s + 11:00 - %z 2019 Jul + 11:00 AN %z # Palau (Belau) # Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Pacific/Palau -15:02:04 - LMT 1844 Dec 31 # Koror 8:57:56 - LMT 1901 - 9:00 - +09 + 9:00 - %z # Papua New Guinea # Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Pacific/Port_Moresby 9:48:40 - LMT 1880 9:48:32 - PMMT 1895 # Port Moresby Mean Time - 10:00 - +10 + 10:00 - %z # # From Paul Eggert (2014-10-13): # Base the Bougainville entry on the Arawa-Kieta region, which appears to have @@ -740,16 +740,16 @@ Zone Pacific/Port_Moresby 9:48:40 - LMT 1880 # Zone Pacific/Bougainville 10:22:16 - LMT 1880 9:48:32 - PMMT 1895 - 10:00 - +10 1942 Jul - 9:00 - +09 1945 Aug 21 - 10:00 - +10 2014 Dec 28 2:00 - 11:00 - +11 + 10:00 - %z 1942 Jul + 9:00 - %z 1945 Aug 21 + 10:00 - %z 2014 Dec 28 2:00 + 11:00 - %z # Pitcairn # Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Pacific/Pitcairn -8:40:20 - LMT 1901 # Adamstown - -8:30 - -0830 1998 Apr 27 0:00 - -8:00 - -08 + -8:30 - %z 1998 Apr 27 0:00 + -8:00 - %z # American Samoa Zone Pacific/Pago_Pago 12:37:12 - LMT 1892 Jul 5 @@ -837,15 +837,15 @@ Rule WS 2012 2020 - Sep lastSun 3:00 1 - # Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Pacific/Apia 12:33:04 - LMT 1892 Jul 5 -11:26:56 - LMT 1911 - -11:30 - -1130 1950 - -11:00 WS -11/-10 2011 Dec 29 24:00 - 13:00 WS +13/+14 + -11:30 - %z 1950 + -11:00 WS %z 2011 Dec 29 24:00 + 13:00 WS %z # Solomon Is # excludes Bougainville, for which see Papua New Guinea # Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Pacific/Guadalcanal 10:39:48 - LMT 1912 Oct 1 # Honiara - 11:00 - +11 + 11:00 - %z # Tokelau # @@ -868,8 +868,8 @@ Zone Pacific/Guadalcanal 10:39:48 - LMT 1912 Oct 1 # Honiara # Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Pacific/Fakaofo -11:24:56 - LMT 1901 - -11:00 - -11 2011 Dec 30 - 13:00 - +13 + -11:00 - %z 2011 Dec 30 + 13:00 - %z # Tonga # Rule NAME FROM TO - IN ON AT SAVE LETTER/S @@ -881,9 +881,9 @@ Rule Tonga 2016 only - Nov Sun>=1 2:00 1:00 - Rule Tonga 2017 only - Jan Sun>=15 3:00 0 - # Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Pacific/Tongatapu 12:19:12 - LMT 1945 Sep 10 - 12:20 - +1220 1961 - 13:00 - +13 1999 - 13:00 Tonga +13/+14 + 12:20 - %z 1961 + 13:00 - %z 1999 + 13:00 Tonga %z # Tuvalu # Zone NAME STDOFF RULES FORMAT [UNTIL] @@ -987,7 +987,7 @@ Rule Vanuatu 1992 1993 - Jan Sat>=22 24:00 0 - Rule Vanuatu 1992 only - Oct Sat>=22 24:00 1:00 - # Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Pacific/Efate 11:13:16 - LMT 1912 Jan 13 # Vila - 11:00 Vanuatu +11/+12 + 11:00 Vanuatu %z # Wallis and Futuna # Zone NAME STDOFF RULES FORMAT [UNTIL] diff --git a/share/zoneinfo/datfiles/backward b/share/zoneinfo/datfiles/backward index 093b52fcf..08ec90d05 100644 --- a/share/zoneinfo/datfiles/backward +++ b/share/zoneinfo/datfiles/backward @@ -1,10 +1,11 @@ -# $OpenBSD: backward,v 1.45 2023/03/23 16:12:10 millert Exp $ -# tzdb links for backward compatibility +# $OpenBSD: backward,v 1.46 2024/10/02 17:08:47 millert Exp $ +# Links and zones for backward compatibility # This file is in the public domain, so clarified as of # 2009-05-17 by Arthur David Olson. # This file provides links from old or merged timezone names to current ones. +# It also provides a few zone entries for old naming conventions. # Many names changed in 1993 and in 1995, and many merged names moved here # in the period from 2013 through 2022. Several of these names are # also present in the file 'backzone', which has data important only @@ -45,6 +46,8 @@ Link America/Rio_Branco Brazil/Acre #= America/Porto_Acre Link America/Noronha Brazil/DeNoronha Link America/Sao_Paulo Brazil/East Link America/Manaus Brazil/West +Link Europe/Brussels CET +Link America/Chicago CST6CDT Link America/Halifax Canada/Atlantic Link America/Winnipeg Canada/Central # This line is commented out, as the name exceeded the 14-character limit @@ -59,6 +62,9 @@ Link America/Whitehorse Canada/Yukon Link America/Santiago Chile/Continental Link Pacific/Easter Chile/EasterIsland Link America/Havana Cuba +Link Europe/Athens EET +Link America/Panama EST +Link America/New_York EST5EDT Link Africa/Cairo Egypt Link Europe/Dublin Eire # Vanguard section, for most .zi parsers. @@ -97,6 +103,9 @@ Link America/Jamaica Jamaica Link Asia/Tokyo Japan Link Pacific/Kwajalein Kwajalein Link Africa/Tripoli Libya +Link Europe/Brussels MET +Link America/Phoenix MST +Link America/Denver MST7MDT Link America/Tijuana Mexico/BajaNorte Link America/Mazatlan Mexico/BajaSur Link America/Mexico_City Mexico/General @@ -170,6 +179,7 @@ Link America/Denver America/Shiprock Link America/Toronto America/Thunder_Bay Link America/Edmonton America/Yellowknife Link Antarctica/McMurdo Antarctica/South_Pole +Link Asia/Ulaanbaatar Asia/Choibalsan Link Asia/Shanghai Asia/Chongqing Link Asia/Shanghai Asia/Harbin Link Asia/Urumqi Asia/Kashgar @@ -184,6 +194,7 @@ Link Europe/Kyiv Europe/Zaporozhye Link Pacific/Kanton Pacific/Enderbury Link Pacific/Honolulu Pacific/Johnston Link Pacific/Chuuk Pacific/Yap +Link Europe/Lisbon WET # Alternate names for the same location @@ -209,5 +220,7 @@ Link Europe/Kyiv Europe/Kiev # Classically, Cyprus is in Asia; e.g. see Herodotus, Histories, I.72. # However, for various reasons many users expect to find it under Europe. Link Asia/Nicosia Europe/Nicosia +Link Pacific/Honolulu HST +Link America/Los_Angeles PST8PDT Link Pacific/Pohnpei Pacific/Ponape Link Pacific/Chuuk Pacific/Truk diff --git a/share/zoneinfo/datfiles/etcetera b/share/zoneinfo/datfiles/etcetera index 2b6e59fed..49961fcf6 100644 --- a/share/zoneinfo/datfiles/etcetera +++ b/share/zoneinfo/datfiles/etcetera @@ -1,4 +1,4 @@ -# $OpenBSD: etcetera,v 1.22 2024/02/05 17:07:23 millert Exp $ +# $OpenBSD: etcetera,v 1.23 2024/10/02 17:08:47 millert Exp $ # tzdb data for ships at sea and other miscellany # This file is in the public domain, so clarified as of @@ -6,7 +6,7 @@ # These entries are for uses not otherwise covered by the tz database. # Their main practical use is for platforms like Android that lack -# support for POSIX.1-2017-style TZ strings. On such platforms these entries +# support for POSIX proleptic TZ strings. On such platforms these entries # can be useful if the timezone database is wrong or if a ship or # aircraft at sea is not in a timezone. @@ -52,29 +52,29 @@ Link Etc/GMT GMT # so we moved the names into the Etc subdirectory. # Also, the time zone abbreviations are now compatible with %z. -Zone Etc/GMT-14 14 - +14 -Zone Etc/GMT-13 13 - +13 -Zone Etc/GMT-12 12 - +12 -Zone Etc/GMT-11 11 - +11 -Zone Etc/GMT-10 10 - +10 -Zone Etc/GMT-9 9 - +09 -Zone Etc/GMT-8 8 - +08 -Zone Etc/GMT-7 7 - +07 -Zone Etc/GMT-6 6 - +06 -Zone Etc/GMT-5 5 - +05 -Zone Etc/GMT-4 4 - +04 -Zone Etc/GMT-3 3 - +03 -Zone Etc/GMT-2 2 - +02 -Zone Etc/GMT-1 1 - +01 -Zone Etc/GMT+1 -1 - -01 -Zone Etc/GMT+2 -2 - -02 -Zone Etc/GMT+3 -3 - -03 -Zone Etc/GMT+4 -4 - -04 -Zone Etc/GMT+5 -5 - -05 -Zone Etc/GMT+6 -6 - -06 -Zone Etc/GMT+7 -7 - -07 -Zone Etc/GMT+8 -8 - -08 -Zone Etc/GMT+9 -9 - -09 -Zone Etc/GMT+10 -10 - -10 -Zone Etc/GMT+11 -11 - -11 -Zone Etc/GMT+12 -12 - -12 +Zone Etc/GMT-14 14 - %z +Zone Etc/GMT-13 13 - %z +Zone Etc/GMT-12 12 - %z +Zone Etc/GMT-11 11 - %z +Zone Etc/GMT-10 10 - %z +Zone Etc/GMT-9 9 - %z +Zone Etc/GMT-8 8 - %z +Zone Etc/GMT-7 7 - %z +Zone Etc/GMT-6 6 - %z +Zone Etc/GMT-5 5 - %z +Zone Etc/GMT-4 4 - %z +Zone Etc/GMT-3 3 - %z +Zone Etc/GMT-2 2 - %z +Zone Etc/GMT-1 1 - %z +Zone Etc/GMT+1 -1 - %z +Zone Etc/GMT+2 -2 - %z +Zone Etc/GMT+3 -3 - %z +Zone Etc/GMT+4 -4 - %z +Zone Etc/GMT+5 -5 - %z +Zone Etc/GMT+6 -6 - %z +Zone Etc/GMT+7 -7 - %z +Zone Etc/GMT+8 -8 - %z +Zone Etc/GMT+9 -9 - %z +Zone Etc/GMT+10 -10 - %z +Zone Etc/GMT+11 -11 - %z +Zone Etc/GMT+12 -12 - %z diff --git a/share/zoneinfo/datfiles/europe b/share/zoneinfo/datfiles/europe index c6cb01201..dba08a31a 100644 --- a/share/zoneinfo/datfiles/europe +++ b/share/zoneinfo/datfiles/europe @@ -1,4 +1,4 @@ -# $OpenBSD: europe,v 1.92 2024/02/05 17:07:23 millert Exp $ +# $OpenBSD: europe,v 1.93 2024/10/02 17:08:47 millert Exp $ # tzdb data for Europe and environs # This file is in the public domain, so clarified as of @@ -754,14 +754,6 @@ Rule Russia 1996 2010 - Oct lastSun 2:00s 0 - # Take "abolishing daylight saving time" to mean that time is now considered # to be standard. -# These are for backward compatibility with older versions. - -# Zone NAME STDOFF RULES FORMAT [UNTIL] -Zone WET 0:00 EU WE%sT -Zone CET 1:00 C-Eur CE%sT -Zone MET 1:00 C-Eur ME%sT -Zone EET 2:00 EU EE%sT - # Previous editions of this database used abbreviations like MET DST # for Central European Summer Time, but this didn't agree with common usage. @@ -895,7 +887,7 @@ Zone Europe/Minsk 1:50:16 - LMT 1880 3:00 Russia MSK/MSD 1990 3:00 - MSK 1991 Mar 31 2:00s 2:00 Russia EE%sT 2011 Mar 27 2:00s - 3:00 - +03 + 3:00 - %z # Belgium # @@ -1238,22 +1230,22 @@ Rule Thule 2007 max - Nov Sun>=1 2:00 0 S # # Zone NAME STDOFF RULES FORMAT [UNTIL] Zone America/Danmarkshavn -1:14:40 - LMT 1916 Jul 28 - -3:00 - -03 1980 Apr 6 2:00 - -3:00 EU -03/-02 1996 + -3:00 - %z 1980 Apr 6 2:00 + -3:00 EU %z 1996 0:00 - GMT # # Use the old name Scoresbysund, as the current name Ittoqqortoormiit # exceeds tzdb's 14-letter limit and has no common English abbreviation. 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 2024 Mar 31 - -2:00 EU -02/-01 + -2:00 - %z 1980 Apr 6 2:00 + -2:00 C-Eur %z 1981 Mar 29 + -1:00 EU %z 2024 Mar 31 + -2:00 EU %z 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 Mar 26 1:00u - -2:00 - -02 2023 Oct 29 1:00u - -2:00 EU -02/-01 + -3:00 - %z 1980 Apr 6 2:00 + -3:00 EU %z 2023 Mar 26 1:00u + -2:00 - %z 2023 Oct 29 1:00u + -2:00 EU %z Zone America/Thule -4:35:08 - LMT 1916 Jul 28 # Pituffik -4:00 Thule A%sT @@ -2266,10 +2258,39 @@ Zone Europe/Warsaw 1:24:00 - LMT 1880 # Portugal -# From Paul Eggert (2014-08-11), after a heads-up from Stephen Colebourne: -# According to a Portuguese decree (1911-05-26) -# https://dre.pt/application/dir/pdf1sdip/1911/05/12500/23132313.pdf -# Lisbon was at -0:36:44.68, but switched to GMT on 1912-01-01 at 00:00. +# From Tim Parenti (2024-07-01), per Alois Treindl (2021-02-07) and Michael +# Deckers (2021-02-10): +# http://oal.ul.pt/documentos/2018/01/hl1911a2018.pdf/ +# The Astronomical Observatory of Lisbon has published a list detailing the +# historical transitions in legal time within continental Portugal. It +# directly references many decrees and ordinances which are, in turn, +# referenced below. They can be viewed in the public archives of the Diário da +# República (until 1976-04-09 known as the Diário do Govêrno) at +# https://dre.pt/ (in Portuguese). +# +# Most of the Rules below have been updated simply to match the Observatory's +# listing for continental (mainland) Portugal. Although there are over 50 +# referenced decrees and ordinances, only the handful with comments below have +# been verified against the text, typically to provide additional confidence +# wherever dates provided by Whitman and Shanks & Pottenger had disagreed. +# See further below for the Azores and Madeira. + +# From Tim Parenti (2024-07-01), per Paul Eggert (2014-08-11), after a +# heads-up from Stephen Colebourne: +# According to a 1911-05-24 Portuguese decree, Lisbon was at -0:36:44.68, but +# switched to GMT on 1912-01-01 at 00:00. +# https://dre.pt/dr/detalhe/decreto/593090 +# https://dre.pt/application/conteudo/593090 +# The decree made legal time throughout Portugal and her possessions +# "subordinate to the Greenwich meridian, according to the principle adopted at +# the Washington Convention in 1884" and eliminated the "difference of five +# minutes between the internal and external clocks of railway stations". +# +# The decree was gazetted in the 1911-05-30 issue of Diário do Govêrno, and is +# considered to be dated 1911-05-24 by that issue's summary; however, the text +# of the decree itself is dated 1911-05-26. The Diário da República website +# notes the discrepancy, but later laws and the Observatory all seem to refer +# to this decree by the 1911-05-24 date. # # From Michael Deckers (2018-02-15): # article 5 [of the 1911 decree; Deckers's translation] ...: @@ -2277,37 +2298,62 @@ Zone Europe/Warsaw 1:24:00 - LMT 1880 # according to the 2nd article, the civil day January 1, 1912 begins, # all clocks therefore having to be advanced or set back correspondingly ... -# From Rui Pedro Salgueiro (1992-11-12): -# Portugal has recently (September, 27) changed timezone -# (from WET to MET or CET) to harmonize with EEC. -# -# Martin Bruckmann (1996-02-29) reports via Peter Ilieve -# that Portugal is reverting to 0:00 by not moving its clocks this spring. -# The new Prime Minister was fed up with getting up in the dark in the winter. -# -# From Paul Eggert (1996-11-12): -# IATA SSIM (1991-09) reports several 1991-09 and 1992-09 transitions -# at 02:00u, not 01:00u. Assume that these are typos. -# IATA SSIM (1991/1992) reports that the Azores were at -1:00. -# IATA SSIM (1993-02) says +0:00; later issues (through 1996-09) say -1:00. -# Guess that the Azores changed to EU rules in 1992 (since that's when Portugal -# harmonized with EU rules), and that they stayed +0:00 that winter. -# # Rule NAME FROM TO - IN ON AT SAVE LETTER/S -# DSH writes that despite Decree 1,469 (1915), the change to the clocks was not -# done every year, depending on what Spain did, because of railroad schedules. -# Go with Shanks & Pottenger. +# From Tim Parenti (2024-07-01), per Paul Eggert (1999-01-30): +# DSH writes in their history that Decreto 1469 of 1915-03-30 established +# summer time and that, "despite" this, the change to the clocks was not done +# every year, depending on what Spain did, because of railroad schedules. +# In fact, that decree had nothing to do with DST; rather, it regulated the +# sending of time signals. But we do see linkage to Spain in the 1920s below. +# https://dre.pt/dr/detalhe/decreto/1469-1915-285721 +# https://dre.pt/application/conteudo/285721 +# +# According to the Observatory, standard time was first advanced by Decreto +# 2433 of 1916-06-09 and restored by Decreto 2712 of 1916-10-28. While Whitman +# gives 1916-10-31 for the latter transition, Shanks & Pottenger agrees more +# closely with the decree, which stated that its provision "will start sixty +# minutes after the end of 31 October, according to the current time," i.e., +# 01:00 on 1 November. +# https://dre.pt/dr/detalhe/decreto/2433-1916-267192 +# https://dre.pt/application/conteudo/267192 +# https://dre.pt/dr/detalhe/decreto/2712-1916-590937 +# https://dre.pt/application/conteudo/590937 Rule Port 1916 only - Jun 17 23:00 1:00 S -# Whitman gives 1916 Oct 31; go with Shanks & Pottenger. Rule Port 1916 only - Nov 1 1:00 0 - -Rule Port 1917 only - Feb 28 23:00s 1:00 S -Rule Port 1917 1921 - Oct 14 23:00s 0 - -Rule Port 1918 only - Mar 1 23:00s 1:00 S -Rule Port 1919 only - Feb 28 23:00s 1:00 S -Rule Port 1920 only - Feb 29 23:00s 1:00 S -Rule Port 1921 only - Feb 28 23:00s 1:00 S +# From Tim Parenti (2024-07-01): +# Article 7 of Decreto 2922 of 1916-12-30 stated that "the legal time will be +# advanced by sixty minutes from 1 March to 31 October." Per Article 15, this +# came into force from 1917-01-01. Just before the first fall back, Decreto +# 3446 of 1917-10-11 changed the annual end date to 14 October. +# https://dre.pt/dr/detalhe/decreto/2922-1916-261894 +# https://dre.pt/application/conteudo/261894 +# https://dre.pt/dr/detalhe/decreto/3446-1917-495161 +# https://dre.pt/application/conteudo/495161 +# This annual change was revoked by Decreto 8038 of 1922-02-18. +# https://dre.pt/dr/detalhe/decreto/8038-1922-569751 +# https://dre.pt/application/conteudo/569751 +Rule Port 1917 1921 - Mar 1 0:00 1:00 S +Rule Port 1917 1921 - Oct 14 24:00 0 - +# From Tim Parenti (2024-07-01): +# Decreto 9592 of 1924-04-14 noted that "France maintains the advance of legal +# time in the summer and Spain has now adopted it for the first time" and +# considered "that the absence of similar measures would cause serious +# difficulties for international rail connections with consequent repercussions +# on domestic service hours..." along with "inconvenient analogues...for postal +# and telegraph services." Summer time would be in effect from 17 April to 4 +# October, with the spring change explicitly specified by bringing clocks +# forward from 16 April 23:00. +# https://dre.pt/dr/detalhe/decreto/9592-1924-652133 +# https://dre.pt/application/conteudo/652133 +# +# Decreto 10700, issued 1925-04-16, noted that Spain had not continued summer +# time, declared that "the current legal hour prior to 17 April remains +# unchanged from that day forward", and revoked legislation to the contrary, +# just a day before summer time would have otherwise resumed. +# https://dre.pt/dr/detalhe/decreto/10700-1925-437826 +# https://dre.pt/application/conteudo/437826 Rule Port 1924 only - Apr 16 23:00s 1:00 S -Rule Port 1924 only - Oct 14 23:00s 0 - +Rule Port 1924 only - Oct 4 23:00s 0 - Rule Port 1926 only - Apr 17 23:00s 1:00 S Rule Port 1926 1929 - Oct Sat>=1 23:00s 0 - Rule Port 1927 only - Apr 9 23:00s 1:00 S @@ -2319,6 +2365,8 @@ Rule Port 1931 1932 - Oct Sat>=1 23:00s 0 - Rule Port 1932 only - Apr 2 23:00s 1:00 S Rule Port 1934 only - Apr 7 23:00s 1:00 S # Whitman gives 1934 Oct 5; go with Shanks & Pottenger. +# Note: The 1935 law specified 10-06 00:00, not 10-05 24:00, but the following +# is equivalent and more succinct. Rule Port 1934 1938 - Oct Sat>=1 23:00s 0 - # Shanks & Pottenger give 1935 Apr 30; go with Whitman. Rule Port 1935 only - Mar 30 23:00s 1:00 S @@ -2329,10 +2377,19 @@ Rule Port 1938 only - Mar 26 23:00s 1:00 S Rule Port 1939 only - Apr 15 23:00s 1:00 S # Whitman gives 1939 Oct 7; go with Shanks & Pottenger. Rule Port 1939 only - Nov 18 23:00s 0 - +# From Tim Parenti (2024-07-01): +# Portaria 9465 of 1940-02-17 advanced clocks from Saturday 1940-02-24 23:00. +# The clocks were restored by Portaria 9658, issued Monday 1940-10-07, +# effective from 24:00 that very night, which agrees with Shanks & Pottenger; +# Whitman gives Saturday 1940-10-05 instead. +# https://dre.pt/dr/detalhe/portaria/9465-1940-189096 +# https://dre.pt/application/conteudo/189096 +# https://dre.pt/dr/detalhe/portaria/9658-1940-196729 +# https://dre.pt/application/conteudo/196729 Rule Port 1940 only - Feb 24 23:00s 1:00 S -# Shanks & Pottenger give 1940 Oct 7; go with Whitman. -Rule Port 1940 1941 - Oct 5 23:00s 0 - +Rule Port 1940 only - Oct 7 23:00s 0 - Rule Port 1941 only - Apr 5 23:00s 1:00 S +Rule Port 1941 only - Oct 5 23:00s 0 - Rule Port 1942 1945 - Mar Sat>=8 23:00s 1:00 S Rule Port 1942 only - Apr 25 22:00s 2:00 M # Midsummer Rule Port 1942 only - Aug 15 22:00s 1:00 S @@ -2342,66 +2399,195 @@ Rule Port 1943 1945 - Aug Sat>=25 22:00s 1:00 S Rule Port 1944 1945 - Apr Sat>=21 22:00s 2:00 M Rule Port 1946 only - Apr Sat>=1 23:00s 1:00 S Rule Port 1946 only - Oct Sat>=1 23:00s 0 - -# Whitman says DST was not observed in 1950; go with Shanks & Pottenger. -# Whitman gives Oct lastSun for 1952 on; go with Shanks & Pottenger. -Rule Port 1947 1965 - Apr Sun>=1 2:00s 1:00 S +# From Tim Parenti (2024-07-01), per Alois Treindl (2021-02-07): +# The Astronomical Observatory of Lisbon cites Portaria 11767 of 1947-03-28 for +# 1947 and Portaria 12286 of 1948-02-19 for 1948. +# https://dre.pt/dr/detalhe/portaria/11767-1947-414787 +# https://dre.pt/application/conteudo/414787 +# https://dre.pt/dr/detalhe/portaria/12286-1948-152953 +# https://dre.pt/application/conteudo/152953 +# +# Although the latter ordinance explicitly had the 1948-10-03 transition +# scheduled for 02:00 rather than 03:00 as had been used in 1947, Decreto-Lei +# 37048 of 1948-09-07 recognized "that it is advisable to definitely set...the +# 'summer time' regime", and fixed the fall transition at 03:00 moving forward. +# https://dre.pt/dr/detalhe/decreto-lei/37048-1948-373810 +# https://dre.pt/application/conteudo/373810 +# While the Observatory only cites this act for 1949-1965 and not for 1948, it +# does not appear to have had any provision delaying its effect, so assume that +# it overrode the prior ordinance for 1948-10-03. +# +# Whitman says DST was not observed in 1950 and gives Oct lastSun for 1952 on. +# The Observatory, however, agrees with Shanks & Pottenger that 1950 was not an +# exception and that Oct Sun>=1 was maintained through 1965. +Rule Port 1947 1966 - Apr Sun>=1 2:00s 1:00 S Rule Port 1947 1965 - Oct Sun>=1 2:00s 0 - -Rule Port 1977 only - Mar 27 0:00s 1:00 S -Rule Port 1977 only - Sep 25 0:00s 0 - -Rule Port 1978 1979 - Apr Sun>=1 0:00s 1:00 S -Rule Port 1978 only - Oct 1 0:00s 0 - -Rule Port 1979 1982 - Sep lastSun 1:00s 0 - -Rule Port 1980 only - Mar lastSun 0:00s 1:00 S -Rule Port 1981 1982 - Mar lastSun 1:00s 1:00 S -Rule Port 1983 only - Mar lastSun 2:00s 1:00 S +# From Tim Parenti (2024-07-01): +# Decreto-Lei 47233 of 1966-10-01 considered that the "duality" in time was +# "the cause of serious disturbances" and noted that "the countries with which +# we have the most frequent contacts...have already adopted" a solution +# coinciding with the extant "summer time". It established that the former +# "summer time" would apply year-round on the mainland and adjacent islands +# with immediate effect, as the fall back would have otherwise occurred later +# that evening. +# https://dre.pt/dr/detalhe/decreto-lei/47233-1966-293729 +# Model this by changing zones without changing clocks at the +# previously-appointed fall back time. +# +# Decreto-Lei 309/76 of 1976-04-27 acknowledged that those international +# contacts had returned to adopting seasonal times, and considered that the +# year-round advancement "entails considerable sacrifices for the vast majority +# of the working population during the winter months", including morning +# visibility concerns for schoolchildren. It specified, beginning 1976-09-26 +# 01:00, an annual return to UT+00 on the mainland from 00:00 UT on Sep lastSun +# to 00:00 UT on Mar lastSun (unless the latter date fell on Easter, in which +# case it was to be brought forward to the preceding Sunday). It also assigned +# the Permanent Time Commission to study and propose revisions for the Azores +# and Madeira, neither of which resumed DST until 1982 (as described further +# below). +# https://dre.pt/dr/detalhe/decreto-lei/309-1976-502063 +Rule Port 1976 only - Sep lastSun 1:00 0 - +Rule Port 1977 only - Mar lastSun 0:00s 1:00 S +Rule Port 1977 only - Sep lastSun 0:00s 0 - +# From Tim Parenti (2024-07-01): +# Beginning in 1978, rather than triggering the Easter rule of the 1976 decree +# (Easter fell on 1978-03-26), Article 5 was used instead, which allowed DST +# dates to be changed by order of the Minister of Education and Scientific +# Research, upon consultation with the Permanent Time Commission, "whenever +# considered convenient." As such, a series of one-off ordinances were +# promulgated for the mainland in 1978 through 1980, after which the 1976 +# decree naturally came back into force from 1981. +Rule Port 1978 1980 - Apr Sun>=1 1:00s 1:00 S +Rule Port 1978 only - Oct 1 1:00s 0 - +Rule Port 1979 1980 - Sep lastSun 1:00s 0 - +Rule Port 1981 1986 - Mar lastSun 0:00s 1:00 S +Rule Port 1981 1985 - Sep lastSun 0:00s 0 - +# From Tim Parenti (2024-07-01): +# Decreto-Lei 44-B/86 of 1986-03-07 switched mainland Portugal's transition +# times from 0:00s to 1:00u to harmonize with the EEC from 1986-03-30. +# https://dre.pt/dr/detalhe/decreto-lei/44-b-1986-628280 +# (Transitions of 1:00s as previously reported and used by the W-Eur rules, +# though equivalent, appear to have been fiction here.) Madeira continued to +# use 0:00s for spring 1986 before joining with the mainland using 1:00u in the +# fall; meanwhile, in the Azores the two were equivalent, so the law specifying +# 0:00s wasn't touched until 1992. (See below for more on the islands.) +# +# From Rui Pedro Salgueiro (1992-11-12): +# Portugal has recently (September, 27) changed timezone +# (from WET to MET or CET) to harmonize with EEC. +# +# Martin Bruckmann (1996-02-29) reports via Peter Ilieve +# that Portugal is reverting to 0:00 by not moving its clocks this spring. +# The new Prime Minister was fed up with getting up in the dark in the winter. +# +# From Paul Eggert (1996-11-12): +# IATA SSIM (1991-09) reports several 1991-09 and 1992-09 transitions +# at 02:00u, not 01:00u. Assume that these are typos. # # Zone NAME STDOFF RULES FORMAT [UNTIL] #STDOFF -0:36:44.68 Zone Europe/Lisbon -0:36:45 - LMT 1884 -0:36:45 - LMT 1912 Jan 1 0:00u # Lisbon MT - 0:00 Port WE%sT 1966 Apr 3 2:00 + 0:00 Port WE%sT 1966 Oct 2 2:00s 1:00 - CET 1976 Sep 26 1:00 - 0:00 Port WE%sT 1983 Sep 25 1:00s - 0:00 W-Eur WE%sT 1992 Sep 27 1:00s + 0:00 Port WE%sT 1986 + 0:00 EU WE%sT 1992 Sep 27 1:00u 1:00 EU CE%sT 1996 Mar 31 1:00u 0:00 EU WE%sT + +# From Tim Parenti (2024-07-01): +# For the Azores and Madeira, legislation was followed from the laws currently +# in force as listed at: +# https://oal.ul.pt/hora-legal/legislacao/ +# working backward through references of revocation and abrogation to +# Decreto-Lei 47233 of 1966-10-01, the last time DST was abolished across the +# mainland and its adjacent islands. Because of that reference, it is +# therefore assumed that DST rules in the islands prior to 1966 were like that +# of the mainland, though most legislation of the time didn't explicitly +# specify DST practices for the islands. Zone Atlantic/Azores -1:42:40 - LMT 1884 # Ponta Delgada -1:54:32 - HMT 1912 Jan 1 2:00u # Horta MT # Vanguard section, for zic and other parsers that support %z. -# -2:00 Port %z 1966 Apr 3 2:00 -# -1:00 Port %z 1983 Sep 25 1:00s -# -1:00 W-Eur %z 1992 Sep 27 1:00s + -2:00 Port %z 1966 Oct 2 2:00s +# From Tim Parenti (2024-07-01): +# While Decreto-Lei 309/76 of 1976-04-27 reintroduced DST on the mainland by +# falling back on 1976-09-26, it assigned the Permanent Time Commission to +# study and propose revisions for the Azores and Madeira. Decreto Regional +# 9/77/A of 1977-05-17 affirmed that "the legal time remained unchanged in the +# Azores" at UT-1, and would remain there year-round. +# https://dre.pt/dr/detalhe/decreto-regional/9-1977-252066 +# +# Decreto Regional 2/82/A, published 1982-03-02, adopted DST in the same +# fashion as the mainland used at the time. +# https://dre.pt/dr/detalhe/decreto-regional/2-1982-599965 +# Though transitions in the Azores officially remained at 0:00s through 1992, +# this was equivalent to the EU-style 1:00u adopted by the mainland in 1986, so +# model it as such. + -1:00 - %z 1982 Mar 28 0:00s + -1:00 Port %z 1986 # Rearguard section, for parsers lacking %z; see ziguard.awk. - -2:00 Port -02/-01 1942 Apr 25 22:00s - -2:00 Port +00 1942 Aug 15 22:00s - -2:00 Port -02/-01 1943 Apr 17 22:00s - -2:00 Port +00 1943 Aug 28 22:00s - -2:00 Port -02/-01 1944 Apr 22 22:00s - -2:00 Port +00 1944 Aug 26 22:00s - -2:00 Port -02/-01 1945 Apr 21 22:00s - -2:00 Port +00 1945 Aug 25 22:00s - -2:00 Port -02/-01 1966 Apr 3 2:00 - -1:00 Port -01/+00 1983 Sep 25 1:00s - -1:00 W-Eur -01/+00 1992 Sep 27 1:00s +# -2:00 Port -02/-01 1942 Apr 25 22:00s +# -2:00 Port +00 1942 Aug 15 22:00s +# -2:00 Port -02/-01 1943 Apr 17 22:00s +# -2:00 Port +00 1943 Aug 28 22:00s +# -2:00 Port -02/-01 1944 Apr 22 22:00s +# -2:00 Port +00 1944 Aug 26 22:00s +# -2:00 Port -02/-01 1945 Apr 21 22:00s +# -2:00 Port +00 1945 Aug 25 22:00s +# -2:00 Port -02/-01 1966 Oct 2 2:00s +# -1:00 - -01 1982 Mar 28 0:00s +# -1:00 Port -01/+00 1986 # End of rearguard section. - 0:00 EU WE%sT 1993 Mar 28 1:00u - -1:00 EU -01/+00 +# +# From Paul Eggert (1996-11-12): +# IATA SSIM (1991/1992) reports that the Azores were at -1:00. +# IATA SSIM (1993-02) says +0:00; later issues (through 1996-09) say -1:00. +# +# From Tim Parenti (2024-07-01): +# After mainland Portugal had shifted forward an hour from 1992-09-27, Decreto +# Legislativo Regional 29/92/A of 1992-12-23 sought to "reduce the time +# difference" by shifting the Azores forward as well from 1992-12-27. Just six +# months later, this was revoked by Decreto Legislativo Regional 9/93/A, citing +# "major changes in work habits and way of life." Though the revocation didn't +# give a transition time, it was signed Wednesday 1993-06-16; assume it took +# effect later that evening, and that an EU-style spring forward (to +01) was +# still observed in the interim on 1993-03-28. +# https://dre.pt/dr/detalhe/decreto-legislativo-regional/29-1992-621553 +# https://dre.pt/dr/detalhe/decreto-legislativo-regional/9-1993-389633 + -1:00 EU %z 1992 Dec 27 1:00s + 0:00 EU WE%sT 1993 Jun 17 1:00u + -1:00 EU %z + Zone Atlantic/Madeira -1:07:36 - LMT 1884 # Funchal -1:07:36 - FMT 1912 Jan 1 1:00u # Funchal MT # Vanguard section, for zic and other parsers that support %z. -# -1:00 Port %z 1966 Apr 3 2:00 + -1:00 Port %z 1966 Oct 2 2:00s # Rearguard section, for parsers lacking %z; see ziguard.awk. - -1:00 Port -01/+00 1942 Apr 25 22:00s - -1:00 Port +01 1942 Aug 15 22:00s - -1:00 Port -01/+00 1943 Apr 17 22:00s - -1:00 Port +01 1943 Aug 28 22:00s - -1:00 Port -01/+00 1944 Apr 22 22:00s - -1:00 Port +01 1944 Aug 26 22:00s - -1:00 Port -01/+00 1945 Apr 21 22:00s - -1:00 Port +01 1945 Aug 25 22:00s - -1:00 Port -01/+00 1966 Apr 3 2:00 +# -1:00 Port -01/+00 1942 Apr 25 22:00s +# -1:00 Port +01 1942 Aug 15 22:00s +# -1:00 Port -01/+00 1943 Apr 17 22:00s +# -1:00 Port +01 1943 Aug 28 22:00s +# -1:00 Port -01/+00 1944 Apr 22 22:00s +# -1:00 Port +01 1944 Aug 26 22:00s +# -1:00 Port -01/+00 1945 Apr 21 22:00s +# -1:00 Port +01 1945 Aug 25 22:00s +# -1:00 Port -01/+00 1966 Oct 2 2:00s # End of rearguard section. - 0:00 Port WE%sT 1983 Sep 25 1:00s +# +# From Tim Parenti (2024-07-01): +# Decreto Regional 5/82/M, published 1982-04-03, established DST transitions at +# 0:00u, which for Madeira is equivalent to the mainland's rules (0:00s) at the +# time. It came into effect the day following its publication, Sunday +# 1982-04-04, thus resuming Madeira's DST practice about a week later than the +# mainland and the Azores. +# https://dre.pt/dr/detalhe/decreto-regional/5-1982-608273 +# +# Decreto Legislativo Regional 18/86/M, published 1986-10-01, adopted EU-style +# rules (1:00u) and entered into immediate force after being signed on +# 1986-07-31. +# https://dre.pt/dr/detalhe/decreto-legislativo-regional/18-1986-221705 + 0:00 - WET 1982 Apr 4 + 0:00 Port WE%sT 1986 Jul 31 0:00 EU WE%sT # Romania @@ -2613,7 +2799,7 @@ Zone Europe/Kaliningrad 1:22:00 - LMT 1893 Apr 2:00 Poland EE%sT 1946 Apr 7 3:00 Russia MSK/MSD 1989 Mar 26 2:00s 2:00 Russia EE%sT 2011 Mar 27 2:00s - 3:00 - +03 2014 Oct 26 2:00s + 3:00 - %z 2014 Oct 26 2:00s 2:00 - EET @@ -2863,14 +3049,14 @@ Zone Europe/Simferopol 2:16:24 - LMT 1880 # http://publication.pravo.gov.ru/Document/View/0001201602150056 Zone Europe/Astrakhan 3:12:12 - LMT 1924 May - 3:00 - +03 1930 Jun 21 - 4:00 Russia +04/+05 1989 Mar 26 2:00s - 3:00 Russia +03/+04 1991 Mar 31 2:00s - 4:00 - +04 1992 Mar 29 2:00s - 3:00 Russia +03/+04 2011 Mar 27 2:00s - 4:00 - +04 2014 Oct 26 2:00s - 3:00 - +03 2016 Mar 27 2:00s - 4:00 - +04 + 3:00 - %z 1930 Jun 21 + 4:00 Russia %z 1989 Mar 26 2:00s + 3:00 Russia %z 1991 Mar 31 2:00s + 4:00 - %z 1992 Mar 29 2:00s + 3:00 Russia %z 2011 Mar 27 2:00s + 4:00 - %z 2014 Oct 26 2:00s + 3:00 - %z 2016 Mar 27 2:00s + 4:00 - %z # From Paul Eggert (2016-11-11): # Europe/Volgograd covers: @@ -2900,15 +3086,15 @@ Zone Europe/Astrakhan 3:12:12 - LMT 1924 May # http://publication.pravo.gov.ru/Document/View/0001202012220002 Zone Europe/Volgograd 2:57:40 - LMT 1920 Jan 3 - 3:00 - +03 1930 Jun 21 - 4:00 - +04 1961 Nov 11 - 4:00 Russia +04/+05 1988 Mar 27 2:00s + 3:00 - %z 1930 Jun 21 + 4:00 - %z 1961 Nov 11 + 4:00 Russia %z 1988 Mar 27 2:00s 3:00 Russia MSK/MSD 1991 Mar 31 2:00s - 4:00 - +04 1992 Mar 29 2:00s + 4:00 - %z 1992 Mar 29 2:00s 3:00 Russia MSK/MSD 2011 Mar 27 2:00s 4:00 - MSK 2014 Oct 26 2:00s 3:00 - MSK 2018 Oct 28 2:00s - 4:00 - +04 2020 Dec 27 2:00s + 4:00 - %z 2020 Dec 27 2:00s 3:00 - MSK # From Paul Eggert (2016-11-11): @@ -2923,14 +3109,14 @@ Zone Europe/Volgograd 2:57:40 - LMT 1920 Jan 3 # http://publication.pravo.gov.ru/Document/View/0001201611220031 Zone Europe/Saratov 3:04:18 - LMT 1919 Jul 1 0:00u - 3:00 - +03 1930 Jun 21 - 4:00 Russia +04/+05 1988 Mar 27 2:00s - 3:00 Russia +03/+04 1991 Mar 31 2:00s - 4:00 - +04 1992 Mar 29 2:00s - 3:00 Russia +03/+04 2011 Mar 27 2:00s - 4:00 - +04 2014 Oct 26 2:00s - 3:00 - +03 2016 Dec 4 2:00s - 4:00 - +04 + 3:00 - %z 1930 Jun 21 + 4:00 Russia %z 1988 Mar 27 2:00s + 3:00 Russia %z 1991 Mar 31 2:00s + 4:00 - %z 1992 Mar 29 2:00s + 3:00 Russia %z 2011 Mar 27 2:00s + 4:00 - %z 2014 Oct 26 2:00s + 3:00 - %z 2016 Dec 4 2:00s + 4:00 - %z # From Paul Eggert (2016-03-18): # Europe/Kirov covers: @@ -2938,10 +3124,10 @@ Zone Europe/Saratov 3:04:18 - LMT 1919 Jul 1 0:00u # The 1989 transition is from USSR act No. 227 (1989-03-14). # Zone Europe/Kirov 3:18:48 - LMT 1919 Jul 1 0:00u - 3:00 - +03 1930 Jun 21 - 4:00 Russia +04/+05 1989 Mar 26 2:00s + 3:00 - %z 1930 Jun 21 + 4:00 Russia %z 1989 Mar 26 2:00s 3:00 Russia MSK/MSD 1991 Mar 31 2:00s - 4:00 - +04 1992 Mar 29 2:00s + 4:00 - %z 1992 Mar 29 2:00s 3:00 Russia MSK/MSD 2011 Mar 27 2:00s 4:00 - MSK 2014 Oct 26 2:00s 3:00 - MSK @@ -2956,15 +3142,15 @@ Zone Europe/Kirov 3:18:48 - LMT 1919 Jul 1 0:00u # The 1989 transition is from USSR act No. 227 (1989-03-14). Zone Europe/Samara 3:20:20 - LMT 1919 Jul 1 0:00u - 3:00 - +03 1930 Jun 21 - 4:00 - +04 1935 Jan 27 - 4:00 Russia +04/+05 1989 Mar 26 2:00s - 3:00 Russia +03/+04 1991 Mar 31 2:00s - 2:00 Russia +02/+03 1991 Sep 29 2:00s - 3:00 - +03 1991 Oct 20 3:00 - 4:00 Russia +04/+05 2010 Mar 28 2:00s - 3:00 Russia +03/+04 2011 Mar 27 2:00s - 4:00 - +04 + 3:00 - %z 1930 Jun 21 + 4:00 - %z 1935 Jan 27 + 4:00 Russia %z 1989 Mar 26 2:00s + 3:00 Russia %z 1991 Mar 31 2:00s + 2:00 Russia %z 1991 Sep 29 2:00s + 3:00 - %z 1991 Oct 20 3:00 + 4:00 Russia %z 2010 Mar 28 2:00s + 3:00 Russia %z 2011 Mar 27 2:00s + 4:00 - %z # From Paul Eggert (2016-03-18): # Europe/Ulyanovsk covers: @@ -2980,14 +3166,14 @@ Zone Europe/Samara 3:20:20 - LMT 1919 Jul 1 0:00u # http://publication.pravo.gov.ru/Document/View/0001201603090051 Zone Europe/Ulyanovsk 3:13:36 - LMT 1919 Jul 1 0:00u - 3:00 - +03 1930 Jun 21 - 4:00 Russia +04/+05 1989 Mar 26 2:00s - 3:00 Russia +03/+04 1991 Mar 31 2:00s - 2:00 Russia +02/+03 1992 Jan 19 2:00s - 3:00 Russia +03/+04 2011 Mar 27 2:00s - 4:00 - +04 2014 Oct 26 2:00s - 3:00 - +03 2016 Mar 27 2:00s - 4:00 - +04 + 3:00 - %z 1930 Jun 21 + 4:00 Russia %z 1989 Mar 26 2:00s + 3:00 Russia %z 1991 Mar 31 2:00s + 2:00 Russia %z 1992 Jan 19 2:00s + 3:00 Russia %z 2011 Mar 27 2:00s + 4:00 - %z 2014 Oct 26 2:00s + 3:00 - %z 2016 Mar 27 2:00s + 4:00 - %z # From Tim Parenti (2014-07-03), per Oscar van Vlijmen (2001-08-25): # Asia/Yekaterinburg covers... @@ -3012,12 +3198,12 @@ Zone Europe/Ulyanovsk 3:13:36 - LMT 1919 Jul 1 0:00u #STDOFF 4:02:32.9 Zone Asia/Yekaterinburg 4:02:33 - LMT 1916 Jul 3 3:45:05 - PMT 1919 Jul 15 4:00 - 4:00 - +04 1930 Jun 21 - 5:00 Russia +05/+06 1991 Mar 31 2:00s - 4:00 Russia +04/+05 1992 Jan 19 2:00s - 5:00 Russia +05/+06 2011 Mar 27 2:00s - 6:00 - +06 2014 Oct 26 2:00s - 5:00 - +05 + 4:00 - %z 1930 Jun 21 + 5:00 Russia %z 1991 Mar 31 2:00s + 4:00 Russia %z 1992 Jan 19 2:00s + 5:00 Russia %z 2011 Mar 27 2:00s + 6:00 - %z 2014 Oct 26 2:00s + 5:00 - %z # From Tim Parenti (2014-07-03), per Oscar van Vlijmen (2001-08-25): @@ -3027,12 +3213,12 @@ Zone Asia/Yekaterinburg 4:02:33 - LMT 1916 Jul 3 # Byalokoz 1919 says Omsk was 4:53:30. Zone Asia/Omsk 4:53:30 - LMT 1919 Nov 14 - 5:00 - +05 1930 Jun 21 - 6:00 Russia +06/+07 1991 Mar 31 2:00s - 5:00 Russia +05/+06 1992 Jan 19 2:00s - 6:00 Russia +06/+07 2011 Mar 27 2:00s - 7:00 - +07 2014 Oct 26 2:00s - 6:00 - +06 + 5:00 - %z 1930 Jun 21 + 6:00 Russia %z 1991 Mar 31 2:00s + 5:00 Russia %z 1992 Jan 19 2:00s + 6:00 Russia %z 2011 Mar 27 2:00s + 7:00 - %z 2014 Oct 26 2:00s + 6:00 - %z # From Paul Eggert (2016-02-22): # Asia/Barnaul covers: @@ -3065,14 +3251,14 @@ Zone Asia/Omsk 4:53:30 - LMT 1919 Nov 14 # http://publication.pravo.gov.ru/Document/View/0001201603090038 Zone Asia/Barnaul 5:35:00 - LMT 1919 Dec 10 - 6:00 - +06 1930 Jun 21 - 7:00 Russia +07/+08 1991 Mar 31 2:00s - 6:00 Russia +06/+07 1992 Jan 19 2:00s - 7:00 Russia +07/+08 1995 May 28 - 6:00 Russia +06/+07 2011 Mar 27 2:00s - 7:00 - +07 2014 Oct 26 2:00s - 6:00 - +06 2016 Mar 27 2:00s - 7:00 - +07 + 6:00 - %z 1930 Jun 21 + 7:00 Russia %z 1991 Mar 31 2:00s + 6:00 Russia %z 1992 Jan 19 2:00s + 7:00 Russia %z 1995 May 28 + 6:00 Russia %z 2011 Mar 27 2:00s + 7:00 - %z 2014 Oct 26 2:00s + 6:00 - %z 2016 Mar 27 2:00s + 7:00 - %z # From Paul Eggert (2016-03-18): # Asia/Novosibirsk covers: @@ -3086,14 +3272,14 @@ Zone Asia/Barnaul 5:35:00 - LMT 1919 Dec 10 # http://publication.pravo.gov.ru/Document/View/0001201607040064 Zone Asia/Novosibirsk 5:31:40 - LMT 1919 Dec 14 6:00 - 6:00 - +06 1930 Jun 21 - 7:00 Russia +07/+08 1991 Mar 31 2:00s - 6:00 Russia +06/+07 1992 Jan 19 2:00s - 7:00 Russia +07/+08 1993 May 23 # say Shanks & P. - 6:00 Russia +06/+07 2011 Mar 27 2:00s - 7:00 - +07 2014 Oct 26 2:00s - 6:00 - +06 2016 Jul 24 2:00s - 7:00 - +07 + 6:00 - %z 1930 Jun 21 + 7:00 Russia %z 1991 Mar 31 2:00s + 6:00 Russia %z 1992 Jan 19 2:00s + 7:00 Russia %z 1993 May 23 # say Shanks & P. + 6:00 Russia %z 2011 Mar 27 2:00s + 7:00 - %z 2014 Oct 26 2:00s + 6:00 - %z 2016 Jul 24 2:00s + 7:00 - %z # From Paul Eggert (2016-03-18): # Asia/Tomsk covers: @@ -3138,14 +3324,14 @@ Zone Asia/Novosibirsk 5:31:40 - LMT 1919 Dec 14 6:00 # http://publication.pravo.gov.ru/Document/View/0001201604260048 Zone Asia/Tomsk 5:39:51 - LMT 1919 Dec 22 - 6:00 - +06 1930 Jun 21 - 7:00 Russia +07/+08 1991 Mar 31 2:00s - 6:00 Russia +06/+07 1992 Jan 19 2:00s - 7:00 Russia +07/+08 2002 May 1 3:00 - 6:00 Russia +06/+07 2011 Mar 27 2:00s - 7:00 - +07 2014 Oct 26 2:00s - 6:00 - +06 2016 May 29 2:00s - 7:00 - +07 + 6:00 - %z 1930 Jun 21 + 7:00 Russia %z 1991 Mar 31 2:00s + 6:00 Russia %z 1992 Jan 19 2:00s + 7:00 Russia %z 2002 May 1 3:00 + 6:00 Russia %z 2011 Mar 27 2:00s + 7:00 - %z 2014 Oct 26 2:00s + 6:00 - %z 2016 May 29 2:00s + 7:00 - %z # From Tim Parenti (2014-07-03): @@ -3176,12 +3362,12 @@ Zone Asia/Tomsk 5:39:51 - LMT 1919 Dec 22 # realigning itself with KRAT. Zone Asia/Novokuznetsk 5:48:48 - LMT 1924 May 1 - 6:00 - +06 1930 Jun 21 - 7:00 Russia +07/+08 1991 Mar 31 2:00s - 6:00 Russia +06/+07 1992 Jan 19 2:00s - 7:00 Russia +07/+08 2010 Mar 28 2:00s - 6:00 Russia +06/+07 2011 Mar 27 2:00s - 7:00 - +07 + 6:00 - %z 1930 Jun 21 + 7:00 Russia %z 1991 Mar 31 2:00s + 6:00 Russia %z 1992 Jan 19 2:00s + 7:00 Russia %z 2010 Mar 28 2:00s + 6:00 Russia %z 2011 Mar 27 2:00s + 7:00 - %z # From Tim Parenti (2014-07-03), per Oscar van Vlijmen (2001-08-25): # Asia/Krasnoyarsk covers... @@ -3195,12 +3381,12 @@ Zone Asia/Novokuznetsk 5:48:48 - LMT 1924 May 1 # Byalokoz 1919 says Krasnoyarsk was 6:11:26. Zone Asia/Krasnoyarsk 6:11:26 - LMT 1920 Jan 6 - 6:00 - +06 1930 Jun 21 - 7:00 Russia +07/+08 1991 Mar 31 2:00s - 6:00 Russia +06/+07 1992 Jan 19 2:00s - 7:00 Russia +07/+08 2011 Mar 27 2:00s - 8:00 - +08 2014 Oct 26 2:00s - 7:00 - +07 + 6:00 - %z 1930 Jun 21 + 7:00 Russia %z 1991 Mar 31 2:00s + 6:00 Russia %z 1992 Jan 19 2:00s + 7:00 Russia %z 2011 Mar 27 2:00s + 8:00 - %z 2014 Oct 26 2:00s + 7:00 - %z # From Tim Parenti (2014-07-03), per Oscar van Vlijmen (2001-08-25): @@ -3217,12 +3403,12 @@ Zone Asia/Krasnoyarsk 6:11:26 - LMT 1920 Jan 6 Zone Asia/Irkutsk 6:57:05 - LMT 1880 6:57:05 - IMT 1920 Jan 25 # Irkutsk Mean Time - 7:00 - +07 1930 Jun 21 - 8:00 Russia +08/+09 1991 Mar 31 2:00s - 7:00 Russia +07/+08 1992 Jan 19 2:00s - 8:00 Russia +08/+09 2011 Mar 27 2:00s - 9:00 - +09 2014 Oct 26 2:00s - 8:00 - +08 + 7:00 - %z 1930 Jun 21 + 8:00 Russia %z 1991 Mar 31 2:00s + 7:00 Russia %z 1992 Jan 19 2:00s + 8:00 Russia %z 2011 Mar 27 2:00s + 9:00 - %z 2014 Oct 26 2:00s + 8:00 - %z # From Tim Parenti (2014-07-06): @@ -3239,13 +3425,13 @@ Zone Asia/Irkutsk 6:57:05 - LMT 1880 # http://publication.pravo.gov.ru/Document/View/0001201512300107 Zone Asia/Chita 7:33:52 - LMT 1919 Dec 15 - 8:00 - +08 1930 Jun 21 - 9:00 Russia +09/+10 1991 Mar 31 2:00s - 8:00 Russia +08/+09 1992 Jan 19 2:00s - 9:00 Russia +09/+10 2011 Mar 27 2:00s - 10:00 - +10 2014 Oct 26 2:00s - 8:00 - +08 2016 Mar 27 2:00 - 9:00 - +09 + 8:00 - %z 1930 Jun 21 + 9:00 Russia %z 1991 Mar 31 2:00s + 8:00 Russia %z 1992 Jan 19 2:00s + 9:00 Russia %z 2011 Mar 27 2:00s + 10:00 - %z 2014 Oct 26 2:00s + 8:00 - %z 2016 Mar 27 2:00 + 9:00 - %z # From Tim Parenti (2014-07-03), per Oscar van Vlijmen (2009-11-29): @@ -3285,12 +3471,12 @@ Zone Asia/Chita 7:33:52 - LMT 1919 Dec 15 # Byalokoz 1919 says Yakutsk was 8:38:58. Zone Asia/Yakutsk 8:38:58 - LMT 1919 Dec 15 - 8:00 - +08 1930 Jun 21 - 9:00 Russia +09/+10 1991 Mar 31 2:00s - 8:00 Russia +08/+09 1992 Jan 19 2:00s - 9:00 Russia +09/+10 2011 Mar 27 2:00s - 10:00 - +10 2014 Oct 26 2:00s - 9:00 - +09 + 8:00 - %z 1930 Jun 21 + 9:00 Russia %z 1991 Mar 31 2:00s + 8:00 Russia %z 1992 Jan 19 2:00s + 9:00 Russia %z 2011 Mar 27 2:00s + 10:00 - %z 2014 Oct 26 2:00s + 9:00 - %z # From Tim Parenti (2014-07-03), per Oscar van Vlijmen (2009-11-29): @@ -3308,12 +3494,12 @@ Zone Asia/Yakutsk 8:38:58 - LMT 1919 Dec 15 # Go with Byalokoz. Zone Asia/Vladivostok 8:47:31 - LMT 1922 Nov 15 - 9:00 - +09 1930 Jun 21 - 10:00 Russia +10/+11 1991 Mar 31 2:00s - 9:00 Russia +09/+10 1992 Jan 19 2:00s - 10:00 Russia +10/+11 2011 Mar 27 2:00s - 11:00 - +11 2014 Oct 26 2:00s - 10:00 - +10 + 9:00 - %z 1930 Jun 21 + 10:00 Russia %z 1991 Mar 31 2:00s + 9:00 Russia %z 1992 Jan 19 2:00s + 10:00 Russia %z 2011 Mar 27 2:00s + 11:00 - %z 2014 Oct 26 2:00s + 10:00 - %z # From Tim Parenti (2014-07-03): @@ -3331,14 +3517,14 @@ Zone Asia/Vladivostok 8:47:31 - LMT 1922 Nov 15 # This transition is no doubt wrong, but we have no better info. Zone Asia/Khandyga 9:02:13 - LMT 1919 Dec 15 - 8:00 - +08 1930 Jun 21 - 9:00 Russia +09/+10 1991 Mar 31 2:00s - 8:00 Russia +08/+09 1992 Jan 19 2:00s - 9:00 Russia +09/+10 2004 - 10:00 Russia +10/+11 2011 Mar 27 2:00s - 11:00 - +11 2011 Sep 13 0:00s # Decree 725? - 10:00 - +10 2014 Oct 26 2:00s - 9:00 - +09 + 8:00 - %z 1930 Jun 21 + 9:00 Russia %z 1991 Mar 31 2:00s + 8:00 Russia %z 1992 Jan 19 2:00s + 9:00 Russia %z 2004 + 10:00 Russia %z 2011 Mar 27 2:00s + 11:00 - %z 2011 Sep 13 0:00s # Decree 725? + 10:00 - %z 2014 Oct 26 2:00s + 9:00 - %z # From Tim Parenti (2014-07-03): @@ -3354,14 +3540,14 @@ Zone Asia/Khandyga 9:02:13 - LMT 1919 Dec 15 # The Zone name should be Asia/Yuzhno-Sakhalinsk, but that's too long. Zone Asia/Sakhalin 9:30:48 - LMT 1905 Aug 23 - 9:00 - +09 1945 Aug 25 - 11:00 Russia +11/+12 1991 Mar 31 2:00s # Sakhalin T - 10:00 Russia +10/+11 1992 Jan 19 2:00s - 11:00 Russia +11/+12 1997 Mar lastSun 2:00s - 10:00 Russia +10/+11 2011 Mar 27 2:00s - 11:00 - +11 2014 Oct 26 2:00s - 10:00 - +10 2016 Mar 27 2:00s - 11:00 - +11 + 9:00 - %z 1945 Aug 25 + 11:00 Russia %z 1991 Mar 31 2:00s # Sakhalin T + 10:00 Russia %z 1992 Jan 19 2:00s + 11:00 Russia %z 1997 Mar lastSun 2:00s + 10:00 Russia %z 2011 Mar 27 2:00s + 11:00 - %z 2014 Oct 26 2:00s + 10:00 - %z 2016 Mar 27 2:00s + 11:00 - %z # From Tim Parenti (2014-07-03), per Oscar van Vlijmen (2009-11-29): @@ -3384,13 +3570,13 @@ Zone Asia/Sakhalin 9:30:48 - LMT 1905 Aug 23 # http://publication.pravo.gov.ru/Document/View/0001201604050038 Zone Asia/Magadan 10:03:12 - LMT 1924 May 2 - 10:00 - +10 1930 Jun 21 # Magadan Time - 11:00 Russia +11/+12 1991 Mar 31 2:00s - 10:00 Russia +10/+11 1992 Jan 19 2:00s - 11:00 Russia +11/+12 2011 Mar 27 2:00s - 12:00 - +12 2014 Oct 26 2:00s - 10:00 - +10 2016 Apr 24 2:00s - 11:00 - +11 + 10:00 - %z 1930 Jun 21 # Magadan Time + 11:00 Russia %z 1991 Mar 31 2:00s + 10:00 Russia %z 1992 Jan 19 2:00s + 11:00 Russia %z 2011 Mar 27 2:00s + 12:00 - %z 2014 Oct 26 2:00s + 10:00 - %z 2016 Apr 24 2:00s + 11:00 - %z # From Tim Parenti (2014-07-06): @@ -3435,12 +3621,12 @@ Zone Asia/Magadan 10:03:12 - LMT 1924 May 2 # Go with Srednekolymsk. Zone Asia/Srednekolymsk 10:14:52 - LMT 1924 May 2 - 10:00 - +10 1930 Jun 21 - 11:00 Russia +11/+12 1991 Mar 31 2:00s - 10:00 Russia +10/+11 1992 Jan 19 2:00s - 11:00 Russia +11/+12 2011 Mar 27 2:00s - 12:00 - +12 2014 Oct 26 2:00s - 11:00 - +11 + 10:00 - %z 1930 Jun 21 + 11:00 Russia %z 1991 Mar 31 2:00s + 10:00 Russia %z 1992 Jan 19 2:00s + 11:00 Russia %z 2011 Mar 27 2:00s + 12:00 - %z 2014 Oct 26 2:00s + 11:00 - %z # From Tim Parenti (2014-07-03): @@ -3458,14 +3644,14 @@ Zone Asia/Srednekolymsk 10:14:52 - LMT 1924 May 2 # UTC+12 since at least then, too. Zone Asia/Ust-Nera 9:32:54 - LMT 1919 Dec 15 - 8:00 - +08 1930 Jun 21 - 9:00 Russia +09/+10 1981 Apr 1 - 11:00 Russia +11/+12 1991 Mar 31 2:00s - 10:00 Russia +10/+11 1992 Jan 19 2:00s - 11:00 Russia +11/+12 2011 Mar 27 2:00s - 12:00 - +12 2011 Sep 13 0:00s # Decree 725? - 11:00 - +11 2014 Oct 26 2:00s - 10:00 - +10 + 8:00 - %z 1930 Jun 21 + 9:00 Russia %z 1981 Apr 1 + 11:00 Russia %z 1991 Mar 31 2:00s + 10:00 Russia %z 1992 Jan 19 2:00s + 11:00 Russia %z 2011 Mar 27 2:00s + 12:00 - %z 2011 Sep 13 0:00s # Decree 725? + 11:00 - %z 2014 Oct 26 2:00s + 10:00 - %z # From Tim Parenti (2014-07-03), per Oscar van Vlijmen (2001-08-25): @@ -3478,12 +3664,12 @@ Zone Asia/Ust-Nera 9:32:54 - LMT 1919 Dec 15 # The Zone name should be Asia/Petropavlovsk-Kamchatski or perhaps # Asia/Petropavlovsk-Kamchatsky, but these are too long. Zone Asia/Kamchatka 10:34:36 - LMT 1922 Nov 10 - 11:00 - +11 1930 Jun 21 - 12:00 Russia +12/+13 1991 Mar 31 2:00s - 11:00 Russia +11/+12 1992 Jan 19 2:00s - 12:00 Russia +12/+13 2010 Mar 28 2:00s - 11:00 Russia +11/+12 2011 Mar 27 2:00s - 12:00 - +12 + 11:00 - %z 1930 Jun 21 + 12:00 Russia %z 1991 Mar 31 2:00s + 11:00 Russia %z 1992 Jan 19 2:00s + 12:00 Russia %z 2010 Mar 28 2:00s + 11:00 Russia %z 2011 Mar 27 2:00s + 12:00 - %z # From Tim Parenti (2014-07-03): @@ -3491,13 +3677,13 @@ Zone Asia/Kamchatka 10:34:36 - LMT 1922 Nov 10 # 87 RU-CHU Chukotka Autonomous Okrug Zone Asia/Anadyr 11:49:56 - LMT 1924 May 2 - 12:00 - +12 1930 Jun 21 - 13:00 Russia +13/+14 1982 Apr 1 0:00s - 12:00 Russia +12/+13 1991 Mar 31 2:00s - 11:00 Russia +11/+12 1992 Jan 19 2:00s - 12:00 Russia +12/+13 2010 Mar 28 2:00s - 11:00 Russia +11/+12 2011 Mar 27 2:00s - 12:00 - +12 + 12:00 - %z 1930 Jun 21 + 13:00 Russia %z 1982 Apr 1 0:00s + 12:00 Russia %z 1991 Mar 31 2:00s + 11:00 Russia %z 1992 Jan 19 2:00s + 12:00 Russia %z 2010 Mar 28 2:00s + 11:00 Russia %z 2011 Mar 27 2:00s + 12:00 - %z # San Marino Link Europe/Rome Europe/San_Marino @@ -3625,7 +3811,7 @@ Zone Africa/Ceuta -0:21:16 - LMT 1901 Jan 1 0:00u 1:00 - CET 1986 1:00 EU CE%sT Zone Atlantic/Canary -1:01:36 - LMT 1922 Mar # Las Palmas de Gran C. - -1:00 - -01 1946 Sep 30 1:00 + -1:00 - %z 1946 Sep 30 1:00 0:00 - WET 1980 Apr 6 0:00s 0:00 1:00 WEST 1980 Sep 28 1:00u 0:00 EU WE%sT @@ -3711,8 +3897,8 @@ Zone Europe/Stockholm 1:12:12 - LMT 1879 Jan 1 # but if no one is present after 11 at night, could be postponed until one # hour before the beginning of service. -# From Paul Eggert (2013-09-11): -# Round BMT to the nearest even second, 0:29:46. +# From Paul Eggert (2024-05-24): +# Express BMT as 0:29:45.500, approximately the same precision 7° 26' 22.50". # # We can find no reliable source for Shanks's assertion that all of Switzerland # except Geneva switched to Bern Mean Time at 00:00 on 1848-09-12. This book: @@ -3751,6 +3937,7 @@ Rule Swiss 1941 1942 - May Mon>=1 1:00 1:00 S Rule Swiss 1941 1942 - Oct Mon>=1 2:00 0 - # Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Europe/Zurich 0:34:08 - LMT 1853 Jul 16 # See above comment. + #STDOFF 0:29:45.500 0:29:46 - BMT 1894 Jun # Bern Mean Time 1:00 Swiss CE%sT 1981 1:00 EU CE%sT @@ -3949,7 +4136,7 @@ Rule Turkey 1996 2006 - Oct lastSun 1:00s 0 - Zone Europe/Istanbul 1:55:52 - LMT 1880 1:56:56 - IMT 1910 Oct # Istanbul Mean Time? 2:00 Turkey EE%sT 1978 Jun 29 - 3:00 Turkey +03/+04 1984 Nov 1 2:00 + 3:00 Turkey %z 1984 Nov 1 2:00 2:00 Turkey EE%sT 2007 2:00 EU EE%sT 2011 Mar 27 1:00u 2:00 - EET 2011 Mar 28 1:00u @@ -3958,7 +4145,7 @@ Zone Europe/Istanbul 1:55:52 - LMT 1880 2:00 EU EE%sT 2015 Oct 25 1:00u 2:00 1:00 EEST 2015 Nov 8 1:00u 2:00 EU EE%sT 2016 Sep 7 - 3:00 - +03 + 3:00 - %z # Ukraine # diff --git a/share/zoneinfo/datfiles/leap-seconds.list b/share/zoneinfo/datfiles/leap-seconds.list index 679170306..91f7064ad 100644 --- a/share/zoneinfo/datfiles/leap-seconds.list +++ b/share/zoneinfo/datfiles/leap-seconds.list @@ -1,6 +1,6 @@ -# $OpenBSD: leap-seconds.list,v 1.3 2024/02/05 17:07:23 millert Exp $ -# ATOMIC TIME. -# The Coordinated Universal Time (UTC) is the reference time scale derived +# $OpenBSD: leap-seconds.list,v 1.4 2024/10/02 17:08:47 millert Exp $ +# ATOMIC TIME +# Coordinated Universal Time (UTC) is the reference time scale derived # from The "Temps Atomique International" (TAI) calculated by the Bureau # International des Poids et Mesures (BIPM) using a worldwide network of atomic # clocks. UTC differs from TAI by an integer number of seconds; it is the basis @@ -9,34 +9,34 @@ # # ASTRONOMICAL TIME (UT1) is the time scale based on the rate of rotation of the earth. # It is now mainly derived from Very Long Baseline Interferometry (VLBI). The various -# irregular fluctuations progressively detected in the rotation rate of the Earth lead +# irregular fluctuations progressively detected in the rotation rate of the Earth led # in 1972 to the replacement of UT1 by UTC as the reference time scale. # # # LEAP SECOND -# Atomic clocks are more stable than the rate of the earth rotation since the latter +# Atomic clocks are more stable than the rate of the earth's rotation since the latter # undergoes a full range of geophysical perturbations at various time scales: lunisolar -# and core-mantle torques, atmospheric and oceanic effetcs, etc. +# and core-mantle torques, atmospheric and oceanic effects, etc. # Leap seconds are needed to keep the two time scales in agreement, i.e. UT1-UTC smaller -# than 0.9 second. Therefore, when necessary a "leap second" is applied to UTC. +# than 0.9 seconds. Therefore, when necessary a "leap second" is applied to UTC. # Since the adoption of this system in 1972 it has been necessary to add a number of seconds to UTC, # firstly due to the initial choice of the value of the second (1/86400 mean solar day of # the year 1820) and secondly to the general slowing down of the Earth's rotation. It is -# theorically possible to have a negative leap second (a second removed from UTC), but so far, +# theoretically possible to have a negative leap second (a second removed from UTC), but so far, # all leap seconds have been positive (a second has been added to UTC). Based on what we know about # the earth's rotation, it is unlikely that we will ever have a negative leap second. # # # HISTORY -# The first leap second was added on June 30, 1972. Until yhe year 2000, it was necessary in average to add a +# The first leap second was added on June 30, 1972. Until the year 2000, it was necessary in average to add a # leap second at a rate of 1 to 2 years. Since the year 2000 leap seconds are introduced with an -# average interval of 3 to 4 years due to the acceleration of the Earth rotation speed. +# average interval of 3 to 4 years due to the acceleration of the Earth's rotation speed. # # -# RESPONSABILITY OF THE DECISION TO INTRODUCE A LEAP SECOND IN UTC +# RESPONSIBILITY OF THE DECISION TO INTRODUCE A LEAP SECOND IN UTC # The decision to introduce a leap second in UTC is the responsibility of the Earth Orientation Center of # the International Earth Rotation and reference System Service (IERS). This center is located at Paris -# Observatory. According to international agreements, leap seconds should only be scheduled for certain dates: +# Observatory. According to international agreements, leap seconds should be scheduled only for certain dates: # first preference is given to the end of December and June, and second preference at the end of March # and September. Since the introduction of leap seconds in 1972, only dates in June and December were used. # @@ -61,15 +61,15 @@ # # The following line shows the last update of this file in NTP timestamp: # -#$ 3913697179 +#$ 3929093563 # # 2) Expiration date of the file given on a semi-annual basis: last June or last December # -# File expires on 28 December 2024 +# File expires on 28 June 2025 # # Expire date in NTP timestamp: # -#@ 3944332800 +#@ 3960057600 # # # LIST OF LEAP SECONDS @@ -118,4 +118,4 @@ # please see the readme file in the 'source' directory : # https://hpiers.obspm.fr/iers/bul/bulc/ntp/sources/README # -#h 9dac5845 8acd32c0 2947d462 daf4a943 f58d9391 +#h be738595 57b0cf1b b0218343 fb77062f 5a775e7 diff --git a/share/zoneinfo/datfiles/northamerica b/share/zoneinfo/datfiles/northamerica index e5a7395cc..2bc773436 100644 --- a/share/zoneinfo/datfiles/northamerica +++ b/share/zoneinfo/datfiles/northamerica @@ -1,4 +1,4 @@ -# $OpenBSD: northamerica,v 1.86 2024/02/05 17:07:23 millert Exp $ +# $OpenBSD: northamerica,v 1.87 2024/10/02 17:08:47 millert Exp $ # tzdb data for North and Central America and environs # This file is in the public domain, so clarified as of @@ -186,26 +186,6 @@ Rule US 1987 2006 - Apr Sun>=1 2:00 1:00 D Rule US 2007 max - Mar Sun>=8 2:00 1:00 D Rule US 2007 max - Nov Sun>=1 2:00 0 S -# From Arthur David Olson, 2005-12-19 -# We generate the files specified below to guard against old files with -# obsolete information being left in the time zone binary directory. -# We limit the list to names that have appeared in previous versions of -# this time zone package. -# We do these as separate Zones rather than as Links to avoid problems if -# a particular place changes whether it observes DST. -# We put these specifications here in the northamerica file both to -# increase the chances that they'll actually get compiled and to -# avoid the need to duplicate the US rules in another file. - -# Zone NAME STDOFF RULES FORMAT [UNTIL] -Zone EST -5:00 - EST -Zone MST -7:00 - MST -Zone HST -10:00 - HST -Zone EST5EDT -5:00 US E%sT -Zone CST6CDT -6:00 US C%sT -Zone MST7MDT -7:00 US M%sT -Zone PST8PDT -8:00 US P%sT - # From U. S. Naval Observatory (1989-01-19): # USA EASTERN 5 H BEHIND UTC NEW YORK, WASHINGTON # USA EASTERN 4 H BEHIND UTC APR 3 - OCT 30 @@ -2387,6 +2367,81 @@ Zone America/Dawson -9:17:40 - LMT 1900 Aug 20 # the researchers who prepared the Decrees page failed to find some of # the relevant documents. +# From Heitor David Pinto (2024-08-04): +# In 1931, the decree implementing DST specified that it would take +# effect on 30 April.... +# https://www.dof.gob.mx/nota_to_imagen_fs.php?cod_diario=192270&pagina=2&seccion=1 +# +# In 1981, the decree changing Campeche, Yucatán and Quintana Roo to UTC-5 +# specified that it would enter into force on 26 December 1981 at 2:00.... +# https://www.dof.gob.mx/nota_to_imagen_fs.php?codnota=4705667&fecha=23/12/1981&cod_diario=202796 +# +# In 1982, the decree returning Campeche and Yucatán to UTC-6 specified that +# it would enter into force on 2 November 1982 at 2:00.... +# https://www.dof.gob.mx/nota_to_imagen_fs.php?cod_diario=205689&pagina=3&seccion=0 +# +# Quintana Roo changed to UTC-6 on 4 January 1983 at 0:00, and again +# to UTC-5 on 26 October 1997 at 2:00.... +# https://www.dof.gob.mx/nota_to_imagen_fs.php?codnota=4787355&fecha=28/12/1982&cod_diario=206112 +# https://www.dof.gob.mx/nota_to_imagen_fs.php?cod_diario=209559&pagina=15&seccion=0 +# +# Durango, Coahuila, Nuevo León and Tamaulipas were set to UTC-7 on 1 January +# 1922, and changed to UTC-6 on 10 June 1927. Then Durango, Coahuila and +# Nuevo León (but not Tamaulipas) returned to UTC-7 on 15 November 1930, +# observed DST in 1931, and changed again to UTC-6 on 1 April 1932.... +# https://www.dof.gob.mx/nota_to_imagen_fs.php?codnota=4441846&fecha=29/12/1921&cod_diario=187468 +# https://www.dof.gob.mx/nota_to_imagen_fs.php?codnota=4541520&fecha=09/06/1927&cod_diario=193920 +# https://www.dof.gob.mx/nota_to_imagen_fs.php?codnota=4491963&fecha=15/11/1930&cod_diario=190835 +# https://www.dof.gob.mx/nota_to_imagen_fs.php?codnota=4418437&fecha=21/01/1932&cod_diario=185588 +# +# ... the ... 10 June 1927 ... decree only said 10 June 1927, without +# specifying a time, so I suppose that it should be considered at 0:00. +# https://www.dof.gob.mx/nota_to_imagen_fs.php?codnota=4541520&fecha=09/06/1927&cod_diario=193920 +# +# In 1942, the decree changing Baja California, Baja California Sur, Sonora, +# Sinaloa and Nayarit to UTC-7 was published on 24 April, but it said that it +# would apply from 1 April, so it's unclear when the change actually +# occurred. The database currently shows 24 April 1942. +# https://www.dof.gob.mx/nota_to_imagen_fs.php?cod_diario=192203&pagina=2&seccion=1 +# +# Baja California Sur, Sonora, Sinaloa and Nayarit never used UTC-8. The ... +# 14 January 1949 ... change [to UTC-8] only occurred in Baja California. +# https://www.dof.gob.mx/nota_to_imagen_fs.php?codnota=4515613&fecha=13/01/1949&cod_diario=192309 +# +# In 1945, the decree changing Baja California to UTC-8 specified that it +# would take effect on the third day from its publication. +# It was published on 12 November, so it would take effect on 15 November.... +# https://www.dof.gob.mx/nota_to_imagen_fs.php?codnota=4555049&fecha=12/11/1945&cod_diario=194763 +# +# In 1948, the decree changing Baja California to UTC-7 specified that it +# would take effect on "this date". The decree was made on 13 March, +# but published on 5 April, so it's unclear when the change actually occurred. +# The database currently shows 5 April 1948. +# https://www.dof.gob.mx/nota_to_imagen_fs.php?cod_diario=188624&pagina=2&seccion=0 +# +# In 1949, the decree changing Baja California to UTC-8 was published on 13 +# January, but it said that it would apply from 1 January, so it's unclear when +# the change actually occurred. The database currently shows 14 January 1949. +# https://www.dof.gob.mx/nota_to_imagen_fs.php?codnota=4515613&fecha=13/01/1949&cod_diario=192309 +# +# Baja California also observed UTC-7 from 1 May to 24 September 1950, +# from 29 April to 30 September 1951 at 2:00, +# and from 27 April to 28 September 1952 at 2:00.... +# https://www.dof.gob.mx/nota_to_imagen_fs.php?codnota=4600403&fecha=29/04/1950&cod_diario=197505 +# https://www.dof.gob.mx/nota_to_imagen_fs.php?codnota=4623553&fecha=23/09/1950&cod_diario=198805 +# https://www.dof.gob.mx/nota_to_imagen_fs.php?codnota=4469444&fecha=27/04/1951&cod_diario=189317 +# https://www.dof.gob.mx/nota_to_imagen_fs.php?codnota=4533868&fecha=10/03/1952&cod_diario=193465 +# +# All changes in Baja California from 1948 to 1952 match those in California, +# on the same dates or with a difference of one day. +# So it may be easier to implement these changes as DST with rule CA +# during this whole period. +# +# From Paul Eggert (2024-08-18): +# For now, maintain the slightly-different history for Baja California, +# as we have no information on whether 1948/1952 clocks in Tijuana followed +# the decrees or followed San Diego. + # From Alan Perry (1996-02-15): # A guy from our Mexico subsidiary finally found the Presidential Decree # outlining the timezone changes in Mexico. @@ -2590,7 +2645,7 @@ Zone America/Dawson -9:17:40 - LMT 1900 Aug 20 # http://puentelibre.mx/noticia/ciudad_juarez_cambio_horario_noviembre_2022/ # Rule NAME FROM TO - IN ON AT SAVE LETTER/S -Rule Mexico 1931 only - May 1 23:00 1:00 D +Rule Mexico 1931 only - Apr 30 0:00 1:00 D Rule Mexico 1931 only - Oct 1 0:00 0 S Rule Mexico 1939 only - Feb 5 0:00 1:00 D Rule Mexico 1939 only - Jun 25 0:00 0 S @@ -2609,14 +2664,16 @@ Rule Mexico 2002 2022 - Oct lastSun 2:00 0 S # Zone NAME STDOFF RULES FORMAT [UNTIL] # Quintana Roo; represented by Cancún Zone America/Cancun -5:47:04 - LMT 1922 Jan 1 6:00u - -6:00 - CST 1981 Dec 23 + -6:00 - CST 1981 Dec 26 2:00 + -5:00 - EST 1983 Jan 4 0:00 + -6:00 Mexico C%sT 1997 Oct 26 2:00 -5:00 Mexico E%sT 1998 Aug 2 2:00 -6:00 Mexico C%sT 2015 Feb 1 2:00 -5:00 - EST # Campeche, Yucatán; represented by Mérida Zone America/Merida -5:58:28 - LMT 1922 Jan 1 6:00u - -6:00 - CST 1981 Dec 23 - -5:00 - EST 1982 Dec 2 + -6:00 - CST 1981 Dec 26 2:00 + -5:00 - EST 1982 Nov 2 2:00 -6:00 Mexico C%sT # Coahuila, Nuevo León, Tamaulipas (near US border) # This includes the following municipios: @@ -2633,12 +2690,15 @@ Zone America/Matamoros -6:30:00 - LMT 1922 Jan 1 6:00u -6:00 US C%sT # Durango; Coahuila, Nuevo León, Tamaulipas (away from US border) Zone America/Monterrey -6:41:16 - LMT 1922 Jan 1 6:00u + -7:00 - MST 1927 Jun 10 + -6:00 - CST 1930 Nov 15 + -7:00 Mexico M%sT 1932 Apr 1 -6:00 - CST 1988 -6:00 US C%sT 1989 -6:00 Mexico C%sT # Central Mexico Zone America/Mexico_City -6:36:36 - LMT 1922 Jan 1 7:00u - -7:00 - MST 1927 Jun 10 23:00 + -7:00 - MST 1927 Jun 10 -6:00 - CST 1930 Nov 15 -7:00 Mexico M%sT 1932 Apr 1 -6:00 Mexico C%sT 2001 Sep 30 2:00 @@ -2649,7 +2709,7 @@ Zone America/Mexico_City -6:36:36 - LMT 1922 Jan 1 7:00u # Práxedis G Guerrero. # http://gaceta.diputados.gob.mx/PDF/65/2a022/nov/20221124-VII.pdf Zone America/Ciudad_Juarez -7:05:56 - LMT 1922 Jan 1 7:00u - -7:00 - MST 1927 Jun 10 23:00 + -7:00 - MST 1927 Jun 10 -6:00 - CST 1930 Nov 15 -7:00 Mexico M%sT 1932 Apr 1 -6:00 - CST 1996 @@ -2664,7 +2724,7 @@ Zone America/Ciudad_Juarez -7:05:56 - LMT 1922 Jan 1 7:00u # Benavides. # http://gaceta.diputados.gob.mx/PDF/65/2a022/nov/20221124-VII.pdf Zone America/Ojinaga -6:57:40 - LMT 1922 Jan 1 7:00u - -7:00 - MST 1927 Jun 10 23:00 + -7:00 - MST 1927 Jun 10 -6:00 - CST 1930 Nov 15 -7:00 Mexico M%sT 1932 Apr 1 -6:00 - CST 1996 @@ -2676,7 +2736,7 @@ Zone America/Ojinaga -6:57:40 - LMT 1922 Jan 1 7:00u -6:00 US C%sT # Chihuahua (away from US border) Zone America/Chihuahua -7:04:20 - LMT 1922 Jan 1 7:00u - -7:00 - MST 1927 Jun 10 23:00 + -7:00 - MST 1927 Jun 10 -6:00 - CST 1930 Nov 15 -7:00 Mexico M%sT 1932 Apr 1 -6:00 - CST 1996 @@ -2686,23 +2746,21 @@ Zone America/Chihuahua -7:04:20 - LMT 1922 Jan 1 7:00u -6:00 - CST # Sonora Zone America/Hermosillo -7:23:52 - LMT 1922 Jan 1 7:00u - -7:00 - MST 1927 Jun 10 23:00 + -7:00 - MST 1927 Jun 10 -6:00 - CST 1930 Nov 15 -7:00 Mexico M%sT 1932 Apr 1 -6:00 - CST 1942 Apr 24 - -7:00 - MST 1949 Jan 14 - -8:00 - PST 1970 + -7:00 - MST 1996 -7:00 Mexico M%sT 1999 -7:00 - MST # Baja California Sur, Nayarit (except Bahía de Banderas), Sinaloa Zone America/Mazatlan -7:05:40 - LMT 1922 Jan 1 7:00u - -7:00 - MST 1927 Jun 10 23:00 + -7:00 - MST 1927 Jun 10 -6:00 - CST 1930 Nov 15 -7:00 Mexico M%sT 1932 Apr 1 -6:00 - CST 1942 Apr 24 - -7:00 - MST 1949 Jan 14 - -8:00 - PST 1970 + -7:00 - MST 1970 -7:00 Mexico M%sT # Bahía de Banderas @@ -2735,27 +2793,32 @@ Zone America/Mazatlan -7:05:40 - LMT 1922 Jan 1 7:00u # Use "Bahia_Banderas" to keep the name to fourteen characters. Zone America/Bahia_Banderas -7:01:00 - LMT 1922 Jan 1 7:00u - -7:00 - MST 1927 Jun 10 23:00 + -7:00 - MST 1927 Jun 10 -6:00 - CST 1930 Nov 15 -7:00 Mexico M%sT 1932 Apr 1 -6:00 - CST 1942 Apr 24 - -7:00 - MST 1949 Jan 14 - -8:00 - PST 1970 + -7:00 - MST 1970 -7:00 Mexico M%sT 2010 Apr 4 2:00 -6:00 Mexico C%sT # Baja California Zone America/Tijuana -7:48:04 - LMT 1922 Jan 1 7:00u -7:00 - MST 1924 - -8:00 - PST 1927 Jun 10 23:00 + -8:00 - PST 1927 Jun 10 -7:00 - MST 1930 Nov 15 -8:00 - PST 1931 Apr 1 -8:00 1:00 PDT 1931 Sep 30 -8:00 - PST 1942 Apr 24 -8:00 1:00 PWT 1945 Aug 14 23:00u - -8:00 1:00 PPT 1945 Nov 12 # Peace + -8:00 1:00 PPT 1945 Nov 15 # Peace -8:00 - PST 1948 Apr 5 -8:00 1:00 PDT 1949 Jan 14 + -8:00 - PST 1950 May 1 + -8:00 1:00 PDT 1950 Sep 24 + -8:00 - PST 1951 Apr 29 2:00 + -8:00 1:00 PDT 1951 Sep 30 2:00 + -8:00 - PST 1952 Apr 27 2:00 + -8:00 1:00 PDT 1952 Sep 28 2:00 -8:00 - PST 1954 -8:00 CA P%sT 1961 -8:00 - PST 1976 @@ -3616,8 +3679,8 @@ Zone America/St_Lucia -4:04:00 - LMT 1890 # Castries # Zone NAME STDOFF RULES FORMAT [UNTIL] Zone America/Miquelon -3:44:40 - LMT 1911 Jun 15 # St Pierre -4:00 - AST 1980 May - -3:00 - -03 1987 - -3:00 Canada -03/-02 + -3:00 - %z 1987 + -3:00 Canada %z # St Vincent & the Grenadines # Zone NAME STDOFF RULES FORMAT [UNTIL] diff --git a/share/zoneinfo/datfiles/southamerica b/share/zoneinfo/datfiles/southamerica index fb2371a33..4982db3ab 100644 --- a/share/zoneinfo/datfiles/southamerica +++ b/share/zoneinfo/datfiles/southamerica @@ -1,4 +1,4 @@ -# $OpenBSD: southamerica,v 1.81 2024/02/05 17:07:23 millert Exp $ +# $OpenBSD: southamerica,v 1.82 2024/10/02 17:08:47 millert Exp $ # tzdb data for South America and environs # This file is in the public domain, so clarified as of @@ -403,11 +403,11 @@ Rule Arg 2008 only - Oct Sun>=15 0:00 1:00 - Zone America/Argentina/Buenos_Aires -3:53:48 - LMT 1894 Oct 31 #STDOFF -4:16:48.25 -4:16:48 - CMT 1920 May # Córdoba Mean Time - -4:00 - -04 1930 Dec - -4:00 Arg -04/-03 1969 Oct 5 - -3:00 Arg -03/-02 1999 Oct 3 - -4:00 Arg -04/-03 2000 Mar 3 - -3:00 Arg -03/-02 + -4:00 - %z 1930 Dec + -4:00 Arg %z 1969 Oct 5 + -3:00 Arg %z 1999 Oct 3 + -4:00 Arg %z 2000 Mar 3 + -3:00 Arg %z # # Córdoba (CB), Santa Fe (SF), Entre Ríos (ER), Corrientes (CN), Misiones (MN), # Chaco (CC), Formosa (FM), Santiago del Estero (SE) @@ -422,120 +422,120 @@ Zone America/Argentina/Buenos_Aires -3:53:48 - LMT 1894 Oct 31 #STDOFF -4:16:48.25 Zone America/Argentina/Cordoba -4:16:48 - LMT 1894 Oct 31 -4:16:48 - CMT 1920 May - -4:00 - -04 1930 Dec - -4:00 Arg -04/-03 1969 Oct 5 - -3:00 Arg -03/-02 1991 Mar 3 - -4:00 - -04 1991 Oct 20 - -3:00 Arg -03/-02 1999 Oct 3 - -4:00 Arg -04/-03 2000 Mar 3 - -3:00 Arg -03/-02 + -4:00 - %z 1930 Dec + -4:00 Arg %z 1969 Oct 5 + -3:00 Arg %z 1991 Mar 3 + -4:00 - %z 1991 Oct 20 + -3:00 Arg %z 1999 Oct 3 + -4:00 Arg %z 2000 Mar 3 + -3:00 Arg %z # # Salta (SA), La Pampa (LP), Neuquén (NQ), Rio Negro (RN) Zone America/Argentina/Salta -4:21:40 - LMT 1894 Oct 31 #STDOFF -4:16:48.25 -4:16:48 - CMT 1920 May - -4:00 - -04 1930 Dec - -4:00 Arg -04/-03 1969 Oct 5 - -3:00 Arg -03/-02 1991 Mar 3 - -4:00 - -04 1991 Oct 20 - -3:00 Arg -03/-02 1999 Oct 3 - -4:00 Arg -04/-03 2000 Mar 3 - -3:00 Arg -03/-02 2008 Oct 18 - -3:00 - -03 + -4:00 - %z 1930 Dec + -4:00 Arg %z 1969 Oct 5 + -3:00 Arg %z 1991 Mar 3 + -4:00 - %z 1991 Oct 20 + -3:00 Arg %z 1999 Oct 3 + -4:00 Arg %z 2000 Mar 3 + -3:00 Arg %z 2008 Oct 18 + -3:00 - %z # # Tucumán (TM) Zone America/Argentina/Tucuman -4:20:52 - LMT 1894 Oct 31 #STDOFF -4:16:48.25 -4:16:48 - CMT 1920 May - -4:00 - -04 1930 Dec - -4:00 Arg -04/-03 1969 Oct 5 - -3:00 Arg -03/-02 1991 Mar 3 - -4:00 - -04 1991 Oct 20 - -3:00 Arg -03/-02 1999 Oct 3 - -4:00 Arg -04/-03 2000 Mar 3 - -3:00 - -03 2004 Jun 1 - -4:00 - -04 2004 Jun 13 - -3:00 Arg -03/-02 + -4:00 - %z 1930 Dec + -4:00 Arg %z 1969 Oct 5 + -3:00 Arg %z 1991 Mar 3 + -4:00 - %z 1991 Oct 20 + -3:00 Arg %z 1999 Oct 3 + -4:00 Arg %z 2000 Mar 3 + -3:00 - %z 2004 Jun 1 + -4:00 - %z 2004 Jun 13 + -3:00 Arg %z # # La Rioja (LR) Zone America/Argentina/La_Rioja -4:27:24 - LMT 1894 Oct 31 #STDOFF -4:16:48.25 -4:16:48 - CMT 1920 May - -4:00 - -04 1930 Dec - -4:00 Arg -04/-03 1969 Oct 5 - -3:00 Arg -03/-02 1991 Mar 1 - -4:00 - -04 1991 May 7 - -3:00 Arg -03/-02 1999 Oct 3 - -4:00 Arg -04/-03 2000 Mar 3 - -3:00 - -03 2004 Jun 1 - -4:00 - -04 2004 Jun 20 - -3:00 Arg -03/-02 2008 Oct 18 - -3:00 - -03 + -4:00 - %z 1930 Dec + -4:00 Arg %z 1969 Oct 5 + -3:00 Arg %z 1991 Mar 1 + -4:00 - %z 1991 May 7 + -3:00 Arg %z 1999 Oct 3 + -4:00 Arg %z 2000 Mar 3 + -3:00 - %z 2004 Jun 1 + -4:00 - %z 2004 Jun 20 + -3:00 Arg %z 2008 Oct 18 + -3:00 - %z # # San Juan (SJ) Zone America/Argentina/San_Juan -4:34:04 - LMT 1894 Oct 31 #STDOFF -4:16:48.25 -4:16:48 - CMT 1920 May - -4:00 - -04 1930 Dec - -4:00 Arg -04/-03 1969 Oct 5 - -3:00 Arg -03/-02 1991 Mar 1 - -4:00 - -04 1991 May 7 - -3:00 Arg -03/-02 1999 Oct 3 - -4:00 Arg -04/-03 2000 Mar 3 - -3:00 - -03 2004 May 31 - -4:00 - -04 2004 Jul 25 - -3:00 Arg -03/-02 2008 Oct 18 - -3:00 - -03 + -4:00 - %z 1930 Dec + -4:00 Arg %z 1969 Oct 5 + -3:00 Arg %z 1991 Mar 1 + -4:00 - %z 1991 May 7 + -3:00 Arg %z 1999 Oct 3 + -4:00 Arg %z 2000 Mar 3 + -3:00 - %z 2004 May 31 + -4:00 - %z 2004 Jul 25 + -3:00 Arg %z 2008 Oct 18 + -3:00 - %z # # Jujuy (JY) Zone America/Argentina/Jujuy -4:21:12 - LMT 1894 Oct 31 #STDOFF -4:16:48.25 -4:16:48 - CMT 1920 May - -4:00 - -04 1930 Dec - -4:00 Arg -04/-03 1969 Oct 5 - -3:00 Arg -03/-02 1990 Mar 4 - -4:00 - -04 1990 Oct 28 - -4:00 1:00 -03 1991 Mar 17 - -4:00 - -04 1991 Oct 6 - -3:00 1:00 -02 1992 - -3:00 Arg -03/-02 1999 Oct 3 - -4:00 Arg -04/-03 2000 Mar 3 - -3:00 Arg -03/-02 2008 Oct 18 - -3:00 - -03 + -4:00 - %z 1930 Dec + -4:00 Arg %z 1969 Oct 5 + -3:00 Arg %z 1990 Mar 4 + -4:00 - %z 1990 Oct 28 + -4:00 1:00 %z 1991 Mar 17 + -4:00 - %z 1991 Oct 6 + -3:00 1:00 %z 1992 + -3:00 Arg %z 1999 Oct 3 + -4:00 Arg %z 2000 Mar 3 + -3:00 Arg %z 2008 Oct 18 + -3:00 - %z # # Catamarca (CT), Chubut (CH) Zone America/Argentina/Catamarca -4:23:08 - LMT 1894 Oct 31 #STDOFF -4:16:48.25 -4:16:48 - CMT 1920 May - -4:00 - -04 1930 Dec - -4:00 Arg -04/-03 1969 Oct 5 - -3:00 Arg -03/-02 1991 Mar 3 - -4:00 - -04 1991 Oct 20 - -3:00 Arg -03/-02 1999 Oct 3 - -4:00 Arg -04/-03 2000 Mar 3 - -3:00 - -03 2004 Jun 1 - -4:00 - -04 2004 Jun 20 - -3:00 Arg -03/-02 2008 Oct 18 - -3:00 - -03 + -4:00 - %z 1930 Dec + -4:00 Arg %z 1969 Oct 5 + -3:00 Arg %z 1991 Mar 3 + -4:00 - %z 1991 Oct 20 + -3:00 Arg %z 1999 Oct 3 + -4:00 Arg %z 2000 Mar 3 + -3:00 - %z 2004 Jun 1 + -4:00 - %z 2004 Jun 20 + -3:00 Arg %z 2008 Oct 18 + -3:00 - %z # # Mendoza (MZ) Zone America/Argentina/Mendoza -4:35:16 - LMT 1894 Oct 31 #STDOFF -4:16:48.25 -4:16:48 - CMT 1920 May - -4:00 - -04 1930 Dec - -4:00 Arg -04/-03 1969 Oct 5 - -3:00 Arg -03/-02 1990 Mar 4 - -4:00 - -04 1990 Oct 15 - -4:00 1:00 -03 1991 Mar 1 - -4:00 - -04 1991 Oct 15 - -4:00 1:00 -03 1992 Mar 1 - -4:00 - -04 1992 Oct 18 - -3:00 Arg -03/-02 1999 Oct 3 - -4:00 Arg -04/-03 2000 Mar 3 - -3:00 - -03 2004 May 23 - -4:00 - -04 2004 Sep 26 - -3:00 Arg -03/-02 2008 Oct 18 - -3:00 - -03 + -4:00 - %z 1930 Dec + -4:00 Arg %z 1969 Oct 5 + -3:00 Arg %z 1990 Mar 4 + -4:00 - %z 1990 Oct 15 + -4:00 1:00 %z 1991 Mar 1 + -4:00 - %z 1991 Oct 15 + -4:00 1:00 %z 1992 Mar 1 + -4:00 - %z 1992 Oct 18 + -3:00 Arg %z 1999 Oct 3 + -4:00 Arg %z 2000 Mar 3 + -3:00 - %z 2004 May 23 + -4:00 - %z 2004 Sep 26 + -3:00 Arg %z 2008 Oct 18 + -3:00 - %z # # San Luis (SL) @@ -545,46 +545,46 @@ Rule SanLuis 2007 2008 - Oct Sun>=8 0:00 1:00 - Zone America/Argentina/San_Luis -4:25:24 - LMT 1894 Oct 31 #STDOFF -4:16:48.25 -4:16:48 - CMT 1920 May - -4:00 - -04 1930 Dec - -4:00 Arg -04/-03 1969 Oct 5 - -3:00 Arg -03/-02 1990 - -3:00 1:00 -02 1990 Mar 14 - -4:00 - -04 1990 Oct 15 - -4:00 1:00 -03 1991 Mar 1 - -4:00 - -04 1991 Jun 1 - -3:00 - -03 1999 Oct 3 - -4:00 1:00 -03 2000 Mar 3 - -3:00 - -03 2004 May 31 - -4:00 - -04 2004 Jul 25 - -3:00 Arg -03/-02 2008 Jan 21 - -4:00 SanLuis -04/-03 2009 Oct 11 - -3:00 - -03 + -4:00 - %z 1930 Dec + -4:00 Arg %z 1969 Oct 5 + -3:00 Arg %z 1990 + -3:00 1:00 %z 1990 Mar 14 + -4:00 - %z 1990 Oct 15 + -4:00 1:00 %z 1991 Mar 1 + -4:00 - %z 1991 Jun 1 + -3:00 - %z 1999 Oct 3 + -4:00 1:00 %z 2000 Mar 3 + -3:00 - %z 2004 May 31 + -4:00 - %z 2004 Jul 25 + -3:00 Arg %z 2008 Jan 21 + -4:00 SanLuis %z 2009 Oct 11 + -3:00 - %z # # Santa Cruz (SC) Zone America/Argentina/Rio_Gallegos -4:36:52 - LMT 1894 Oct 31 #STDOFF -4:16:48.25 -4:16:48 - CMT 1920 May - -4:00 - -04 1930 Dec - -4:00 Arg -04/-03 1969 Oct 5 - -3:00 Arg -03/-02 1999 Oct 3 - -4:00 Arg -04/-03 2000 Mar 3 - -3:00 - -03 2004 Jun 1 - -4:00 - -04 2004 Jun 20 - -3:00 Arg -03/-02 2008 Oct 18 - -3:00 - -03 + -4:00 - %z 1930 Dec + -4:00 Arg %z 1969 Oct 5 + -3:00 Arg %z 1999 Oct 3 + -4:00 Arg %z 2000 Mar 3 + -3:00 - %z 2004 Jun 1 + -4:00 - %z 2004 Jun 20 + -3:00 Arg %z 2008 Oct 18 + -3:00 - %z # # Tierra del Fuego, Antártida e Islas del Atlántico Sur (TF) Zone America/Argentina/Ushuaia -4:33:12 - LMT 1894 Oct 31 #STDOFF -4:16:48.25 -4:16:48 - CMT 1920 May - -4:00 - -04 1930 Dec - -4:00 Arg -04/-03 1969 Oct 5 - -3:00 Arg -03/-02 1999 Oct 3 - -4:00 Arg -04/-03 2000 Mar 3 - -3:00 - -03 2004 May 30 - -4:00 - -04 2004 Jun 20 - -3:00 Arg -03/-02 2008 Oct 18 - -3:00 - -03 + -4:00 - %z 1930 Dec + -4:00 Arg %z 1969 Oct 5 + -3:00 Arg %z 1999 Oct 3 + -4:00 Arg %z 2000 Mar 3 + -3:00 - %z 2004 May 30 + -4:00 - %z 2004 Jun 20 + -3:00 Arg %z 2008 Oct 18 + -3:00 - %z # Aruba # Zone NAME STDOFF RULES FORMAT [UNTIL] @@ -597,7 +597,7 @@ Zone America/Aruba -4:40:24 - LMT 1912 Feb 12 # Oranjestad Zone America/La_Paz -4:32:36 - LMT 1890 -4:32:36 - CMT 1931 Oct 15 # Calamarca MT -4:32:36 1:00 BST 1932 Mar 21 # Bolivia ST - -4:00 - -04 + -4:00 - %z # Brazil @@ -968,12 +968,12 @@ Rule Brazil 2018 only - Nov Sun>=1 0:00 1:00 - # # Fernando de Noronha (administratively part of PE) Zone America/Noronha -2:09:40 - LMT 1914 - -2:00 Brazil -02/-01 1990 Sep 17 - -2:00 - -02 1999 Sep 30 - -2:00 Brazil -02/-01 2000 Oct 15 - -2:00 - -02 2001 Sep 13 - -2:00 Brazil -02/-01 2002 Oct 1 - -2:00 - -02 + -2:00 Brazil %z 1990 Sep 17 + -2:00 - %z 1999 Sep 30 + -2:00 Brazil %z 2000 Oct 15 + -2:00 - %z 2001 Sep 13 + -2:00 Brazil %z 2002 Oct 1 + -2:00 - %z # Other Atlantic islands have no permanent settlement. # These include Trindade and Martim Vaz (administratively part of ES), # Rocas Atoll (RN), and the St Peter and St Paul Archipelago (PE). @@ -986,119 +986,119 @@ Zone America/Noronha -2:09:40 - LMT 1914 # In the north a very small part from the river Javary (now Jari I guess, # the border with Amapá) to the Amazon, then to the Xingu. Zone America/Belem -3:13:56 - LMT 1914 - -3:00 Brazil -03/-02 1988 Sep 12 - -3:00 - -03 + -3:00 Brazil %z 1988 Sep 12 + -3:00 - %z # # west Pará (PA) # West Pará includes Altamira, Óbidos, Prainha, Oriximiná, and Santarém. Zone America/Santarem -3:38:48 - LMT 1914 - -4:00 Brazil -04/-03 1988 Sep 12 - -4:00 - -04 2008 Jun 24 0:00 - -3:00 - -03 + -4:00 Brazil %z 1988 Sep 12 + -4:00 - %z 2008 Jun 24 0:00 + -3:00 - %z # # Maranhão (MA), Piauí (PI), Ceará (CE), Rio Grande do Norte (RN), # Paraíba (PB) Zone America/Fortaleza -2:34:00 - LMT 1914 - -3:00 Brazil -03/-02 1990 Sep 17 - -3:00 - -03 1999 Sep 30 - -3:00 Brazil -03/-02 2000 Oct 22 - -3:00 - -03 2001 Sep 13 - -3:00 Brazil -03/-02 2002 Oct 1 - -3:00 - -03 + -3:00 Brazil %z 1990 Sep 17 + -3:00 - %z 1999 Sep 30 + -3:00 Brazil %z 2000 Oct 22 + -3:00 - %z 2001 Sep 13 + -3:00 Brazil %z 2002 Oct 1 + -3:00 - %z # # Pernambuco (PE) (except Atlantic islands) Zone America/Recife -2:19:36 - LMT 1914 - -3:00 Brazil -03/-02 1990 Sep 17 - -3:00 - -03 1999 Sep 30 - -3:00 Brazil -03/-02 2000 Oct 15 - -3:00 - -03 2001 Sep 13 - -3:00 Brazil -03/-02 2002 Oct 1 - -3:00 - -03 + -3:00 Brazil %z 1990 Sep 17 + -3:00 - %z 1999 Sep 30 + -3:00 Brazil %z 2000 Oct 15 + -3:00 - %z 2001 Sep 13 + -3:00 Brazil %z 2002 Oct 1 + -3:00 - %z # # Tocantins (TO) Zone America/Araguaina -3:12:48 - LMT 1914 - -3:00 Brazil -03/-02 1990 Sep 17 - -3:00 - -03 1995 Sep 14 - -3:00 Brazil -03/-02 2003 Sep 24 - -3:00 - -03 2012 Oct 21 - -3:00 Brazil -03/-02 2013 Sep - -3:00 - -03 + -3:00 Brazil %z 1990 Sep 17 + -3:00 - %z 1995 Sep 14 + -3:00 Brazil %z 2003 Sep 24 + -3:00 - %z 2012 Oct 21 + -3:00 Brazil %z 2013 Sep + -3:00 - %z # # Alagoas (AL), Sergipe (SE) Zone America/Maceio -2:22:52 - LMT 1914 - -3:00 Brazil -03/-02 1990 Sep 17 - -3:00 - -03 1995 Oct 13 - -3:00 Brazil -03/-02 1996 Sep 4 - -3:00 - -03 1999 Sep 30 - -3:00 Brazil -03/-02 2000 Oct 22 - -3:00 - -03 2001 Sep 13 - -3:00 Brazil -03/-02 2002 Oct 1 - -3:00 - -03 + -3:00 Brazil %z 1990 Sep 17 + -3:00 - %z 1995 Oct 13 + -3:00 Brazil %z 1996 Sep 4 + -3:00 - %z 1999 Sep 30 + -3:00 Brazil %z 2000 Oct 22 + -3:00 - %z 2001 Sep 13 + -3:00 Brazil %z 2002 Oct 1 + -3:00 - %z # # Bahia (BA) # There are too many Salvadors elsewhere, so use America/Bahia instead # of America/Salvador. Zone America/Bahia -2:34:04 - LMT 1914 - -3:00 Brazil -03/-02 2003 Sep 24 - -3:00 - -03 2011 Oct 16 - -3:00 Brazil -03/-02 2012 Oct 21 - -3:00 - -03 + -3:00 Brazil %z 2003 Sep 24 + -3:00 - %z 2011 Oct 16 + -3:00 Brazil %z 2012 Oct 21 + -3:00 - %z # # Goiás (GO), Distrito Federal (DF), Minas Gerais (MG), # Espírito Santo (ES), Rio de Janeiro (RJ), São Paulo (SP), Paraná (PR), # Santa Catarina (SC), Rio Grande do Sul (RS) Zone America/Sao_Paulo -3:06:28 - LMT 1914 - -3:00 Brazil -03/-02 1963 Oct 23 0:00 - -3:00 1:00 -02 1964 - -3:00 Brazil -03/-02 + -3:00 Brazil %z 1963 Oct 23 0:00 + -3:00 1:00 %z 1964 + -3:00 Brazil %z # # Mato Grosso do Sul (MS) Zone America/Campo_Grande -3:38:28 - LMT 1914 - -4:00 Brazil -04/-03 + -4:00 Brazil %z # # Mato Grosso (MT) Zone America/Cuiaba -3:44:20 - LMT 1914 - -4:00 Brazil -04/-03 2003 Sep 24 - -4:00 - -04 2004 Oct 1 - -4:00 Brazil -04/-03 + -4:00 Brazil %z 2003 Sep 24 + -4:00 - %z 2004 Oct 1 + -4:00 Brazil %z # # Rondônia (RO) Zone America/Porto_Velho -4:15:36 - LMT 1914 - -4:00 Brazil -04/-03 1988 Sep 12 - -4:00 - -04 + -4:00 Brazil %z 1988 Sep 12 + -4:00 - %z # # Roraima (RR) Zone America/Boa_Vista -4:02:40 - LMT 1914 - -4:00 Brazil -04/-03 1988 Sep 12 - -4:00 - -04 1999 Sep 30 - -4:00 Brazil -04/-03 2000 Oct 15 - -4:00 - -04 + -4:00 Brazil %z 1988 Sep 12 + -4:00 - %z 1999 Sep 30 + -4:00 Brazil %z 2000 Oct 15 + -4:00 - %z # # east Amazonas (AM): Boca do Acre, Jutaí, Manaus, Floriano Peixoto # The great circle line from Tabatinga to Porto Acre divides # east from west Amazonas. Zone America/Manaus -4:00:04 - LMT 1914 - -4:00 Brazil -04/-03 1988 Sep 12 - -4:00 - -04 1993 Sep 28 - -4:00 Brazil -04/-03 1994 Sep 22 - -4:00 - -04 + -4:00 Brazil %z 1988 Sep 12 + -4:00 - %z 1993 Sep 28 + -4:00 Brazil %z 1994 Sep 22 + -4:00 - %z # # west Amazonas (AM): Atalaia do Norte, Boca do Maoco, Benjamin Constant, # Eirunepé, Envira, Ipixuna Zone America/Eirunepe -4:39:28 - LMT 1914 - -5:00 Brazil -05/-04 1988 Sep 12 - -5:00 - -05 1993 Sep 28 - -5:00 Brazil -05/-04 1994 Sep 22 - -5:00 - -05 2008 Jun 24 0:00 - -4:00 - -04 2013 Nov 10 - -5:00 - -05 + -5:00 Brazil %z 1988 Sep 12 + -5:00 - %z 1993 Sep 28 + -5:00 Brazil %z 1994 Sep 22 + -5:00 - %z 2008 Jun 24 0:00 + -4:00 - %z 2013 Nov 10 + -5:00 - %z # # Acre (AC) Zone America/Rio_Branco -4:31:12 - LMT 1914 - -5:00 Brazil -05/-04 1988 Sep 12 - -5:00 - -05 2008 Jun 24 0:00 - -4:00 - -04 2013 Nov 10 - -5:00 - -05 + -5:00 Brazil %z 1988 Sep 12 + -5:00 - %z 2008 Jun 24 0:00 + -4:00 - %z 2013 Nov 10 + -5:00 - %z # Chile @@ -1366,36 +1366,36 @@ Rule Chile 2023 max - Sep Sun>=2 4:00u 1:00 - # Zone NAME STDOFF RULES FORMAT [UNTIL] Zone America/Santiago -4:42:45 - LMT 1890 -4:42:45 - SMT 1910 Jan 10 # Santiago Mean Time - -5:00 - -05 1916 Jul 1 + -5:00 - %z 1916 Jul 1 -4:42:45 - SMT 1918 Sep 10 - -4:00 - -04 1919 Jul 1 + -4:00 - %z 1919 Jul 1 -4:42:45 - SMT 1927 Sep 1 - -5:00 Chile -05/-04 1932 Sep 1 - -4:00 - -04 1942 Jun 1 - -5:00 - -05 1942 Aug 1 - -4:00 - -04 1946 Jul 14 24:00 - -4:00 1:00 -03 1946 Aug 28 24:00 # central CL - -5:00 1:00 -04 1947 Mar 31 24:00 - -5:00 - -05 1947 May 21 23:00 - -4:00 Chile -04/-03 + -5:00 Chile %z 1932 Sep 1 + -4:00 - %z 1942 Jun 1 + -5:00 - %z 1942 Aug 1 + -4:00 - %z 1946 Jul 14 24:00 + -4:00 1:00 %z 1946 Aug 28 24:00 # central CL + -5:00 1:00 %z 1947 Mar 31 24:00 + -5:00 - %z 1947 May 21 23:00 + -4:00 Chile %z Zone America/Punta_Arenas -4:43:40 - LMT 1890 -4:42:45 - SMT 1910 Jan 10 - -5:00 - -05 1916 Jul 1 + -5:00 - %z 1916 Jul 1 -4:42:45 - SMT 1918 Sep 10 - -4:00 - -04 1919 Jul 1 + -4:00 - %z 1919 Jul 1 -4:42:45 - SMT 1927 Sep 1 - -5:00 Chile -05/-04 1932 Sep 1 - -4:00 - -04 1942 Jun 1 - -5:00 - -05 1942 Aug 1 - -4:00 - -04 1946 Aug 28 24:00 - -5:00 1:00 -04 1947 Mar 31 24:00 - -5:00 - -05 1947 May 21 23:00 - -4:00 Chile -04/-03 2016 Dec 4 - -3:00 - -03 + -5:00 Chile %z 1932 Sep 1 + -4:00 - %z 1942 Jun 1 + -5:00 - %z 1942 Aug 1 + -4:00 - %z 1946 Aug 28 24:00 + -5:00 1:00 %z 1947 Mar 31 24:00 + -5:00 - %z 1947 May 21 23:00 + -4:00 Chile %z 2016 Dec 4 + -3:00 - %z Zone Pacific/Easter -7:17:28 - LMT 1890 -7:17:28 - EMT 1932 Sep # Easter Mean Time - -7:00 Chile -07/-06 1982 Mar 14 3:00u # Easter Time - -6:00 Chile -06/-05 + -7:00 Chile %z 1982 Mar 14 3:00u # Easter Time + -6:00 Chile %z # # Salas y Gómez Island is uninhabited. # Other Chilean locations, including Juan Fernández Is, Desventuradas Is, @@ -1415,10 +1415,10 @@ Zone Pacific/Easter -7:17:28 - LMT 1890 # # Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Antarctica/Palmer 0 - -00 1965 - -4:00 Arg -04/-03 1969 Oct 5 - -3:00 Arg -03/-02 1982 May - -4:00 Chile -04/-03 2016 Dec 4 - -3:00 - -03 + -4:00 Arg %z 1969 Oct 5 + -3:00 Arg %z 1982 May + -4:00 Chile %z 2016 Dec 4 + -3:00 - %z # Colombia @@ -1437,7 +1437,7 @@ Rule CO 1993 only - Feb 6 24:00 0 - #STDOFF -4:56:16.4 Zone America/Bogota -4:56:16 - LMT 1884 Mar 13 -4:56:16 - BMT 1914 Nov 23 # Bogotá Mean Time - -5:00 CO -05/-04 + -5:00 CO %z # Malpelo, Providencia, San Andres # no information; probably like America/Bogota @@ -1475,10 +1475,10 @@ Rule Ecuador 1993 only - Feb 5 0:00 0 - # Zone NAME STDOFF RULES FORMAT [UNTIL] Zone America/Guayaquil -5:19:20 - LMT 1890 -5:14:00 - QMT 1931 # Quito Mean Time - -5:00 Ecuador -05/-04 + -5:00 Ecuador %z Zone Pacific/Galapagos -5:58:24 - LMT 1931 # Puerto Baquerizo Moreno - -5:00 - -05 1986 - -6:00 Ecuador -06/-05 + -5:00 - %z 1986 + -6:00 Ecuador %z # Falklands @@ -1578,10 +1578,10 @@ Rule Falk 2001 2010 - Sep Sun>=1 2:00 1:00 - # Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Atlantic/Stanley -3:51:24 - LMT 1890 -3:51:24 - SMT 1912 Mar 12 # Stanley Mean Time - -4:00 Falk -04/-03 1983 May - -3:00 Falk -03/-02 1985 Sep 15 - -4:00 Falk -04/-03 2010 Sep 5 2:00 - -3:00 - -03 + -4:00 Falk %z 1983 May + -3:00 Falk %z 1985 Sep 15 + -4:00 Falk %z 2010 Sep 5 2:00 + -3:00 - %z # French Guiana # For the 1911/1912 establishment of standard time in French possessions, see: @@ -1589,8 +1589,8 @@ Zone Atlantic/Stanley -3:51:24 - LMT 1890 # page 752, 18b. # Zone NAME STDOFF RULES FORMAT [UNTIL] Zone America/Cayenne -3:29:20 - LMT 1911 Jul 1 - -4:00 - -04 1967 Oct - -3:00 - -03 + -4:00 - %z 1967 Oct + -3:00 - %z # Guyana @@ -1624,10 +1624,10 @@ Zone America/Cayenne -3:29:20 - LMT 1911 Jul 1 # Zone NAME STDOFF RULES FORMAT [UNTIL] Zone America/Guyana -3:52:39 - LMT 1911 Aug 1 # Georgetown - -4:00 - -04 1915 Mar 1 - -3:45 - -0345 1975 Aug 1 - -3:00 - -03 1992 Mar 29 1:00 - -4:00 - -04 + -4:00 - %z 1915 Mar 1 + -3:45 - %z 1975 Aug 1 + -3:00 - %z 1992 Mar 29 1:00 + -4:00 - %z # Paraguay # @@ -1725,9 +1725,9 @@ Rule Para 2013 max - Mar Sun>=22 0:00 0 - # Zone NAME STDOFF RULES FORMAT [UNTIL] Zone America/Asuncion -3:50:40 - LMT 1890 -3:50:40 - AMT 1931 Oct 10 # Asunción Mean Time - -4:00 - -04 1972 Oct - -3:00 - -03 1974 Apr - -4:00 Para -04/-03 + -4:00 - %z 1972 Oct + -3:00 - %z 1974 Apr + -4:00 Para %z # Peru # @@ -1754,12 +1754,12 @@ Rule Peru 1994 only - Apr 1 0:00 0 - # Zone NAME STDOFF RULES FORMAT [UNTIL] Zone America/Lima -5:08:12 - LMT 1890 -5:08:36 - LMT 1908 Jul 28 # Lima Mean Time? - -5:00 Peru -05/-04 + -5:00 Peru %z # South Georgia # Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Atlantic/South_Georgia -2:26:08 - LMT 1890 # Grytviken - -2:00 - -02 + -2:00 - %z # South Sandwich Is # uninhabited; scientific personnel have wintered @@ -1769,8 +1769,8 @@ Zone Atlantic/South_Georgia -2:26:08 - LMT 1890 # Grytviken Zone America/Paramaribo -3:40:40 - LMT 1911 -3:40:52 - PMT 1935 # Paramaribo Mean Time -3:40:36 - PMT 1945 Oct # The capital moved? - -3:30 - -0330 1984 Oct - -3:00 - -03 + -3:30 - %z 1984 Oct + -3:00 - %z # Trinidad and Tobago # Zone NAME STDOFF RULES FORMAT [UNTIL] @@ -1992,15 +1992,15 @@ Rule Uruguay 2006 2014 - Oct Sun>=1 2:00 1:00 - # This Zone can be simplified once we assume zic %z. Zone America/Montevideo -3:44:51 - LMT 1908 Jun 10 -3:44:51 - MMT 1920 May 1 # Montevideo MT - -4:00 - -04 1923 Oct 1 - -3:30 Uruguay -0330/-03 1942 Dec 14 - -3:00 Uruguay -03/-0230 1960 - -3:00 Uruguay -03/-02 1968 - -3:00 Uruguay -03/-0230 1970 - -3:00 Uruguay -03/-02 1974 - -3:00 Uruguay -03/-0130 1974 Mar 10 - -3:00 Uruguay -03/-0230 1974 Dec 22 - -3:00 Uruguay -03/-02 + -4:00 - %z 1923 Oct 1 + -3:30 Uruguay %z 1942 Dec 14 + -3:00 Uruguay %z 1960 + -3:00 Uruguay %z 1968 + -3:00 Uruguay %z 1970 + -3:00 Uruguay %z 1974 + -3:00 Uruguay %z 1974 Mar 10 + -3:00 Uruguay %z 1974 Dec 22 + -3:00 Uruguay %z # Venezuela # @@ -2034,7 +2034,7 @@ Zone America/Montevideo -3:44:51 - LMT 1908 Jun 10 # Zone NAME STDOFF RULES FORMAT [UNTIL] Zone America/Caracas -4:27:44 - LMT 1890 -4:27:40 - CMT 1912 Feb 12 # Caracas Mean Time? - -4:30 - -0430 1965 Jan 1 0:00 - -4:00 - -04 2007 Dec 9 3:00 - -4:30 - -0430 2016 May 1 2:30 - -4:00 - -04 + -4:30 - %z 1965 Jan 1 0:00 + -4:00 - %z 2007 Dec 9 3:00 + -4:30 - %z 2016 May 1 2:30 + -4:00 - %z diff --git a/share/zoneinfo/datfiles/zone.tab b/share/zoneinfo/datfiles/zone.tab index 59dd95213..c3eef6593 100644 --- a/share/zoneinfo/datfiles/zone.tab +++ b/share/zoneinfo/datfiles/zone.tab @@ -1,4 +1,4 @@ -# $OpenBSD: zone.tab,v 1.76 2024/01/02 22:43:21 millert Exp $ +# $OpenBSD: zone.tab,v 1.77 2024/10/02 17:08:47 millert Exp $ # tzdb timezone descriptions (deprecated version) # # This file is in the public domain, so clarified as of @@ -265,8 +265,7 @@ MK +4159+02126 Europe/Skopje ML +1239-00800 Africa/Bamako MM +1647+09610 Asia/Yangon MN +4755+10653 Asia/Ulaanbaatar most of Mongolia -MN +4801+09139 Asia/Hovd Bayan-Olgiy, Govi-Altai, Hovd, Uvs, Zavkhan -MN +4804+11430 Asia/Choibalsan Dornod, Sukhbaatar +MN +4801+09139 Asia/Hovd Bayan-Olgii, Hovd, Uvs MO +221150+1133230 Asia/Macau MP +1512+14545 Pacific/Saipan MQ +1436-06105 America/Martinique diff --git a/share/zoneinfo/datfiles/zone1970.tab b/share/zoneinfo/datfiles/zone1970.tab index d720524c4..c9c151b89 100644 --- a/share/zoneinfo/datfiles/zone1970.tab +++ b/share/zoneinfo/datfiles/zone1970.tab @@ -1,4 +1,4 @@ -# $OpenBSD: zone1970.tab,v 1.29 2024/01/02 22:43:21 millert Exp $ +# $OpenBSD: zone1970.tab,v 1.30 2024/10/02 17:08:47 millert Exp $ # tzdb timezone descriptions # # This file is in the public domain. @@ -210,8 +210,7 @@ MD +4700+02850 Europe/Chisinau MH +0905+16720 Pacific/Kwajalein Kwajalein MM,CC +1647+09610 Asia/Yangon MN +4755+10653 Asia/Ulaanbaatar most of Mongolia -MN +4801+09139 Asia/Hovd Bayan-Ölgii, Govi-Altai, Hovd, Uvs, Zavkhan -MN +4804+11430 Asia/Choibalsan Dornod, Sükhbaatar +MN +4801+09139 Asia/Hovd Bayan-Ölgii, Hovd, Uvs MO +221150+1133230 Asia/Macau MQ +1436-06105 America/Martinique MT +3554+01431 Europe/Malta diff --git a/share/zoneinfo/datfiles/zonenow.tab b/share/zoneinfo/datfiles/zonenow.tab index b6f291095..01f536b3b 100644 --- a/share/zoneinfo/datfiles/zonenow.tab +++ b/share/zoneinfo/datfiles/zonenow.tab @@ -5,7 +5,7 @@ # From Paul Eggert (2023-12-18): # This file contains a table where each row stands for a timezone # where civil timestamps are predicted to agree from now on. -# This file is like zone1970.tab (see zone1970.tab's coments), +# This file is like zone1970.tab (see zone1970.tab's comments), # but with the following changes: # # 1. Each timezone corresponds to a set of clocks that are planned @@ -123,8 +123,6 @@ XX +1455-02331 Atlantic/Cape_Verde Cape Verde # # -01/+00 (EU DST) XX +3744-02540 Atlantic/Azores Azores -# -01/+00 (EU DST) until 2024-03-31; then -02/-01 (EU DST) -XX +7029-02158 America/Scoresbysund Ittoqqortoormiit # # +00 - GMT XX +0519-00402 Africa/Abidjan far western Africa; Iceland ("GMT") @@ -199,7 +197,7 @@ XX +2518+05518 Asia/Dubai Russia; Caucasus; Persian Gulf; Seychelles; Réunion XX +3431+06912 Asia/Kabul Afghanistan # # +05 -XX +4120+06918 Asia/Tashkent Russia; west Kazakhstan; Tajikistan; Turkmenistan; Uzbekistan; Maldives +XX +4120+06918 Asia/Tashkent Russia; Kazakhstan; Tajikistan; Turkmenistan; Uzbekistan; Maldives # # +05 - PKT XX +2452+06703 Asia/Karachi Pakistan ("PKT") @@ -215,8 +213,6 @@ XX +2743+08519 Asia/Kathmandu Nepal # # +06 XX +2343+09025 Asia/Dhaka Russia; Kyrgyzstan; Bhutan; Bangladesh; Chagos -# +06 until 2024-03-01; then +05 -XX +4315+07657 Asia/Almaty Kazakhstan (except western areas) # # +06:30 XX +1647+09610 Asia/Yangon Myanmar; Cocos diff --git a/share/zoneinfo/ziguard.awk b/share/zoneinfo/ziguard.awk index 7a3404fa4..c0acb72a0 100644 --- a/share/zoneinfo/ziguard.awk +++ b/share/zoneinfo/ziguard.awk @@ -5,14 +5,10 @@ # This is not a general-purpose converter; it is designed for current tzdata. # It just converts from current source to main, vanguard, and rearguard forms. # Although it might be nice for it to be idempotent, or to be useful -# for converting back and forth between vanguard and rearguard formats, +# for converting back and forth between formats, # it does not do these nonessential tasks now. # -# Although main and vanguard forms are currently equivalent, -# this need not always be the case. When the two forms differ, -# this script can convert either from main to vanguard form (needed then), -# or from vanguard to main form (this conversion would be needed later, -# after main became rearguard and vanguard became main). +# This script can convert from main to vanguard form and vice versa. # There is no need to convert rearguard to other forms. # # When converting to vanguard form, the output can use the line @@ -145,12 +141,12 @@ DATAFORM != "main" { } # If this line should differ due to Portugal benefiting from %z if supported, - # uncomment the desired version and comment out the undesired one. - if ($0 ~ /^#?[\t ]+-[12]:00[\t ]+Port[\t ]+[%+-]/) { - if (($0 ~ /%z/) == (DATAFORM == "vanguard")) { - uncomment = in_comment - } else { + # comment out the undesired version and uncomment the desired one. + if ($0 ~ /^#?[\t ]+-[12]:00[\t ]+((Port|W-Eur)[\t ]+[%+-]|-[\t ]+(%z|-01)[\t ]+1982 Mar 28)/) { + if (($0 ~ /%z/) == (DATAFORM == "rearguard")) { comment_out = !in_comment + } else { + uncomment = in_comment } } @@ -172,13 +168,8 @@ DATAFORM != "main" { sub(/^/, "#") } - # Prefer %z in vanguard form, explicit abbreviations otherwise. - if (DATAFORM == "vanguard") { - sub(/^(Zone[\t ]+[^\t ]+)?[\t ]+[^\t ]+[\t ]+[^\t ]+[\t ]+[-+][^\t ]+/, \ - "&CHANGE-TO-%z") - sub(/-00CHANGE-TO-%z/, "-00") - sub(/[-+][^\t ]+CHANGE-TO-/, "") - } else { + # Prefer explicit abbreviations in rearguard form, %z otherwise. + if (DATAFORM == "rearguard") { if ($0 ~ /^[^#]*%z/) { stdoff_column = 2 * ($0 ~ /^Zone/) + 1 rules_column = stdoff_column + 1 @@ -216,6 +207,11 @@ DATAFORM != "main" { } sub(/%z/, abbr) } + } else { + sub(/^(Zone[\t ]+[^\t ]+)?[\t ]+[^\t ]+[\t ]+[^\t ]+[\t ]+[-+][^\t ]+/, \ + "&CHANGE-TO-%z") + sub(/-00CHANGE-TO-%z/, "-00") + sub(/[-+][^\t ]+CHANGE-TO-/, "") } # Normally, prefer whole seconds. However, prefer subseconds diff --git a/sys/arch/amd64/amd64/pmap.c b/sys/arch/amd64/amd64/pmap.c index ceef0b25b..35af9d10c 100644 --- a/sys/arch/amd64/amd64/pmap.c +++ b/sys/arch/amd64/amd64/pmap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap.c,v 1.176 2024/09/26 21:55:42 dv Exp $ */ +/* $OpenBSD: pmap.c,v 1.177 2024/10/02 18:18:27 dv Exp $ */ /* $NetBSD: pmap.c,v 1.3 2003/05/08 18:13:13 thorpej Exp $ */ /* @@ -2468,9 +2468,7 @@ pmap_remove_ept(struct pmap *pmap, vaddr_t sgpa, vaddr_t egpa) for (v = sgpa; v < egpa + PAGE_SIZE; v += PAGE_SIZE) pmap_do_remove_ept(pmap, v); -#ifdef MULTIPROCESSOR pmap_shootept(pmap, 1); -#endif /* MULTIPROCESSOR */ mtx_leave(&pmap->pm_mtx); @@ -3518,4 +3516,22 @@ pmap_tlb_shoottlb(struct pmap *pm, int shootself) } } } + +#if NVMM > 0 +void +pmap_shootept(struct pmap *pm, int shootself) +{ + struct cpu_info *self = curcpu(); + struct vmx_invept_descriptor vid; + + KASSERT(pmap_is_ept(pm)); + + if (shootself && (self->ci_flags & CPUF_VMM)) { + vid.vid_eptp = pm->eptp; + vid.vid_reserved = 0; + invept(self->ci_vmm_cap.vcc_vmx.vmx_invept_mode, &vid); + } +} +#endif /* NVMM > 0 */ + #endif /* MULTIPROCESSOR */ diff --git a/sys/arch/amd64/include/vmmvar.h b/sys/arch/amd64/include/vmmvar.h index 6bc63d5ae..a2c9d5db4 100644 --- a/sys/arch/amd64/include/vmmvar.h +++ b/sys/arch/amd64/include/vmmvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: vmmvar.h,v 1.107 2024/09/26 13:18:25 dv Exp $ */ +/* $OpenBSD: vmmvar.h,v 1.108 2024/10/02 17:05:56 dv Exp $ */ /* * Copyright (c) 2014 Mike Larkin * @@ -23,9 +23,6 @@ #define VMM_HV_SIGNATURE "OpenBSDVMM58" -#define VMM_PCI_MMIO_BAR_BASE 0xF0000000ULL -#define VMM_PCI_MMIO_BAR_END 0xFFDFFFFFULL /* 2 MiB below 4 GiB */ - /* VMX: Basic Exit Reasons */ #define VMX_EXIT_NMI 0 #define VMX_EXIT_EXTINT 1 diff --git a/sys/arch/arm/arm/pmap7.c b/sys/arch/arm/arm/pmap7.c index f3a9d6819..3d2c5b900 100644 --- a/sys/arch/arm/arm/pmap7.c +++ b/sys/arch/arm/arm/pmap7.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap7.c,v 1.66 2023/01/01 19:49:17 miod Exp $ */ +/* $OpenBSD: pmap7.c,v 1.67 2024/10/02 10:12:52 mpi Exp $ */ /* $NetBSD: pmap.c,v 1.147 2004/01/18 13:03:50 scw Exp $ */ /* @@ -238,10 +238,10 @@ struct pool pmap_pmap_pool; * Pool of PV structures */ struct pool pmap_pv_pool; -void *pmap_bootstrap_pv_page_alloc(struct pool *, int, int *); -void pmap_bootstrap_pv_page_free(struct pool *, void *); -struct pool_allocator pmap_bootstrap_pv_allocator = { - pmap_bootstrap_pv_page_alloc, pmap_bootstrap_pv_page_free +void *pmap_pv_page_alloc(struct pool *, int, int *); +void pmap_pv_page_free(struct pool *, void *); +struct pool_allocator pmap_pv_allocator = { + pmap_pv_page_alloc, pmap_pv_page_free }; /* @@ -2360,7 +2360,7 @@ pmap_bootstrap(pd_entry_t *kernel_l1pt, vaddr_t vstart, vaddr_t vend) pool_init(&pmap_pmap_pool, sizeof(struct pmap), 0, IPL_NONE, 0, "pmappl", &pool_allocator_single); pool_init(&pmap_pv_pool, sizeof(struct pv_entry), 0, IPL_VM, 0, - "pvepl", &pmap_bootstrap_pv_allocator); + "pvepl", &pmap_pv_allocator); pool_init(&pmap_l2dtable_pool, sizeof(struct l2_dtable), 0, IPL_VM, 0, "l2dtblpl", NULL); pool_init(&pmap_l2ptp_pool, L2_TABLE_SIZE_REAL, L2_TABLE_SIZE_REAL, @@ -2397,48 +2397,22 @@ pmap_init(void) pmap_initialized = 1; } -static vaddr_t last_bootstrap_page = 0; -static void *free_bootstrap_pages = NULL; - void * -pmap_bootstrap_pv_page_alloc(struct pool *pp, int flags, int *slowdown) +pmap_pv_page_alloc(struct pool *pp, int flags, int *slowdown) { - extern void *pool_page_alloc(struct pool *, int, int *); - vaddr_t new_page; - void *rv; + struct kmem_dyn_mode kd = KMEM_DYN_INITIALIZER; - if (pmap_initialized) - return (pool_page_alloc(pp, flags, slowdown)); - *slowdown = 0; + kd.kd_waitok = ISSET(flags, PR_WAITOK); + kd.kd_slowdown = slowdown; - if (free_bootstrap_pages) { - rv = free_bootstrap_pages; - free_bootstrap_pages = *((void **)rv); - return (rv); - } - - new_page = uvm_km_kmemalloc(kernel_map, NULL, PAGE_SIZE, - (flags & PR_WAITOK) ? 0 : UVM_KMF_NOWAIT); - - last_bootstrap_page = new_page; - return ((void *)new_page); + return (km_alloc(pp->pr_pgsize, + pmap_initialized ? &kv_page : &kv_any, pp->pr_crange, &kd)); } void -pmap_bootstrap_pv_page_free(struct pool *pp, void *v) +pmap_pv_page_free(struct pool *pp, void *v) { - extern void pool_page_free(struct pool *, void *); - - if (pmap_initialized) { - pool_page_free(pp, v); - return; - } - - if ((vaddr_t)v < last_bootstrap_page) { - *((void **)v) = free_bootstrap_pages; - free_bootstrap_pages = v; - return; - } + km_free(v, pp->pr_pgsize, &kv_page, pp->pr_crange); } /* diff --git a/sys/conf/GENERIC b/sys/conf/GENERIC index 7b53cd7cd..f42b95ec9 100644 --- a/sys/conf/GENERIC +++ b/sys/conf/GENERIC @@ -1,4 +1,4 @@ -# $OpenBSD: GENERIC,v 1.298 2024/09/17 13:45:49 jsg Exp $ +# $OpenBSD: GENERIC,v 1.299 2024/10/03 04:39:09 tb Exp $ # # Machine-independent option; used by all architectures for their # GENERIC kernel @@ -16,7 +16,7 @@ option KMEMSTATS # collect malloc(9) statistics option PTRACE # ptrace(2) system call #option KVA_GUARDPAGES # slow virtual address recycling (+ guarding) -#option POOL_DEBUG # pool corruption detection +option POOL_DEBUG # pool corruption detection #option VFSLCKDEBUG # VFS locking checks option CRYPTO # Cryptographic framework diff --git a/sys/dev/acpi/qciic.c b/sys/dev/acpi/qciic.c index 5a4670160..13096d079 100644 --- a/sys/dev/acpi/qciic.c +++ b/sys/dev/acpi/qciic.c @@ -1,4 +1,4 @@ -/* $OpenBSD: qciic.c,v 1.6 2024/06/19 21:27:22 patrick Exp $ */ +/* $OpenBSD: qciic.c,v 1.7 2024/10/02 21:21:32 kettenis Exp $ */ /* * Copyright (c) 2022 Mark Kettenis * @@ -74,6 +74,7 @@ struct qciic_crs { uint16_t gpio_int_pin; uint16_t gpio_int_flags; struct aml_node *node; + int skip; }; int qciic_acpi_match(struct device *, void *, void *); @@ -373,6 +374,11 @@ qciic_acpi_parse_crs(int crsidx, union acpi_resource *crs, void *arg) uint16_t pin; switch (AML_CRSTYPE(crs)) { + case LR_MEM32FIXED: + /* An MMIO address means this is not an I2C device. */ + sc_crs->skip = 1; + break; + case LR_SERBUS: if (crs->lr_serbus.type == LR_SERBUS_I2C) { sc_crs->i2c_addr = crs->lr_i2cbus._adr; @@ -440,7 +446,7 @@ qciic_acpi_found_hid(struct aml_node *node, void *arg) aml_freevalue(&res); /* Skip if not using this bus. */ - if (crs.i2c_bus != sc->sc_node) + if (crs.skip || crs.i2c_bus != sc->sc_node) return 0; acpi_attach_deps(acpi_softc, node->parent); diff --git a/sys/dev/pci/drm/drm_drv.c b/sys/dev/pci/drm/drm_drv.c index be711ebc9..7ec4b47f1 100644 --- a/sys/dev/pci/drm/drm_drv.c +++ b/sys/dev/pci/drm/drm_drv.c @@ -47,6 +47,7 @@ #include #include #include +#include #include #include @@ -70,8 +71,7 @@ MODULE_AUTHOR("Gareth Hughes, Leif Delgass, José Fonseca, Jon Smirl"); MODULE_DESCRIPTION("DRM shared core routines"); MODULE_LICENSE("GPL and additional rights"); -static DEFINE_SPINLOCK(drm_minor_lock); -static struct idr drm_minors_idr; +DEFINE_XARRAY_ALLOC(drm_minors_xa); /* * If the drm core fails to init for whatever reason, @@ -144,6 +144,18 @@ SPLAY_PROTOTYPE(drm_file_tree, drm_file, link, drm_file_cmp); * registered and unregistered dynamically according to device-state. */ +static struct xarray *drm_minor_get_xa(enum drm_minor_type type) +{ + if (type == DRM_MINOR_PRIMARY || type == DRM_MINOR_RENDER) + return &drm_minors_xa; +#if IS_ENABLED(CONFIG_DRM_ACCEL) + else if (type == DRM_MINOR_ACCEL) + return &accel_minors_xa; +#endif + else + return ERR_PTR(-EOPNOTSUPP); +} + static struct drm_minor **drm_minor_get_slot(struct drm_device *dev, enum drm_minor_type type) { @@ -162,7 +174,6 @@ static struct drm_minor **drm_minor_get_slot(struct drm_device *dev, static void drm_minor_alloc_release(struct drm_device *dev, void *data) { struct drm_minor *minor = data; - unsigned long flags; WARN_ON(dev != minor->dev); @@ -170,19 +181,26 @@ static void drm_minor_alloc_release(struct drm_device *dev, void *data) put_device(minor->kdev); #endif - if (minor->type == DRM_MINOR_ACCEL) { - accel_minor_remove(minor->index); - } else { - spin_lock_irqsave(&drm_minor_lock, flags); - idr_remove(&drm_minors_idr, minor->index); - spin_unlock_irqrestore(&drm_minor_lock, flags); - } + xa_erase(drm_minor_get_xa(minor->type), minor->index); } +/* + * DRM used to support 64 devices, for backwards compatibility we need to maintain the + * minor allocation scheme where minors 0-63 are primary nodes, 64-127 are control nodes, + * and 128-191 are render nodes. + * After reaching the limit, we're allocating minors dynamically - first-come, first-serve. + * Accel nodes are using a distinct major, so the minors are allocated in continuous 0-MAX + * range. + */ +#define DRM_MINOR_LIMIT(t) ({ \ + typeof(t) _t = (t); \ + _t == DRM_MINOR_ACCEL ? XA_LIMIT(0, ACCEL_MAX_MINORS) : XA_LIMIT(64 * _t, 64 * _t + 63); \ +}) +#define DRM_EXTENDED_MINOR_LIMIT XA_LIMIT(192, (1 << MINORBITS) - 1) + static int drm_minor_alloc(struct drm_device *dev, enum drm_minor_type type) { struct drm_minor *minor; - unsigned long flags; int r; minor = drmm_kzalloc(dev, sizeof(*minor), GFP_KERNEL); @@ -192,25 +210,14 @@ static int drm_minor_alloc(struct drm_device *dev, enum drm_minor_type type) minor->type = type; minor->dev = dev; - idr_preload(GFP_KERNEL); - if (type == DRM_MINOR_ACCEL) { - r = accel_minor_alloc(); - } else { - spin_lock_irqsave(&drm_minor_lock, flags); - r = idr_alloc(&drm_minors_idr, - NULL, - 64 * type, - 64 * (type + 1), - GFP_NOWAIT); - spin_unlock_irqrestore(&drm_minor_lock, flags); - } - idr_preload_end(); - + r = xa_alloc(drm_minor_get_xa(type), &minor->index, + NULL, DRM_MINOR_LIMIT(type), GFP_KERNEL); + if (r == -EBUSY && (type == DRM_MINOR_PRIMARY || type == DRM_MINOR_RENDER)) + r = xa_alloc(&drm_minors_xa, &minor->index, + NULL, DRM_EXTENDED_MINOR_LIMIT, GFP_KERNEL); if (r < 0) return r; - minor->index = r; - r = drmm_add_action_or_reset(dev, drm_minor_alloc_release, minor); if (r) return r; @@ -228,10 +235,8 @@ static int drm_minor_alloc(struct drm_device *dev, enum drm_minor_type type) static int drm_minor_register(struct drm_device *dev, enum drm_minor_type type) { struct drm_minor *minor; - unsigned long flags; -#ifdef __linux__ + void *entry; int ret; -#endif DRM_DEBUG("\n"); @@ -258,28 +263,26 @@ static int drm_minor_register(struct drm_device *dev, enum drm_minor_type type) #endif /* replace NULL with @minor so lookups will succeed from now on */ - if (minor->type == DRM_MINOR_ACCEL) { - accel_minor_replace(minor, minor->index); - } else { - spin_lock_irqsave(&drm_minor_lock, flags); - idr_replace(&drm_minors_idr, minor, minor->index); - spin_unlock_irqrestore(&drm_minor_lock, flags); + entry = xa_store(drm_minor_get_xa(type), minor->index, minor, GFP_KERNEL); + if (xa_is_err(entry)) { + ret = xa_err(entry); + goto err_debugfs; } + WARN_ON(entry); DRM_DEBUG("new minor registered %d\n", minor->index); return 0; -#ifdef __linux__ err_debugfs: +#ifdef __linux__ drm_debugfs_cleanup(minor); - return ret; #endif + return ret; } static void drm_minor_unregister(struct drm_device *dev, enum drm_minor_type type) { struct drm_minor *minor; - unsigned long flags; minor = *drm_minor_get_slot(dev, type); #ifdef __linux__ @@ -290,13 +293,7 @@ static void drm_minor_unregister(struct drm_device *dev, enum drm_minor_type typ return; /* replace @minor with NULL so lookups will fail from now on */ - if (minor->type == DRM_MINOR_ACCEL) { - accel_minor_replace(NULL, minor->index); - } else { - spin_lock_irqsave(&drm_minor_lock, flags); - idr_replace(&drm_minors_idr, NULL, minor->index); - spin_unlock_irqrestore(&drm_minor_lock, flags); - } + xa_store(drm_minor_get_xa(type), minor->index, NULL, GFP_KERNEL); #ifdef __linux__ device_del(minor->kdev); @@ -314,16 +311,15 @@ static void drm_minor_unregister(struct drm_device *dev, enum drm_minor_type typ * minor->dev pointer will stay valid! However, the device may get unplugged and * unregistered while you hold the minor. */ -struct drm_minor *drm_minor_acquire(unsigned int minor_id) +struct drm_minor *drm_minor_acquire(struct xarray *minor_xa, unsigned int minor_id) { struct drm_minor *minor; - unsigned long flags; - spin_lock_irqsave(&drm_minor_lock, flags); - minor = idr_find(&drm_minors_idr, minor_id); + xa_lock(minor_xa); + minor = xa_load(minor_xa, minor_id); if (minor) drm_dev_get(minor->dev); - spin_unlock_irqrestore(&drm_minor_lock, flags); + xa_unlock(minor_xa); if (!minor) { return ERR_PTR(-ENODEV); @@ -1142,7 +1138,7 @@ static int drm_stub_open(struct inode *inode, struct file *filp) DRM_DEBUG("\n"); - minor = drm_minor_acquire(iminor(inode)); + minor = drm_minor_acquire(&drm_minors_xa, iminor(inode)); if (IS_ERR(minor)) return PTR_ERR(minor); @@ -1180,7 +1176,7 @@ static void drm_core_exit(void) debugfs_remove(drm_debugfs_root); drm_sysfs_destroy(); #endif - idr_destroy(&drm_minors_idr); + WARN_ON(!xa_empty(&drm_minors_xa)); drm_connector_ida_destroy(); } @@ -1191,7 +1187,6 @@ static int __init drm_core_init(void) #endif drm_connector_ida_init(); - idr_init(&drm_minors_idr); drm_memcpy_init_early(); #ifdef __linux__ diff --git a/sys/dev/pci/drm/drm_file.c b/sys/dev/pci/drm/drm_file.c index a4f3e5c81..d160a129f 100644 --- a/sys/dev/pci/drm/drm_file.c +++ b/sys/dev/pci/drm/drm_file.c @@ -426,7 +426,7 @@ int drm_open(struct inode *inode, struct file *filp) int retcode; int need_setup = 0; - minor = drm_minor_acquire(iminor(inode)); + minor = drm_minor_acquire(&drm_minors_xa, iminor(inode)); if (IS_ERR(minor)) return PTR_ERR(minor); diff --git a/sys/dev/pci/drm/drm_internal.h b/sys/dev/pci/drm/drm_internal.h index 584cc7fed..e0db753bb 100644 --- a/sys/dev/pci/drm/drm_internal.h +++ b/sys/dev/pci/drm/drm_internal.h @@ -77,10 +77,6 @@ void drm_prime_destroy_file_private(struct drm_prime_file_private *prime_fpriv); void drm_prime_remove_buf_handle(struct drm_prime_file_private *prime_fpriv, uint32_t handle); -/* drm_drv.c */ -struct drm_minor *drm_minor_acquire(unsigned int minor_id); -void drm_minor_release(struct drm_minor *minor); - /* drm_managed.c */ void drm_managed_release(struct drm_device *dev); void drmm_add_final_kfree(struct drm_device *dev, void *container); diff --git a/sys/dev/pci/drm/include/drm/drm_accel.h b/sys/dev/pci/drm/include/drm/drm_accel.h index 581ede217..0d05ed91b 100644 --- a/sys/dev/pci/drm/include/drm/drm_accel.h +++ b/sys/dev/pci/drm/include/drm/drm_accel.h @@ -5,6 +5,8 @@ #include +#define ACCEL_MAX_MINORS 256 + static inline int accel_minor_alloc(void) { diff --git a/sys/dev/pci/drm/include/drm/drm_file.h b/sys/dev/pci/drm/include/drm/drm_file.h index 6e966a8e8..50ed4cf44 100644 --- a/sys/dev/pci/drm/include/drm/drm_file.h +++ b/sys/dev/pci/drm/include/drm/drm_file.h @@ -48,6 +48,8 @@ struct device; struct file; struct seq_file; +extern struct xarray drm_minors_xa; + /* * FIXME: Not sure we want to have drm_minor here in the end, but to avoid * header include loops we need it here for now. @@ -449,6 +451,9 @@ static inline bool drm_is_accel_client(const struct drm_file *file_priv) void drm_file_update_pid(struct drm_file *); +struct drm_minor *drm_minor_acquire(struct xarray *minors_xa, unsigned int minor_id); +void drm_minor_release(struct drm_minor *minor); + #ifdef __linux__ int drm_open(struct inode *inode, struct file *filp); int drm_open_helper(struct file *filp, struct drm_minor *minor); diff --git a/sys/dev/pci/drm/include/linux/fs.h b/sys/dev/pci/drm/include/linux/fs.h index b2a54b816..528dd8716 100644 --- a/sys/dev/pci/drm/include/linux/fs.h +++ b/sys/dev/pci/drm/include/linux/fs.h @@ -23,5 +23,6 @@ struct file_operations { }; #define DEFINE_SIMPLE_ATTRIBUTE(a, b, c, d) +#define MINORBITS 8 #endif diff --git a/sys/dev/pci/drm/include/linux/xarray.h b/sys/dev/pci/drm/include/linux/xarray.h index fd643058f..a48a295a8 100644 --- a/sys/dev/pci/drm/include/linux/xarray.h +++ b/sys/dev/pci/drm/include/linux/xarray.h @@ -29,6 +29,13 @@ struct xarray { SPLAY_HEAD(xarray_tree, xarray_entry) xa_tree; }; +#define DEFINE_XARRAY_ALLOC(name) \ + struct xarray name = { \ + .xa_flags = XA_FLAGS_ALLOC, \ + .xa_lock = MUTEX_INITIALIZER(IPL_NONE), \ + .xa_tree = SPLAY_INITIALIZER(&name.xa_tree) \ + } + struct xarray_range { uint32_t start; uint32_t end; diff --git a/sys/dev/pv/if_vio.c b/sys/dev/pv/if_vio.c index 9b6a5452d..06ad4b8fd 100644 --- a/sys/dev/pv/if_vio.c +++ b/sys/dev/pv/if_vio.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_vio.c,v 1.56 2024/09/19 06:23:38 sf Exp $ */ +/* $OpenBSD: if_vio.c,v 1.57 2024/10/03 08:59:49 sf Exp $ */ /* * Copyright (c) 2012 Stefan Fritsch, Alexander Fiveg. @@ -256,6 +256,7 @@ struct vio_softc { struct vio_queue *sc_q; uint16_t sc_nqueues; + int sc_rx_mbuf_size; enum vio_ctrl_state sc_ctrl_inuse; @@ -492,8 +493,9 @@ vio_alloc_mem(struct vio_softc *sc, int tx_max_segments) vioq->viq_txmbufs = vioq->viq_rxmbufs + rxqsize; for (i = 0; i < rxqsize; i++) { - r = bus_dmamap_create(vsc->sc_dmat, MAXMCLBYTES, - MAXMCLBYTES/PAGE_SIZE + 1, MCLBYTES, 0, + r = bus_dmamap_create(vsc->sc_dmat, + sc->sc_rx_mbuf_size + sc->sc_hdr_size, 2, + sc->sc_rx_mbuf_size, 0, BUS_DMA_NOWAIT|BUS_DMA_ALLOCNOW, &vioq->viq_rxdmamaps[i]); if (r != 0) @@ -644,10 +646,35 @@ vio_attach(struct device *parent, struct device *self, void *aux) } else { sc->sc_hdr_size = offsetof(struct virtio_net_hdr, num_buffers); } + + ifp->if_capabilities = 0; + ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; +#if NVLAN > 0 + ifp->if_capabilities |= IFCAP_VLAN_MTU; + ifp->if_capabilities |= IFCAP_VLAN_HWOFFLOAD; +#endif + if (virtio_has_feature(vsc, VIRTIO_NET_F_CSUM)) + ifp->if_capabilities |= IFCAP_CSUM_TCPv4|IFCAP_CSUM_UDPv4| + IFCAP_CSUM_TCPv6|IFCAP_CSUM_UDPv6; + if (virtio_has_feature(vsc, VIRTIO_NET_F_HOST_TSO4)) + ifp->if_capabilities |= IFCAP_TSOv4; + if (virtio_has_feature(vsc, VIRTIO_NET_F_HOST_TSO6)) + ifp->if_capabilities |= IFCAP_TSOv6; + + sc->sc_rx_mbuf_size = MCLBYTES; + if (virtio_has_feature(vsc, VIRTIO_NET_F_CTRL_GUEST_OFFLOADS) && + (virtio_has_feature(vsc, VIRTIO_NET_F_GUEST_TSO4) || + virtio_has_feature(vsc, VIRTIO_NET_F_GUEST_TSO6))) { + ifp->if_xflags |= IFXF_LRO; + ifp->if_capabilities |= IFCAP_LRO; + sc->sc_rx_mbuf_size = 4 * 1024; + } + if (virtio_has_feature(vsc, VIRTIO_NET_F_MRG_RXBUF)) ifp->if_hardmtu = MAXMCLBYTES; else - ifp->if_hardmtu = MCLBYTES - sc->sc_hdr_size - ETHER_HDR_LEN; + ifp->if_hardmtu = sc->sc_rx_mbuf_size - sc->sc_hdr_size - + ETHER_HDR_LEN; /* defrag for longer mbuf chains */ tx_max_segments = 16; @@ -699,28 +726,8 @@ vio_attach(struct device *parent, struct device *self, void *aux) strlcpy(ifp->if_xname, self->dv_xname, IFNAMSIZ); ifp->if_softc = sc; - ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; ifp->if_start = vio_start; ifp->if_ioctl = vio_ioctl; - ifp->if_capabilities = 0; -#if NVLAN > 0 - ifp->if_capabilities |= IFCAP_VLAN_MTU; - ifp->if_capabilities |= IFCAP_VLAN_HWOFFLOAD; -#endif - if (virtio_has_feature(vsc, VIRTIO_NET_F_CSUM)) - ifp->if_capabilities |= IFCAP_CSUM_TCPv4|IFCAP_CSUM_UDPv4| - IFCAP_CSUM_TCPv6|IFCAP_CSUM_UDPv6; - if (virtio_has_feature(vsc, VIRTIO_NET_F_HOST_TSO4)) - ifp->if_capabilities |= IFCAP_TSOv4; - if (virtio_has_feature(vsc, VIRTIO_NET_F_HOST_TSO6)) - ifp->if_capabilities |= IFCAP_TSOv6; - - if (virtio_has_feature(vsc, VIRTIO_NET_F_CTRL_GUEST_OFFLOADS) && - (virtio_has_feature(vsc, VIRTIO_NET_F_GUEST_TSO4) || - virtio_has_feature(vsc, VIRTIO_NET_F_GUEST_TSO6))) { - ifp->if_xflags |= IFXF_LRO; - ifp->if_capabilities |= IFCAP_LRO; - } ifq_init_maxlen(&ifp->if_snd, vsc->sc_vqs[1].vq_num - 1); ifmedia_init(&sc->sc_media, 0, vio_media_change, vio_media_status); @@ -808,7 +815,7 @@ vio_init(struct ifnet *ifp) struct vio_queue *vioq = &sc->sc_q[qidx]; if_rxr_init(&vioq->viq_rxring, - 2 * ((ifp->if_hardmtu / MCLBYTES) + 1), + 2 * ((ifp->if_hardmtu / sc->sc_rx_mbuf_size) + 1), vioq->viq_rxvq->vq_num); vio_populate_rx_mbufs(sc, vioq); } @@ -1102,7 +1109,7 @@ vio_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) break; case SIOCGIFRXR: r = if_rxr_ioctl((struct if_rxrinfo *)ifr->ifr_data, - NULL, MCLBYTES, &sc->sc_q[0].viq_rxring); + NULL, sc->sc_rx_mbuf_size, &sc->sc_q[0].viq_rxring); break; default: r = ether_ioctl(ifp, &sc->sc_ac, cmd, data); @@ -1127,7 +1134,7 @@ vio_add_rx_mbuf(struct vio_softc *sc, struct vio_queue *vioq, int i) struct mbuf *m; int r; - m = MCLGETL(NULL, M_DONTWAIT, MCLBYTES); + m = MCLGETL(NULL, M_DONTWAIT, sc->sc_rx_mbuf_size); if (m == NULL) return ENOBUFS; vioq->viq_rxmbufs[i] = m; @@ -1199,7 +1206,8 @@ vio_populate_rx_mbufs(struct vio_softc *sc, struct vio_queue *vioq) virtio_enqueue_p(vq, slot, vioq->viq_rxdmamaps[slot], 0, sc->sc_hdr_size, 0); virtio_enqueue_p(vq, slot, vioq->viq_rxdmamaps[slot], - sc->sc_hdr_size, MCLBYTES - sc->sc_hdr_size, 0); + sc->sc_hdr_size, + sc->sc_rx_mbuf_size - sc->sc_hdr_size, 0); } virtio_enqueue_commit(vsc, vq, slot, 0); done = 1; diff --git a/sys/kern/kern_resource.c b/sys/kern/kern_resource.c index 7a8f7271b..d2bc83a5a 100644 --- a/sys/kern/kern_resource.c +++ b/sys/kern/kern_resource.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_resource.c,v 1.88 2024/08/20 13:29:25 mvs Exp $ */ +/* $OpenBSD: kern_resource.c,v 1.90 2024/10/03 10:20:05 claudio Exp $ */ /* $NetBSD: kern_resource.c,v 1.38 1996/10/23 07:19:38 matthias Exp $ */ /*- @@ -555,9 +555,10 @@ dogetrusage(struct proc *p, int who, struct rusage *rup) } void -ruadd(struct rusage *ru, struct rusage *ru2) +ruadd(struct rusage *ru, const struct rusage *ru2) { - long *ip, *ip2; + long *ip; + const long *ip2; int i; timeradd(&ru->ru_utime, &ru2->ru_utime, &ru->ru_utime); @@ -577,19 +578,22 @@ void rucheck(void *arg) { struct rlimit rlim; + struct tusage tu = { 0 }; struct process *pr = arg; + struct proc *q; time_t runtime; KERNEL_ASSERT_LOCKED(); - SCHED_LOCK(); - runtime = pr->ps_tu.tu_runtime.tv_sec; - SCHED_UNLOCK(); - mtx_enter(&pr->ps_mtx); rlim = pr->ps_limit->pl_rlimit[RLIMIT_CPU]; + tuagg_sumup(&tu, &pr->ps_tu); + TAILQ_FOREACH(q, &pr->ps_threads, p_thr_link) + tuagg_sumup(&tu, &q->p_tu); mtx_leave(&pr->ps_mtx); + runtime = tu.tu_runtime.tv_sec; + if ((rlim_t)runtime >= rlim.rlim_cur) { if ((rlim_t)runtime >= rlim.rlim_max) { prsignal(pr, SIGKILL); diff --git a/sys/kern/kern_sig.c b/sys/kern/kern_sig.c index 359c4b516..ca4ecee5b 100644 --- a/sys/kern/kern_sig.c +++ b/sys/kern/kern_sig.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_sig.c,v 1.338 2024/08/10 09:18:09 jsg Exp $ */ +/* $OpenBSD: kern_sig.c,v 1.339 2024/10/01 08:28:34 claudio Exp $ */ /* $NetBSD: kern_sig.c,v 1.54 1996/04/22 01:38:32 christos Exp $ */ /* @@ -840,7 +840,9 @@ trapsignal(struct proc *p, int signum, u_long trapno, int code, SCHED_UNLOCK(); signum = pr->ps_xsig; - single_thread_clear(p, 0); + if ((p->p_flag & P_TRACESINGLE) == 0) + single_thread_clear(p, 0); + atomic_clearbits_int(&p->p_flag, P_TRACESINGLE); /* * If we are no longer being traced, or the parent @@ -1359,7 +1361,9 @@ cursig(struct proc *p, struct sigctx *sctx) atomic_clearbits_int(&pr->ps_siglist, mask); } - single_thread_clear(p, 0); + if ((p->p_flag & P_TRACESINGLE) == 0) + single_thread_clear(p, 0); + atomic_clearbits_int(&p->p_flag, P_TRACESINGLE); /* * If we are no longer being traced, or the parent diff --git a/sys/kern/kern_time.c b/sys/kern/kern_time.c index 7e60319f9..b84ce354c 100644 --- a/sys/kern/kern_time.c +++ b/sys/kern/kern_time.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_time.c,v 1.169 2024/07/26 19:16:31 guenther Exp $ */ +/* $OpenBSD: kern_time.c,v 1.170 2024/10/03 10:18:29 claudio Exp $ */ /* $NetBSD: kern_time.c,v 1.20 1996/02/18 11:57:06 fvdl Exp $ */ /* @@ -147,8 +147,10 @@ clock_gettime(struct proc *p, clockid_t clock_id, struct timespec *tp) q = tfind_user(__CLOCK_PTID(clock_id), p->p_p); if (q == NULL) error = ESRCH; - else - *tp = q->p_tu.tu_runtime; + else { + tuagg_get_proc(&tu, q); + *tp = tu.tu_runtime; + } KERNEL_UNLOCK(); } else error = EINVAL; diff --git a/sys/kern/sys_process.c b/sys/kern/sys_process.c index 9520d0ddc..8d9daeb11 100644 --- a/sys/kern/sys_process.c +++ b/sys/kern/sys_process.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sys_process.c,v 1.99 2024/09/30 12:32:26 claudio Exp $ */ +/* $OpenBSD: sys_process.c,v 1.100 2024/10/01 08:28:34 claudio Exp $ */ /* $NetBSD: sys_process.c,v 1.55 1996/05/15 06:17:47 tls Exp $ */ /*- @@ -441,6 +441,13 @@ ptrace_ctrl(struct proc *p, int req, pid_t pid, caddr_t addr, int data) if (pid < THREAD_PID_OFFSET && tr->ps_single) t = tr->ps_single; + else if (t == tr->ps_single) + atomic_setbits_int(&t->p_flag, P_TRACESINGLE); + else { + error = EINVAL; + goto fail; + } + /* If the address parameter is not (int *)1, set the pc. */ if ((int *)addr != (int *)1) diff --git a/sys/sys/proc.h b/sys/sys/proc.h index 1312d33b5..17d9c2db7 100644 --- a/sys/sys/proc.h +++ b/sys/sys/proc.h @@ -1,4 +1,4 @@ -/* $OpenBSD: proc.h,v 1.371 2024/09/01 03:09:00 jsg Exp $ */ +/* $OpenBSD: proc.h,v 1.372 2024/10/01 08:28:34 claudio Exp $ */ /* $NetBSD: proc.h,v 1.44 1996/04/22 01:23:21 christos Exp $ */ /*- @@ -436,6 +436,7 @@ struct proc { #define P_SINTR 0x00000080 /* Sleep is interruptible. */ #define P_SYSTEM 0x00000200 /* No sigs, stats or swapping. */ #define P_TIMEOUT 0x00000400 /* Timing out during sleep. */ +#define P_TRACESINGLE 0x00001000 /* Ptrace: keep single threaded. */ #define P_WEXIT 0x00002000 /* Working on exiting. */ #define P_OWEUPC 0x00008000 /* Owe proc an addupc() at next ast. */ #define P_SUSPSINGLE 0x00080000 /* Need to stop for single threading. */ @@ -446,8 +447,8 @@ struct proc { #define P_BITS \ ("\20" "\01INKTR" "\02PROFPEND" "\03ALRMPEND" "\04SIGSUSPEND" \ "\05CANTSLEEP" "\06WSLEEP" "\010SINTR" "\012SYSTEM" "\013TIMEOUT" \ - "\016WEXIT" "\020OWEUPC" "\024SUSPSINGLE" "\033THREAD" \ - "\034SUSPSIG" "\037CPUPEG") + "\015TRACESINGLE" "\016WEXIT" "\020OWEUPC" "\024SUSPSINGLE" \ + "\033THREAD" "\034SUSPSIG" "\037CPUPEG") #define THREAD_PID_OFFSET 100000 diff --git a/sys/sys/resourcevar.h b/sys/sys/resourcevar.h index e850d76e1..06a00b27f 100644 --- a/sys/sys/resourcevar.h +++ b/sys/sys/resourcevar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: resourcevar.h,v 1.32 2024/07/08 13:17:12 claudio Exp $ */ +/* $OpenBSD: resourcevar.h,v 1.33 2024/10/01 09:22:25 claudio Exp $ */ /* $NetBSD: resourcevar.h,v 1.12 1995/11/22 23:01:53 cgd Exp $ */ /* @@ -107,7 +107,7 @@ lim_cur(int which) rlim_t lim_cur_proc(struct proc *, int); -void ruadd(struct rusage *, struct rusage *); +void ruadd(struct rusage *, const struct rusage *); void rucheck(void *); #endif diff --git a/sys/uvm/uvm_pdaemon.c b/sys/uvm/uvm_pdaemon.c index 52c4ddd00..2fa388ed8 100644 --- a/sys/uvm/uvm_pdaemon.c +++ b/sys/uvm/uvm_pdaemon.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uvm_pdaemon.c,v 1.115 2024/09/30 08:09:39 mpi Exp $ */ +/* $OpenBSD: uvm_pdaemon.c,v 1.117 2024/10/02 10:36:33 mpi Exp $ */ /* $NetBSD: uvm_pdaemon.c,v 1.23 2000/08/20 10:24:14 bjh21 Exp $ */ /* @@ -103,8 +103,8 @@ extern unsigned long drmbackoff(long); struct rwlock *uvmpd_trylockowner(struct vm_page *); void uvmpd_scan(struct uvm_pmalloc *, struct uvm_constraint_range *); -void uvmpd_scan_inactive(struct uvm_pmalloc *, - struct uvm_constraint_range *, struct pglist *); +int uvmpd_scan_inactive(struct uvm_pmalloc *, + struct uvm_constraint_range *); void uvmpd_tune(void); void uvmpd_drop(struct pglist *); int uvmpd_dropswap(struct vm_page *); @@ -418,11 +418,12 @@ uvmpd_dropswap(struct vm_page *pg) * => we handle the building of swap-backed clusters * => we return TRUE if we are exiting because we met our target */ -void +int uvmpd_scan_inactive(struct uvm_pmalloc *pma, - struct uvm_constraint_range *constraint, struct pglist *pglst) + struct uvm_constraint_range *constraint) { - int free, result; + struct pglist *pglst = &uvm.page_inactive; + int free, result, freed = 0; struct vm_page *p, *nextpg; struct uvm_object *uobj; struct vm_page *pps[SWCLUSTPAGES], **ppsp; @@ -468,7 +469,7 @@ uvmpd_scan_inactive(struct uvm_pmalloc *pma, */ free = uvmexp.free - BUFPAGES_DEFICIT; if (((pma == NULL || (pma->pm_flags & UVM_PMA_FREED)) && - (free + uvmexp.paging >= uvmexp.freetarg << 2)) || + (free + uvmexp.paging >= uvmexp.freetarg)) || dirtyreacts == UVMPD_NUMDIRTYREACTS) { if (swslot == 0) { /* exit now if no swap-i/o pending */ @@ -542,7 +543,7 @@ uvmpd_scan_inactive(struct uvm_pmalloc *pma, /* zap all mappings with pmap_page_protect... */ pmap_page_protect(p, PROT_NONE); uvm_pagefree(p); - uvmexp.pdfreed++; + freed++; if (anon) { @@ -565,7 +566,7 @@ uvmpd_scan_inactive(struct uvm_pmalloc *pma, * free target when all the current pageouts complete. */ if ((pma == NULL || (pma->pm_flags & UVM_PMA_FREED)) && - (free + uvmexp.paging > uvmexp.freetarg << 2)) { + (free + uvmexp.paging > uvmexp.freetarg)) { rw_exit(slock); continue; } @@ -846,6 +847,8 @@ uvmpd_scan_inactive(struct uvm_pmalloc *pma, uvm_lock_pageq(); } } + + return freed; } /* @@ -890,10 +893,8 @@ uvmpd_scan(struct uvm_pmalloc *pma, struct uvm_constraint_range *constraint) * we work on meeting our inactive target by converting active pages * to inactive ones. */ - - pages_freed = uvmexp.pdfreed; - (void) uvmpd_scan_inactive(pma, constraint, &uvm.page_inactive); - pages_freed = uvmexp.pdfreed - pages_freed; + pages_freed = uvmpd_scan_inactive(pma, constraint); + uvmexp.pdfreed += pages_freed; /* * we have done the scan to get free pages. now we work on meeting diff --git a/sys/uvm/uvm_pmemrange.c b/sys/uvm/uvm_pmemrange.c index 5bd5a07f6..c91392630 100644 --- a/sys/uvm/uvm_pmemrange.c +++ b/sys/uvm/uvm_pmemrange.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uvm_pmemrange.c,v 1.67 2024/08/18 08:18:49 mpi Exp $ */ +/* $OpenBSD: uvm_pmemrange.c,v 1.68 2024/10/02 10:17:28 mpi Exp $ */ /* * Copyright (c) 2024 Martin Pieuchot @@ -2279,7 +2279,7 @@ uvm_pmr_cache_get(int flags) return pg; } -void +unsigned int uvm_pmr_cache_free(struct uvm_pmr_cache_item *upci) { struct pglist pgl; @@ -2296,6 +2296,8 @@ uvm_pmr_cache_free(struct uvm_pmr_cache_item *upci) atomic_sub_int(&uvmexp.percpucaches, upci->upci_npages); upci->upci_npages = 0; memset(upci->upci_pages, 0, sizeof(upci->upci_pages)); + + return i; } void @@ -2337,16 +2339,19 @@ uvm_pmr_cache_put(struct vm_page *pg) splx(s); } -void +unsigned int uvm_pmr_cache_drain(void) { struct uvm_pmr_cache *upc = &curcpu()->ci_uvm; + unsigned int freed = 0; int s; s = splvm(); - uvm_pmr_cache_free(&upc->upc_magz[0]); - uvm_pmr_cache_free(&upc->upc_magz[1]); + freed += uvm_pmr_cache_free(&upc->upc_magz[0]); + freed += uvm_pmr_cache_free(&upc->upc_magz[1]); splx(s); + + return freed; } #else /* !(MULTIPROCESSOR && __HAVE_UVM_PERCPU) */ @@ -2363,8 +2368,9 @@ uvm_pmr_cache_put(struct vm_page *pg) uvm_pmr_freepages(pg, 1); } -void +unsigned int uvm_pmr_cache_drain(void) { + return 0; } #endif diff --git a/sys/uvm/uvm_pmemrange.h b/sys/uvm/uvm_pmemrange.h index 45912df96..3a06d60c4 100644 --- a/sys/uvm/uvm_pmemrange.h +++ b/sys/uvm/uvm_pmemrange.h @@ -1,4 +1,4 @@ -/* $OpenBSD: uvm_pmemrange.h,v 1.17 2024/05/01 12:54:27 mpi Exp $ */ +/* $OpenBSD: uvm_pmemrange.h,v 1.18 2024/10/02 10:17:28 mpi Exp $ */ /* * Copyright (c) 2009 Ariane van der Steldt @@ -149,7 +149,7 @@ struct vm_page *uvm_pmr_extract_range(struct uvm_pmemrange *, struct pglist *); struct vm_page *uvm_pmr_cache_get(int); void uvm_pmr_cache_put(struct vm_page *); -void uvm_pmr_cache_drain(void); +unsigned int uvm_pmr_cache_drain(void); #endif /* _UVM_UVM_PMEMRANGE_H_ */ diff --git a/usr.bin/ctfconv/generate.c b/usr.bin/ctfconv/generate.c index 3306edcb6..e31a06ef9 100644 --- a/usr.bin/ctfconv/generate.c +++ b/usr.bin/ctfconv/generate.c @@ -1,4 +1,4 @@ -/* $OpenBSD: generate.c,v 1.7 2024/02/27 06:58:19 anton Exp $ */ +/* $OpenBSD: generate.c,v 1.8 2024/10/02 12:31:33 claudio Exp $ */ /* * Copyright (c) 2017 Martin Pieuchot @@ -208,6 +208,8 @@ imcs_add_type(struct imcs *imcs, struct itype *it) ctt.ctt_size = 4; else if (size <= 64) ctt.ctt_size = 8; + else if (size <= 96) + ctt.ctt_size = 12; else ctt.ctt_size = 16; } else diff --git a/usr.bin/tmux/cmd-send-keys.c b/usr.bin/tmux/cmd-send-keys.c index b49fd82dd..8ea5d92ba 100644 --- a/usr.bin/tmux/cmd-send-keys.c +++ b/usr.bin/tmux/cmd-send-keys.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-send-keys.c,v 1.75 2023/01/16 11:26:14 nicm Exp $ */ +/* $OpenBSD: cmd-send-keys.c,v 1.76 2024/10/01 06:15:47 nicm Exp $ */ /* * Copyright (c) 2008 Nicholas Marriott @@ -73,11 +73,13 @@ cmd_send_keys_inject_key(struct cmdq_item *item, struct cmdq_item *after, if (args_has(args, 'K')) { if (tc == NULL) return (item); - event = xmalloc(sizeof *event); + event = xcalloc(1, sizeof *event); event->key = key|KEYC_SENT; memset(&event->m, 0, sizeof event->m); - if (server_client_handle_key(tc, event) == 0) + if (server_client_handle_key(tc, event) == 0) { + free(event->buf); free(event); + } return (item); } diff --git a/usr.bin/tmux/input-keys.c b/usr.bin/tmux/input-keys.c index 42b5b235e..fc6cf7f82 100644 --- a/usr.bin/tmux/input-keys.c +++ b/usr.bin/tmux/input-keys.c @@ -1,4 +1,4 @@ -/* $OpenBSD: input-keys.c,v 1.98 2024/08/26 07:45:05 nicm Exp $ */ +/* $OpenBSD: input-keys.c,v 1.101 2024/10/03 05:41:59 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -499,9 +499,12 @@ input_key_vt10x(struct bufferevent *bev, key_code key) return (0); } - /* Prevent TAB and RET from being swallowed by C0 remapping logic. */ + /* + * Prevent TAB, CR and LF from being swallowed by the C0 remapping + * logic. + */ onlykey = key & KEYC_MASK_KEY; - if (onlykey == '\r' || onlykey == '\t') + if (onlykey == '\r' || onlykey == '\n' || onlykey == '\t') key &= ~KEYC_CTRL; /* diff --git a/usr.bin/tmux/mode-tree.c b/usr.bin/tmux/mode-tree.c index 41c220100..0bd42b324 100644 --- a/usr.bin/tmux/mode-tree.c +++ b/usr.bin/tmux/mode-tree.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mode-tree.c,v 1.69 2024/08/21 04:17:09 nicm Exp $ */ +/* $OpenBSD: mode-tree.c,v 1.70 2024/10/01 10:10:29 nicm Exp $ */ /* * Copyright (c) 2017 Nicholas Marriott @@ -30,6 +30,12 @@ enum mode_tree_search_dir { MODE_TREE_SEARCH_BACKWARD }; +enum mode_tree_preview { + MODE_TREE_PREVIEW_OFF, + MODE_TREE_PREVIEW_NORMAL, + MODE_TREE_PREVIEW_BIG +}; + struct mode_tree_item; TAILQ_HEAD(mode_tree_list, mode_tree_item); @@ -414,7 +420,12 @@ mode_tree_start(struct window_pane *wp, struct args *args, mtd->sort_list = sort_list; mtd->sort_size = sort_size; - mtd->preview = !args_has(args, 'N'); + if (args_has(args, 'N') > 1) + mtd->preview = MODE_TREE_PREVIEW_BIG; + else if (args_has(args, 'N')) + mtd->preview = MODE_TREE_PREVIEW_OFF; + else + mtd->preview = MODE_TREE_PREVIEW_NORMAL; sort = args_get(args, 'O'); if (sort != NULL) { @@ -470,12 +481,21 @@ mode_tree_set_height(struct mode_tree_data *mtd) if (height < screen_size_y(s)) mtd->height = screen_size_y(s) - height; } else { - mtd->height = (screen_size_y(s) / 3) * 2; - if (mtd->height > mtd->line_size) - mtd->height = screen_size_y(s) / 2; + if (mtd->preview == MODE_TREE_PREVIEW_NORMAL) { + mtd->height = (screen_size_y(s) / 3) * 2; + if (mtd->height > mtd->line_size) + mtd->height = screen_size_y(s) / 2; + if (mtd->height < 10) + mtd->height = screen_size_y(s); + } else if (mtd->preview == MODE_TREE_PREVIEW_BIG) { + mtd->height = screen_size_y(s) / 4; + if (mtd->height > mtd->line_size) + mtd->height = mtd->line_size; + if (mtd->height < 2) + mtd->height = 2; + } else + mtd->height = screen_size_y(s); } - if (mtd->height < 10) - mtd->height = screen_size_y(s); if (screen_size_y(s) - mtd->height < 2) mtd->height = screen_size_y(s); } @@ -510,7 +530,7 @@ mode_tree_build(struct mode_tree_data *mtd) mode_tree_set_current(mtd, tag); mtd->width = screen_size_x(s); - if (mtd->preview) + if (mtd->preview != MODE_TREE_PREVIEW_OFF) mode_tree_set_height(mtd); else mtd->height = screen_size_y(s); @@ -742,8 +762,11 @@ mode_tree_draw(struct mode_tree_data *mtd) } } + if (mtd->preview == MODE_TREE_PREVIEW_OFF) + goto done; + sy = screen_size_y(s); - if (!mtd->preview || sy <= 4 || h <= 4 || sy - h <= 4 || w <= 4) + if (sy <= 4 || h < 2 || sy - h <= 4 || w <= 4) goto done; line = &mtd->line_list[mtd->current]; @@ -1041,7 +1064,7 @@ mode_tree_key(struct mode_tree_data *mtd, struct client *c, key_code *key, if (x > mtd->width || y > mtd->height) { if (*key == KEYC_MOUSEDOWN3_PANE) mode_tree_display_menu(mtd, c, x, y, 1); - if (!mtd->preview) + if (mtd->preview == MODE_TREE_PREVIEW_OFF) *key = KEYC_NONE; return (0); } @@ -1232,9 +1255,19 @@ mode_tree_key(struct mode_tree_data *mtd, struct client *c, key_code *key, PROMPT_NOFORMAT, PROMPT_TYPE_SEARCH); break; case 'v': - mtd->preview = !mtd->preview; + switch (mtd->preview) { + case MODE_TREE_PREVIEW_OFF: + mtd->preview = MODE_TREE_PREVIEW_BIG; + break; + case MODE_TREE_PREVIEW_NORMAL: + mtd->preview = MODE_TREE_PREVIEW_OFF; + break; + case MODE_TREE_PREVIEW_BIG: + mtd->preview = MODE_TREE_PREVIEW_NORMAL; + break; + } mode_tree_build(mtd); - if (mtd->preview) + if (mtd->preview != MODE_TREE_PREVIEW_OFF) mode_tree_check_selected(mtd); break; } diff --git a/usr.bin/tmux/options-table.c b/usr.bin/tmux/options-table.c index 9ef6dedc7..72b28c5f0 100644 --- a/usr.bin/tmux/options-table.c +++ b/usr.bin/tmux/options-table.c @@ -1,4 +1,4 @@ -/* $OpenBSD: options-table.c,v 1.178 2024/09/16 20:28:22 nicm Exp $ */ +/* $OpenBSD: options-table.c,v 1.179 2024/10/02 11:51:15 nicm Exp $ */ /* * Copyright (c) 2011 Nicholas Marriott @@ -824,7 +824,7 @@ const struct options_table_entry options_table[] = { .type = OPTIONS_TABLE_STRING, .scope = OPTIONS_TABLE_SESSION, .flags = OPTIONS_TABLE_IS_ARRAY, - .default_str = "DISPLAY KRB5CCNAME SSH_ASKPASS SSH_AUTH_SOCK " + .default_str = "DISPLAY KRB5CCNAME MSYSTEM SSH_ASKPASS SSH_AUTH_SOCK " "SSH_AGENT_PID SSH_CONNECTION WINDOWID XAUTHORITY", .text = "List of environment variables to update in the session " "environment when a client is attached." diff --git a/usr.bin/tmux/screen.c b/usr.bin/tmux/screen.c index 182d6a894..e70edd5fd 100644 --- a/usr.bin/tmux/screen.c +++ b/usr.bin/tmux/screen.c @@ -1,4 +1,4 @@ -/* $OpenBSD: screen.c,v 1.86 2024/08/21 04:17:09 nicm Exp $ */ +/* $OpenBSD: screen.c,v 1.87 2024/10/01 08:01:19 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -170,6 +170,20 @@ screen_reset_tabs(struct screen *s) bit_set(s->tabs, i); } +/* Set default cursor style and colour from options. */ +void +screen_set_default_cursor(struct screen *s, struct options *oo) +{ + int c; + + c = options_get_number(oo, "cursor-colour"); + s->default_ccolour = c; + + c = options_get_number(oo, "cursor-style"); + s->default_mode = 0; + screen_set_cursor_style(c, &s->default_cstyle, &s->default_mode); +} + /* Set screen cursor style and mode. */ void screen_set_cursor_style(u_int style, enum screen_cursor_style *cstyle, diff --git a/usr.bin/tmux/server-client.c b/usr.bin/tmux/server-client.c index b929c2002..6e63416e9 100644 --- a/usr.bin/tmux/server-client.c +++ b/usr.bin/tmux/server-client.c @@ -1,4 +1,4 @@ -/* $OpenBSD: server-client.c,v 1.409 2024/09/16 20:28:22 nicm Exp $ */ +/* $OpenBSD: server-client.c,v 1.410 2024/10/01 06:15:47 nicm Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott @@ -46,8 +46,6 @@ static void server_client_check_modes(struct client *); static void server_client_set_title(struct client *); static void server_client_set_path(struct client *); static void server_client_reset_state(struct client *); -static int server_client_is_bracket_pasting(struct client *, key_code); -static int server_client_assume_paste(struct session *); static void server_client_update_latest(struct client *); static void server_client_dispatch(struct imsg *, void *); @@ -1801,18 +1799,18 @@ out: /* Is this a bracket paste key? */ static int -server_client_is_bracket_pasting(struct client *c, key_code key) +server_client_is_bracket_paste(struct client *c, key_code key) { if (key == KEYC_PASTE_START) { c->flags |= CLIENT_BRACKETPASTING; log_debug("%s: bracket paste on", c->name); - return (1); + return (0); } if (key == KEYC_PASTE_END) { - c->flags &= ~CLIENT_BRACKETPASTING; + c->flags &= ~CLIENT_BRACKETPASTING; log_debug("%s: bracket paste off", c->name); - return (1); + return (0); } return !!(c->flags & CLIENT_BRACKETPASTING); @@ -1820,25 +1818,29 @@ server_client_is_bracket_pasting(struct client *c, key_code key) /* Is this fast enough to probably be a paste? */ static int -server_client_assume_paste(struct session *s) +server_client_is_assume_paste(struct client *c) { - struct timeval tv; - int t; + struct session *s = c->session; + struct timeval tv; + int t; + if (c->flags & CLIENT_BRACKETPASTING) + return (0); if ((t = options_get_number(s->options, "assume-paste-time")) == 0) return (0); - timersub(&s->activity_time, &s->last_activity_time, &tv); + timersub(&c->activity_time, &c->last_activity_time, &tv); if (tv.tv_sec == 0 && tv.tv_usec < t * 1000) { - log_debug("session %s pasting (flag %d)", s->name, - !!(s->flags & SESSION_PASTING)); - if (s->flags & SESSION_PASTING) + if (c->flags & CLIENT_ASSUMEPASTING) return (1); - s->flags |= SESSION_PASTING; + c->flags |= CLIENT_ASSUMEPASTING; + log_debug("%s: assume paste on", c->name); return (0); } - log_debug("session %s not pasting", s->name); - s->flags &= ~SESSION_PASTING; + if (c->flags & CLIENT_ASSUMEPASTING) { + c->flags &= ~CLIENT_ASSUMEPASTING; + log_debug("%s: assume paste off", c->name); + } return (0); } @@ -1891,6 +1893,8 @@ server_client_key_callback(struct cmdq_item *item, void *data) wl = s->curw; /* Update the activity timer. */ + memcpy(&c->last_activity_time, &c->activity_time, + sizeof c->last_activity_time); if (gettimeofday(&c->activity_time, NULL) != 0) fatal("gettimeofday failed"); session_update_activity(s, &c->activity_time); @@ -1928,14 +1932,16 @@ server_client_key_callback(struct cmdq_item *item, void *data) goto forward_key; /* Forward if bracket pasting. */ - if (server_client_is_bracket_pasting(c, key)) - goto forward_key; + if (server_client_is_bracket_paste (c, key)) + goto paste_key; /* Treat everything as a regular key when pasting is detected. */ if (!KEYC_IS_MOUSE(key) && + key != KEYC_FOCUS_IN && + key != KEYC_FOCUS_OUT && (~key & KEYC_SENT) && - server_client_assume_paste(s)) - goto forward_key; + server_client_is_assume_paste(c)) + goto paste_key; /* * Work out the current key table. If the pane is in a mode, use @@ -2104,10 +2110,20 @@ forward_key: goto out; if (wp != NULL) window_pane_key(wp, c, s, wl, key, m); + goto out; + +paste_key: + if (c->flags & CLIENT_READONLY) + goto out; + if (event->buf != NULL) + window_pane_paste(wp, event->buf, event->len); + key = KEYC_NONE; + goto out; out: if (s != NULL && key != KEYC_FOCUS_OUT) server_client_update_latest(c); + free(event->buf); free(event); return (CMD_RETURN_NORMAL); } @@ -2521,11 +2537,13 @@ server_client_click_timer(__unused int fd, __unused short events, void *data) * Waiting for a third click that hasn't happened, so this must * have been a double click. */ - event = xmalloc(sizeof *event); + event = xcalloc(1, sizeof *event); event->key = KEYC_DOUBLECLICK; memcpy(&event->m, &c->click_event, sizeof event->m); - if (!server_client_handle_key(c, event)) + if (!server_client_handle_key(c, event)) { + free(event->buf); free(event); + } } c->flags &= ~(CLIENT_DOUBLECLICK|CLIENT_TRIPLECLICK); } diff --git a/usr.bin/tmux/session.c b/usr.bin/tmux/session.c index 548d11c83..7777b4843 100644 --- a/usr.bin/tmux/session.c +++ b/usr.bin/tmux/session.c @@ -1,4 +1,4 @@ -/* $OpenBSD: session.c,v 1.96 2023/09/02 08:38:37 nicm Exp $ */ +/* $OpenBSD: session.c,v 1.97 2024/10/01 06:15:47 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -272,19 +272,16 @@ session_lock_timer(__unused int fd, __unused short events, void *arg) void session_update_activity(struct session *s, struct timeval *from) { - struct timeval *last = &s->last_activity_time; struct timeval tv; - memcpy(last, &s->activity_time, sizeof *last); if (from == NULL) gettimeofday(&s->activity_time, NULL); else memcpy(&s->activity_time, from, sizeof s->activity_time); - log_debug("session $%u %s activity %lld.%06d (last %lld.%06d)", s->id, + log_debug("session $%u %s activity %lld.%06d", s->id, s->name, (long long)s->activity_time.tv_sec, - (int)s->activity_time.tv_usec, (long long)last->tv_sec, - (int)last->tv_usec); + (int)s->activity_time.tv_usec); if (evtimer_initialized(&s->lock_timer)) evtimer_del(&s->lock_timer); diff --git a/usr.bin/tmux/tmux.1 b/usr.bin/tmux/tmux.1 index 246df394e..418621a9f 100644 --- a/usr.bin/tmux/tmux.1 +++ b/usr.bin/tmux/tmux.1 @@ -1,4 +1,4 @@ -.\" $OpenBSD: tmux.1,v 1.957 2024/09/16 20:46:58 nicm Exp $ +.\" $OpenBSD: tmux.1,v 1.958 2024/10/01 10:10:29 nicm Exp $ .\" .\" Copyright (c) 2007 Nicholas Marriott .\" @@ -14,7 +14,7 @@ .\" IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING .\" OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" -.Dd $Mdocdate: September 16 2024 $ +.Dd $Mdocdate: October 1 2024 $ .Dt TMUX 1 .Os .Sh NAME @@ -2627,7 +2627,7 @@ specifies the format for each item in the list and .Fl K a format for each shortcut key; both are evaluated once for each line. .Fl N -starts without the preview. +starts without the preview or if given twice with the larger preview. This command works only if at least one client is attached. .It Xo .Ic choose-tree @@ -2711,7 +2711,7 @@ specifies the format for each item in the tree and .Fl K a format for each shortcut key; both are evaluated once for each line. .Fl N -starts without the preview. +starts without the preview or if given twice with the larger preview. .Fl G includes all sessions in any session groups in the tree rather than only the first. diff --git a/usr.bin/tmux/tmux.c b/usr.bin/tmux/tmux.c index 7092f06d4..93d81e75d 100644 --- a/usr.bin/tmux/tmux.c +++ b/usr.bin/tmux/tmux.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tmux.c,v 1.213 2024/09/29 20:05:42 nicm Exp $ */ +/* $OpenBSD: tmux.c,v 1.214 2024/10/02 11:48:16 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -226,7 +226,7 @@ make_label(const char *label, char **cause) xasprintf(cause, "%s is not a directory", base); goto fail; } - if (sb.st_uid != uid || (sb.st_mode & S_IRWXO) != 0) { + if (sb.st_uid != uid || (sb.st_mode & TMUX_SOCK_PERM) != 0) { xasprintf(cause, "directory %s has unsafe permissions", base); goto fail; } diff --git a/usr.bin/tmux/tmux.h b/usr.bin/tmux/tmux.h index 606c23cfe..e904e8e80 100644 --- a/usr.bin/tmux/tmux.h +++ b/usr.bin/tmux/tmux.h @@ -1,4 +1,4 @@ -/* $OpenBSD: tmux.h,v 1.1229 2024/09/30 08:10:20 nicm Exp $ */ +/* $OpenBSD: tmux.h,v 1.1232 2024/10/02 11:48:16 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -78,6 +78,9 @@ struct winlink; #ifndef TMUX_SOCK #define TMUX_SOCK "$TMUX_TMPDIR:" _PATH_TMP #endif +#ifndef TMUX_SOCK_PERM +#define TMUX_SOCK_PERM (7 /* o+rwx */) +#endif #ifndef TMUX_TERM #define TMUX_TERM "screen" #endif @@ -1311,8 +1314,7 @@ struct session { struct options *options; -#define SESSION_PASTING 0x1 -#define SESSION_ALERTED 0x2 +#define SESSION_ALERTED 0x1 int flags; u_int attached; @@ -1390,8 +1392,11 @@ struct mouse_event { /* Key event. */ struct key_event { - key_code key; - struct mouse_event m; + key_code key; + struct mouse_event m; + + char *buf; + size_t len; }; /* Terminal definition. */ @@ -1806,6 +1811,7 @@ struct client { struct timeval creation_time; struct timeval activity_time; + struct timeval last_activity_time; struct environ *environ; struct format_job_tree *jobs; @@ -1872,6 +1878,7 @@ struct client { #define CLIENT_WINDOWSIZECHANGED 0x400000000ULL #define CLIENT_CLIPBOARDBUFFER 0x800000000ULL #define CLIENT_BRACKETPASTING 0x1000000000ULL +#define CLIENT_ASSUMEPASTING 0x2000000000ULL #define CLIENT_ALLREDRAWFLAGS \ (CLIENT_REDRAWWINDOW| \ CLIENT_REDRAWSTATUS| \ @@ -3010,6 +3017,7 @@ void screen_reinit(struct screen *); void screen_free(struct screen *); void screen_reset_tabs(struct screen *); void screen_reset_hyperlinks(struct screen *); +void screen_set_default_cursor(struct screen *, struct options *); void screen_set_cursor_style(u_int, enum screen_cursor_style *, int *); void screen_set_cursor_colour(struct screen *, int); int screen_set_title(struct screen *, const char *); @@ -3097,6 +3105,7 @@ void window_pane_reset_mode_all(struct window_pane *); int window_pane_key(struct window_pane *, struct client *, struct session *, struct winlink *, key_code, struct mouse_event *); +void window_pane_paste(struct window_pane *, char *, size_t); int window_pane_visible(struct window_pane *); int window_pane_exited(struct window_pane *); u_int window_pane_search(struct window_pane *, const char *, int, diff --git a/usr.bin/tmux/tty-keys.c b/usr.bin/tmux/tty-keys.c index 5109b880d..d95ded393 100644 --- a/usr.bin/tmux/tty-keys.c +++ b/usr.bin/tmux/tty-keys.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tty-keys.c,v 1.179 2024/09/30 08:10:20 nicm Exp $ */ +/* $OpenBSD: tty-keys.c,v 1.181 2024/10/03 05:41:59 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -944,9 +944,6 @@ complete_key: if (bspace != _POSIX_VDISABLE && (key & KEYC_MASK_KEY) == bspace) key = (key & KEYC_MASK_MODIFIERS)|KEYC_BSPACE; - /* Remove data from buffer. */ - evbuffer_drain(tty->in, size); - /* Remove key timer. */ if (event_initialized(&tty->key_timer)) evtimer_del(&tty->key_timer); @@ -965,13 +962,23 @@ complete_key: /* Fire the key. */ if (key != KEYC_UNKNOWN) { - event = xmalloc(sizeof *event); + event = xcalloc(1, sizeof *event); event->key = key; memcpy(&event->m, &m, sizeof event->m); - if (!server_client_handle_key(c, event)) + + event->buf = xmalloc(size); + event->len = size; + memcpy (event->buf, buf, event->len); + + if (!server_client_handle_key(c, event)) { + free(event->buf); free(event); + } } + /* Remove data from buffer. */ + evbuffer_drain(tty->in, size); + return (1); discard_key: @@ -1009,7 +1016,7 @@ tty_keys_extended_key(struct tty *tty, const char *buf, size_t len, u_int number, modifiers; char tmp[64]; cc_t bspace; - key_code nkey; + key_code nkey, onlykey; struct utf8_data ud; utf8_char uc; @@ -1073,13 +1080,7 @@ tty_keys_extended_key(struct tty *tty, const char *buf, size_t len, /* Update the modifiers. */ if (modifiers > 0) { modifiers--; - /* - * The Shift modifier may not be reported in some input modes, - * which is unfortunate, as in general case determining if a - * character is shifted or not requires knowing the input - * keyboard layout. So we only fix up the trivial case. - */ - if (modifiers & 1 || (nkey >= 'A' && nkey <= 'Z')) + if (modifiers & 1) nkey |= KEYC_SHIFT; if (modifiers & 2) nkey |= (KEYC_META|KEYC_IMPLIED_META); /* Alt */ @@ -1093,6 +1094,26 @@ tty_keys_extended_key(struct tty *tty, const char *buf, size_t len, if ((nkey & KEYC_MASK_KEY) == '\011' && (nkey & KEYC_SHIFT)) nkey = KEYC_BTAB | (nkey & ~KEYC_MASK_KEY & ~KEYC_SHIFT); + /* + * Deal with the Shift modifier when present alone. The problem is that + * in mode 2 some terminals would report shifted keys, like S-a, as + * just A, and some as S-A. + * + * Because we need an unambiguous internal representation, and because + * restoring the Shift modifier when it's missing would require knowing + * the keyboard layout, and because S-A would cause a lot of issues + * downstream, we choose to lose the Shift for all printable + * characters. + * + * That still leaves some ambiguity, such as C-S-A vs. C-A, but that's + * OK, and applications can handle that. + */ + onlykey = nkey & KEYC_MASK_KEY; + if (((onlykey > 0x20 && onlykey < 0x7f) || + KEYC_IS_UNICODE(nkey)) && + (nkey & KEYC_MASK_MODIFIERS) == KEYC_SHIFT) + nkey &= ~KEYC_SHIFT; + if (log_get_level() != 0) { log_debug("%s: extended key %.*s is %llx (%s)", c->name, (int)*size, buf, nkey, key_string_lookup_key(nkey, 1)); diff --git a/usr.bin/tmux/window-copy.c b/usr.bin/tmux/window-copy.c index eb830948d..1e45db593 100644 --- a/usr.bin/tmux/window-copy.c +++ b/usr.bin/tmux/window-copy.c @@ -1,4 +1,4 @@ -/* $OpenBSD: window-copy.c,v 1.353 2024/08/27 07:49:07 nicm Exp $ */ +/* $OpenBSD: window-copy.c,v 1.354 2024/10/01 08:01:19 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -417,6 +417,7 @@ window_copy_common_init(struct window_mode_entry *wme) data->jumpchar = NULL; screen_init(&data->screen, screen_size_x(base), screen_size_y(base), 0); + screen_set_default_cursor(&data->screen, global_w_options); data->modekeys = options_get_number(wp->window->options, "mode-keys"); evtimer_set(&data->dragtimer, window_copy_scroll_timer, wme); diff --git a/usr.bin/tmux/window.c b/usr.bin/tmux/window.c index 1a085966a..2c92c4f86 100644 --- a/usr.bin/tmux/window.c +++ b/usr.bin/tmux/window.c @@ -1,4 +1,4 @@ -/* $OpenBSD: window.c,v 1.292 2024/08/26 07:14:40 nicm Exp $ */ +/* $OpenBSD: window.c,v 1.294 2024/10/01 08:01:19 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -1154,6 +1154,24 @@ window_pane_reset_mode_all(struct window_pane *wp) window_pane_reset_mode(wp); } +static void +window_pane_copy_paste(struct window_pane *wp, char *buf, size_t len) +{ + struct window_pane *loop; + + TAILQ_FOREACH(loop, &wp->window->panes, entry) { + if (loop != wp && + TAILQ_EMPTY(&loop->modes) && + loop->fd != -1 && + (~loop->flags & PANE_INPUTOFF) && + window_pane_visible(loop) && + options_get_number(loop->options, "synchronize-panes")) { + log_debug("%s: %.*s", __func__, (int)len, buf); + bufferevent_write(loop->event, buf, len); + } + } +} + static void window_pane_copy_key(struct window_pane *wp, key_code key) { @@ -1170,6 +1188,22 @@ window_pane_copy_key(struct window_pane *wp, key_code key) } } +void +window_pane_paste(struct window_pane *wp, char *buf, size_t len) +{ + if (!TAILQ_EMPTY(&wp->modes)) + return; + + if (wp->fd == -1 || wp->flags & PANE_INPUTOFF) + return; + + log_debug("%s: %.*s", __func__, (int)len, buf); + bufferevent_write(wp->event, buf, len); + + if (options_get_number(wp->options, "synchronize-panes")) + window_pane_copy_paste(wp, buf, len); +} + int window_pane_key(struct window_pane *wp, struct client *c, struct session *s, struct winlink *wl, key_code key, struct mouse_event *m) @@ -1652,15 +1686,7 @@ window_set_fill_character(struct window *w) void window_pane_default_cursor(struct window_pane *wp) { - struct screen *s = wp->screen; - int c; - - c = options_get_number(wp->options, "cursor-colour"); - s->default_ccolour = c; - - c = options_get_number(wp->options, "cursor-style"); - s->default_mode = 0; - screen_set_cursor_style(c, &s->default_cstyle, &s->default_mode); + screen_set_default_cursor(wp->screen, wp->options); } int diff --git a/usr.sbin/bgpctl/output.c b/usr.sbin/bgpctl/output.c index de0e56fe2..24793e125 100644 --- a/usr.sbin/bgpctl/output.c +++ b/usr.sbin/bgpctl/output.c @@ -1,4 +1,4 @@ -/* $OpenBSD: output.c,v 1.54 2024/08/20 12:00:20 claudio Exp $ */ +/* $OpenBSD: output.c,v 1.56 2024/10/01 18:33:16 claudio Exp $ */ /* * Copyright (c) 2003 Henning Brauer @@ -302,7 +302,7 @@ show_neighbor_full(struct peer *p, struct parse_result *res) ina.s_addr = htonl(p->remote_bgpid); printf(" BGP version 4, remote router-id %s", inet_ntoa(ina)); - printf("%s\n", fmt_auth_method(p->auth.method)); + printf("%s\n", fmt_auth_method(p->auth_conf.method)); } printf(" BGP state = %s", statenames[p->state]); if (p->conf.down) { diff --git a/usr.sbin/bgpctl/output_json.c b/usr.sbin/bgpctl/output_json.c index 8a2e26ccf..0f51749cb 100644 --- a/usr.sbin/bgpctl/output_json.c +++ b/usr.sbin/bgpctl/output_json.c @@ -1,4 +1,4 @@ -/* $OpenBSD: output_json.c,v 1.46 2024/08/14 19:10:51 claudio Exp $ */ +/* $OpenBSD: output_json.c,v 1.48 2024/10/01 18:33:16 claudio Exp $ */ /* * Copyright (c) 2020 Claudio Jeker @@ -240,9 +240,9 @@ json_neighbor_full(struct peer *p) json_do_uint("max_out_prefix_restart", p->conf.max_out_prefix_restart); } - if (p->auth.method != AUTH_NONE) + if (p->auth_conf.method != AUTH_NONE) json_do_string("authentication", - fmt_auth_method(p->auth.method)); + fmt_auth_method(p->auth_conf.method)); json_do_bool("ttl_security", p->conf.ttlsec); json_do_uint("holdtime", p->conf.holdtime); json_do_uint("min_holdtime", p->conf.min_holdtime); diff --git a/usr.sbin/bgpd/bgpd.c b/usr.sbin/bgpd/bgpd.c index 572551ce4..671fb0656 100644 --- a/usr.sbin/bgpd/bgpd.c +++ b/usr.sbin/bgpd/bgpd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bgpd.c,v 1.268 2024/09/30 09:42:24 claudio Exp $ */ +/* $OpenBSD: bgpd.c,v 1.269 2024/10/01 11:49:24 claudio Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer @@ -467,7 +467,7 @@ BROKEN if (pledge("stdio rpath wpath cpath fattr unix route recvfd sendfd", pftable_clear_all(); RB_FOREACH(p, peer_head, &conf->peers) - pfkey_remove(p); + pfkey_remove(&p->auth_state); while ((rr = SIMPLEQ_FIRST(&ribnames)) != NULL) { SIMPLEQ_REMOVE_HEAD(&ribnames, entry); @@ -651,9 +651,12 @@ send_config(struct bgpd_config *conf) if (imsg_compose(ibuf_se, IMSG_RECONF_PEER, p->conf.id, 0, -1, &p->conf, sizeof(p->conf)) == -1) return (-1); + if (pfkey_send_conf(ibuf_se, p->conf.id, &p->auth_conf) == -1) + return (-1); if (p->reconf_action == RECONF_REINIT) - if (pfkey_establish(p) == -1) + if (pfkey_establish(&p->auth_state, &p->auth_conf, + session_localaddr(p), &p->conf.remote_addr) == -1) log_peer_warnx(&p->conf, "pfkey setup failed"); } @@ -943,7 +946,9 @@ dispatch_imsg(struct imsgbuf *imsgbuf, int idx, struct bgpd_config *conf) } p = getpeerbyid(conf, imsg_get_id(&imsg)); if (p != NULL) { - if (pfkey_establish(p) == -1) + if (pfkey_establish(&p->auth_state, + &p->auth_conf, session_localaddr(p), + &p->conf.remote_addr) == -1) log_peer_warnx(&p->conf, "pfkey setup failed"); } diff --git a/usr.sbin/bgpd/bgpd.h b/usr.sbin/bgpd/bgpd.h index c558d636b..43322c14a 100644 --- a/usr.sbin/bgpd/bgpd.h +++ b/usr.sbin/bgpd/bgpd.h @@ -1,4 +1,4 @@ -/* $OpenBSD: bgpd.h,v 1.496 2024/09/04 15:06:36 claudio Exp $ */ +/* $OpenBSD: bgpd.h,v 1.497 2024/10/01 11:49:24 claudio Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer @@ -379,7 +379,7 @@ enum auth_enc_alg { AUTH_EALG_AES, }; -struct peer_auth { +struct auth_config { char md5key[TCP_MD5_KEY_LEN]; char auth_key_in[IPSEC_AUTH_KEY_LEN]; char auth_key_out[IPSEC_AUTH_KEY_LEN]; @@ -452,7 +452,6 @@ struct peer_config { struct bgpd_addr remote_addr; struct bgpd_addr local_addr_v4; struct bgpd_addr local_addr_v6; - struct peer_auth auth; struct capabilities capabilities; struct addpath_eval eval; char group[PEER_DESCR_LEN]; @@ -649,6 +648,7 @@ enum imsg_type { IMSG_RECONF_CONF, IMSG_RECONF_RIB, IMSG_RECONF_PEER, + IMSG_RECONF_PEER_AUTH, IMSG_RECONF_FILTER, IMSG_RECONF_LISTENER, IMSG_RECONF_CTRL, diff --git a/usr.sbin/bgpd/config.c b/usr.sbin/bgpd/config.c index 94efad738..4821dea4a 100644 --- a/usr.sbin/bgpd/config.c +++ b/usr.sbin/bgpd/config.c @@ -1,4 +1,4 @@ -/* $OpenBSD: config.c,v 1.111 2024/09/04 13:30:10 claudio Exp $ */ +/* $OpenBSD: config.c,v 1.112 2024/10/01 11:49:24 claudio Exp $ */ /* * Copyright (c) 2003, 2004, 2005 Henning Brauer @@ -440,8 +440,8 @@ merge_config(struct bgpd_config *xconf, struct bgpd_config *conf) np = getpeerbyid(conf, p->conf.id); if (np != NULL) { np->reconf_action = RECONF_KEEP; - /* copy the auth state since parent uses it */ - np->auth = p->auth; + /* keep the auth state since parent needs it */ + np->auth_state = p->auth_state; RB_REMOVE(peer_head, &xconf->peers, p); free(p); @@ -467,7 +467,7 @@ free_deleted_peers(struct bgpd_config *conf) RB_FOREACH_SAFE(p, peer_head, &conf->peers, nextp) { if (p->reconf_action == RECONF_DELETE) { /* peer no longer exists, clear pfkey state */ - pfkey_remove(p); + pfkey_remove(&p->auth_state); RB_REMOVE(peer_head, &conf->peers, p); free(p); } diff --git a/usr.sbin/bgpd/control.c b/usr.sbin/bgpd/control.c index 2ef1221e4..43ecd02bd 100644 --- a/usr.sbin/bgpd/control.c +++ b/usr.sbin/bgpd/control.c @@ -1,4 +1,4 @@ -/* $OpenBSD: control.c,v 1.118 2024/08/20 11:59:39 claudio Exp $ */ +/* $OpenBSD: control.c,v 1.120 2024/10/01 18:31:10 claudio Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer @@ -544,6 +544,7 @@ control_imsg_relay(struct imsg *imsg, struct peer *p) /* special handling for peers since only the stats are sent from RDE */ if (type == IMSG_CTL_SHOW_NEIGHBOR) { struct rde_peer_stats stats; + struct peer peer; if (p == NULL) { log_warnx("%s: no such peer: id=%u", __func__, @@ -554,20 +555,23 @@ control_imsg_relay(struct imsg *imsg, struct peer *p) log_warnx("%s: imsg_get_data", __func__); return (0); } - p->stats.prefix_cnt = stats.prefix_cnt; - p->stats.prefix_out_cnt = stats.prefix_out_cnt; - p->stats.prefix_rcvd_update = stats.prefix_rcvd_update; - p->stats.prefix_rcvd_withdraw = stats.prefix_rcvd_withdraw; - p->stats.prefix_rcvd_eor = stats.prefix_rcvd_eor; - p->stats.prefix_sent_update = stats.prefix_sent_update; - p->stats.prefix_sent_withdraw = stats.prefix_sent_withdraw; - p->stats.prefix_sent_eor = stats.prefix_sent_eor; - p->stats.pending_update = stats.pending_update; - p->stats.pending_withdraw = stats.pending_withdraw; - p->stats.msg_queue_len = msgbuf_queuelen(&p->wbuf); + peer = *p; + explicit_bzero(&peer.auth_conf, sizeof(peer.auth_conf)); + peer.auth_conf.method = p->auth_conf.method; + peer.stats.prefix_cnt = stats.prefix_cnt; + peer.stats.prefix_out_cnt = stats.prefix_out_cnt; + peer.stats.prefix_rcvd_update = stats.prefix_rcvd_update; + peer.stats.prefix_rcvd_withdraw = stats.prefix_rcvd_withdraw; + peer.stats.prefix_rcvd_eor = stats.prefix_rcvd_eor; + peer.stats.prefix_sent_update = stats.prefix_sent_update; + peer.stats.prefix_sent_withdraw = stats.prefix_sent_withdraw; + peer.stats.prefix_sent_eor = stats.prefix_sent_eor; + peer.stats.pending_update = stats.pending_update; + peer.stats.pending_withdraw = stats.pending_withdraw; + peer.stats.msg_queue_len = msgbuf_queuelen(&p->wbuf); return imsg_compose(&c->imsgbuf, type, 0, pid, -1, - p, sizeof(*p)); + &peer, sizeof(peer)); } /* if command finished no need to send exit message */ diff --git a/usr.sbin/bgpd/parse.y b/usr.sbin/bgpd/parse.y index c2f24cc91..166c0e794 100644 --- a/usr.sbin/bgpd/parse.y +++ b/usr.sbin/bgpd/parse.y @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.y,v 1.468 2024/09/20 02:00:46 jsg Exp $ */ +/* $OpenBSD: parse.y,v 1.469 2024/10/01 11:49:24 claudio Exp $ */ /* * Copyright (c) 2002, 2003, 2004 Henning Brauer @@ -2076,59 +2076,59 @@ peeropts : REMOTEAS as4number { curpeer->conf.max_out_prefix_restart = $4; } | TCP MD5SIG PASSWORD string { - if (curpeer->conf.auth.method) { + if (curpeer->auth_conf.method) { yyerror("auth method cannot be redefined"); free($4); YYERROR; } - if (strlcpy(curpeer->conf.auth.md5key, $4, - sizeof(curpeer->conf.auth.md5key)) >= - sizeof(curpeer->conf.auth.md5key)) { + if (strlcpy(curpeer->auth_conf.md5key, $4, + sizeof(curpeer->auth_conf.md5key)) >= + sizeof(curpeer->auth_conf.md5key)) { yyerror("tcp md5sig password too long: max %zu", - sizeof(curpeer->conf.auth.md5key) - 1); + sizeof(curpeer->auth_conf.md5key) - 1); free($4); YYERROR; } - curpeer->conf.auth.method = AUTH_MD5SIG; - curpeer->conf.auth.md5key_len = strlen($4); + curpeer->auth_conf.method = AUTH_MD5SIG; + curpeer->auth_conf.md5key_len = strlen($4); free($4); } | TCP MD5SIG KEY string { - if (curpeer->conf.auth.method) { + if (curpeer->auth_conf.method) { yyerror("auth method cannot be redefined"); free($4); YYERROR; } - if (str2key($4, curpeer->conf.auth.md5key, - sizeof(curpeer->conf.auth.md5key)) == -1) { + if (str2key($4, curpeer->auth_conf.md5key, + sizeof(curpeer->auth_conf.md5key)) == -1) { free($4); YYERROR; } - curpeer->conf.auth.method = AUTH_MD5SIG; - curpeer->conf.auth.md5key_len = strlen($4) / 2; + curpeer->auth_conf.method = AUTH_MD5SIG; + curpeer->auth_conf.md5key_len = strlen($4) / 2; free($4); } | IPSEC espah IKE { - if (curpeer->conf.auth.method) { + if (curpeer->auth_conf.method) { yyerror("auth method cannot be redefined"); YYERROR; } if ($2) - curpeer->conf.auth.method = AUTH_IPSEC_IKE_ESP; + curpeer->auth_conf.method = AUTH_IPSEC_IKE_ESP; else - curpeer->conf.auth.method = AUTH_IPSEC_IKE_AH; + curpeer->auth_conf.method = AUTH_IPSEC_IKE_AH; } | IPSEC espah inout SPI NUMBER STRING STRING encspec { enum auth_alg auth_alg; uint8_t keylen; - if (curpeer->conf.auth.method && - (((curpeer->conf.auth.spi_in && $3 == 1) || - (curpeer->conf.auth.spi_out && $3 == 0)) || - ($2 == 1 && curpeer->conf.auth.method != + if (curpeer->auth_conf.method && + (((curpeer->auth_conf.spi_in && $3 == 1) || + (curpeer->auth_conf.spi_out && $3 == 0)) || + ($2 == 1 && curpeer->auth_conf.method != AUTH_IPSEC_MANUAL_ESP) || - ($2 == 0 && curpeer->conf.auth.method != + ($2 == 0 && curpeer->auth_conf.method != AUTH_IPSEC_MANUAL_AH))) { yyerror("auth method cannot be redefined"); free($6); @@ -2158,7 +2158,7 @@ peeropts : REMOTEAS as4number { } if ($2) - curpeer->conf.auth.method = + curpeer->auth_conf.method = AUTH_IPSEC_MANUAL_ESP; else { if ($8.enc_alg) { @@ -2167,7 +2167,7 @@ peeropts : REMOTEAS as4number { free($7); YYERROR; } - curpeer->conf.auth.method = + curpeer->auth_conf.method = AUTH_IPSEC_MANUAL_AH; } @@ -2178,37 +2178,37 @@ peeropts : REMOTEAS as4number { } if ($3 == 1) { - if (str2key($7, curpeer->conf.auth.auth_key_in, - sizeof(curpeer->conf.auth.auth_key_in)) == + if (str2key($7, curpeer->auth_conf.auth_key_in, + sizeof(curpeer->auth_conf.auth_key_in)) == -1) { free($7); YYERROR; } - curpeer->conf.auth.spi_in = $5; - curpeer->conf.auth.auth_alg_in = auth_alg; - curpeer->conf.auth.enc_alg_in = $8.enc_alg; - memcpy(&curpeer->conf.auth.enc_key_in, + curpeer->auth_conf.spi_in = $5; + curpeer->auth_conf.auth_alg_in = auth_alg; + curpeer->auth_conf.enc_alg_in = $8.enc_alg; + memcpy(&curpeer->auth_conf.enc_key_in, &$8.enc_key, - sizeof(curpeer->conf.auth.enc_key_in)); - curpeer->conf.auth.enc_keylen_in = + sizeof(curpeer->auth_conf.enc_key_in)); + curpeer->auth_conf.enc_keylen_in = $8.enc_key_len; - curpeer->conf.auth.auth_keylen_in = keylen; + curpeer->auth_conf.auth_keylen_in = keylen; } else { - if (str2key($7, curpeer->conf.auth.auth_key_out, - sizeof(curpeer->conf.auth.auth_key_out)) == + if (str2key($7, curpeer->auth_conf.auth_key_out, + sizeof(curpeer->auth_conf.auth_key_out)) == -1) { free($7); YYERROR; } - curpeer->conf.auth.spi_out = $5; - curpeer->conf.auth.auth_alg_out = auth_alg; - curpeer->conf.auth.enc_alg_out = $8.enc_alg; - memcpy(&curpeer->conf.auth.enc_key_out, + curpeer->auth_conf.spi_out = $5; + curpeer->auth_conf.auth_alg_out = auth_alg; + curpeer->auth_conf.enc_alg_out = $8.enc_alg; + memcpy(&curpeer->auth_conf.enc_key_out, &$8.enc_key, - sizeof(curpeer->conf.auth.enc_key_out)); - curpeer->conf.auth.enc_keylen_out = + sizeof(curpeer->auth_conf.enc_key_out)); + curpeer->auth_conf.enc_keylen_out = $8.enc_key_len; - curpeer->conf.auth.auth_keylen_out = keylen; + curpeer->auth_conf.auth_keylen_out = keylen; } free($7); } @@ -5073,10 +5073,10 @@ neighbor_consistent(struct peer *p) } /* with any form of ipsec local-address is required */ - if ((p->conf.auth.method == AUTH_IPSEC_IKE_ESP || - p->conf.auth.method == AUTH_IPSEC_IKE_AH || - p->conf.auth.method == AUTH_IPSEC_MANUAL_ESP || - p->conf.auth.method == AUTH_IPSEC_MANUAL_AH) && + if ((p->auth_conf.method == AUTH_IPSEC_IKE_ESP || + p->auth_conf.method == AUTH_IPSEC_IKE_AH || + p->auth_conf.method == AUTH_IPSEC_MANUAL_ESP || + p->auth_conf.method == AUTH_IPSEC_MANUAL_AH) && local_addr->aid == AID_UNSPEC) { yyerror("neighbors with any form of IPsec configured " "need local-address to be specified"); @@ -5084,9 +5084,9 @@ neighbor_consistent(struct peer *p) } /* with static keying we need both directions */ - if ((p->conf.auth.method == AUTH_IPSEC_MANUAL_ESP || - p->conf.auth.method == AUTH_IPSEC_MANUAL_AH) && - (!p->conf.auth.spi_in || !p->conf.auth.spi_out)) { + if ((p->auth_conf.method == AUTH_IPSEC_MANUAL_ESP || + p->auth_conf.method == AUTH_IPSEC_MANUAL_AH) && + (!p->auth_conf.spi_in || !p->auth_conf.spi_out)) { yyerror("with manual keyed IPsec, SPIs and keys " "for both directions are required"); return (-1); diff --git a/usr.sbin/bgpd/pfkey.c b/usr.sbin/bgpd/pfkey.c index 791877597..806c54963 100644 --- a/usr.sbin/bgpd/pfkey.c +++ b/usr.sbin/bgpd/pfkey.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pfkey.c,v 1.68 2022/11/07 22:39:13 mbuhl Exp $ */ +/* $OpenBSD: pfkey.c,v 1.71 2024/10/02 09:45:29 claudio Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer @@ -45,31 +45,19 @@ static uint32_t sadb_msg_seq = 0; static uint32_t pid = 0; /* should pid_t but pfkey needs uint32_t */ static int pfkey_fd; -int pfkey_reply(int, uint32_t *); -int pfkey_send(int, uint8_t, uint8_t, uint8_t, - struct bgpd_addr *, struct bgpd_addr *, - uint32_t, uint8_t, int, char *, uint8_t, int, char *, - uint16_t, uint16_t); +static int pfkey_reply(int, uint32_t *); +static int pfkey_send(int, uint8_t, uint8_t, uint8_t, + const struct bgpd_addr *, const struct bgpd_addr *, + uint32_t, uint8_t, int, char *, uint8_t, int, char *, + uint16_t, uint16_t); #define pfkey_flow(fd, satype, cmd, dir, from, to, sport, dport) \ pfkey_send(fd, satype, cmd, dir, from, to, \ 0, 0, 0, NULL, 0, 0, NULL, sport, dport) -static struct bgpd_addr * -pfkey_localaddr(struct peer *p) -{ - switch (p->conf.remote_addr.aid) { - case AID_INET: - return &p->conf.local_addr_v4; - case AID_INET6: - return &p->conf.local_addr_v6; - } - fatalx("Unknown AID in pfkey_localaddr"); -} - -int +static int pfkey_send(int sd, uint8_t satype, uint8_t mtype, uint8_t dir, - struct bgpd_addr *src, struct bgpd_addr *dst, uint32_t spi, + const struct bgpd_addr *src, const struct bgpd_addr *dst, uint32_t spi, uint8_t aalg, int alen, char *akey, uint8_t ealg, int elen, char *ekey, uint16_t sport, uint16_t dport) { @@ -447,7 +435,7 @@ pfkey_read(int sd, struct sadb_msg *h) return (1); } -int +static int pfkey_reply(int sd, uint32_t *spi) { struct sadb_msg hdr, *msg; @@ -511,8 +499,8 @@ pfkey_reply(int sd, uint32_t *spi) } static int -pfkey_sa_add(struct bgpd_addr *src, struct bgpd_addr *dst, uint8_t keylen, - char *key, uint32_t *spi) +pfkey_sa_add(const struct bgpd_addr *src, const struct bgpd_addr *dst, + uint8_t keylen, char *key, uint32_t *spi) { if (pfkey_send(pfkey_fd, SADB_X_SATYPE_TCPSIGNATURE, SADB_GETSPI, 0, src, dst, 0, 0, 0, NULL, 0, 0, NULL, 0, 0) == -1) @@ -528,7 +516,8 @@ pfkey_sa_add(struct bgpd_addr *src, struct bgpd_addr *dst, uint8_t keylen, } static int -pfkey_sa_remove(struct bgpd_addr *src, struct bgpd_addr *dst, uint32_t *spi) +pfkey_sa_remove(const struct bgpd_addr *src, const struct bgpd_addr *dst, + uint32_t *spi) { if (pfkey_send(pfkey_fd, SADB_X_SATYPE_TCPSIGNATURE, SADB_DELETE, 0, src, dst, *spi, 0, 0, NULL, 0, 0, NULL, 0, 0) == -1) @@ -540,56 +529,52 @@ pfkey_sa_remove(struct bgpd_addr *src, struct bgpd_addr *dst, uint32_t *spi) } static int -pfkey_md5sig_establish(struct peer *p) +pfkey_md5sig_establish(struct auth_state *as, struct auth_config *auth, + const struct bgpd_addr *local_addr, const struct bgpd_addr *remote_addr) { uint32_t spi_out = 0; uint32_t spi_in = 0; - if (pfkey_sa_add(pfkey_localaddr(p), &p->conf.remote_addr, - p->conf.auth.md5key_len, p->conf.auth.md5key, - &spi_out) == -1) + if (pfkey_sa_add(local_addr, remote_addr, + auth->md5key_len, auth->md5key, &spi_out) == -1) goto fail; - if (pfkey_sa_add(&p->conf.remote_addr, pfkey_localaddr(p), - p->conf.auth.md5key_len, p->conf.auth.md5key, - &spi_in) == -1) + if (pfkey_sa_add(remote_addr, local_addr, + auth->md5key_len, auth->md5key, &spi_in) == -1) goto fail; /* cleanup old flow if one was present */ - if (p->auth.established) { - if (pfkey_remove(p) == -1) - return (-1); - } + if (pfkey_remove(as) == -1) + return (-1); - p->auth.established = 1; - p->auth.spi_out = spi_out; - p->auth.spi_in = spi_in; + as->established = 1; + as->method = auth->method; + as->local_addr = *local_addr; + as->remote_addr = *remote_addr; + as->spi_out = spi_out; + as->spi_in = spi_in; return (0); fail: - log_peer_warn(&p->conf, "failed to insert md5sig"); return (-1); } static int -pfkey_md5sig_remove(struct peer *p) +pfkey_md5sig_remove(struct auth_state *as) { - if (p->auth.spi_out) - if (pfkey_sa_remove(&p->auth.local_addr, &p->conf.remote_addr, - &p->auth.spi_out) == -1) + if (as->spi_out) + if (pfkey_sa_remove(&as->local_addr, &as->remote_addr, + &as->spi_out) == -1) goto fail; - if (p->auth.spi_in) - if (pfkey_sa_remove(&p->conf.remote_addr, &p->auth.local_addr, - &p->auth.spi_in) == -1) + if (as->spi_in) + if (pfkey_sa_remove(&as->remote_addr, &as->local_addr, + &as->spi_in) == -1) goto fail; - p->auth.established = 0; - p->auth.spi_out = 0; - p->auth.spi_in = 0; + explicit_bzero(as, sizeof(*as)); return (0); fail: - log_peer_warn(&p->conf, "failed to remove md5sig"); return (-1); } @@ -620,18 +605,16 @@ pfkey_enc_alg(enum auth_enc_alg alg) } static int -pfkey_ipsec_establish(struct peer *p) +pfkey_ipsec_establish(struct auth_state *as, struct auth_config *auth, + const struct bgpd_addr *local_addr, const struct bgpd_addr *remote_addr) { uint8_t satype = SADB_SATYPE_ESP; - struct bgpd_addr *local_addr = pfkey_localaddr(p); /* cleanup first, unlike in the TCP MD5 case */ - if (p->auth.established) { - if (pfkey_remove(p) == -1) - return (-1); - } + if (pfkey_remove(as) == -1) + return (-1); - switch (p->auth.method) { + switch (auth->method) { case AUTH_IPSEC_IKE_ESP: satype = SADB_SATYPE_ESP; break; @@ -640,30 +623,30 @@ pfkey_ipsec_establish(struct peer *p) break; case AUTH_IPSEC_MANUAL_ESP: case AUTH_IPSEC_MANUAL_AH: - satype = p->auth.method == AUTH_IPSEC_MANUAL_ESP ? + satype = auth->method == AUTH_IPSEC_MANUAL_ESP ? SADB_SATYPE_ESP : SADB_SATYPE_AH; if (pfkey_send(pfkey_fd, satype, SADB_ADD, 0, - local_addr, &p->conf.remote_addr, - p->conf.auth.spi_out, - pfkey_auth_alg(p->conf.auth.auth_alg_out), - p->conf.auth.auth_keylen_out, - p->conf.auth.auth_key_out, - pfkey_enc_alg(p->conf.auth.enc_alg_out), - p->conf.auth.enc_keylen_out, - p->conf.auth.enc_key_out, + local_addr, remote_addr, + auth->spi_out, + pfkey_auth_alg(auth->auth_alg_out), + auth->auth_keylen_out, + auth->auth_key_out, + pfkey_enc_alg(auth->enc_alg_out), + auth->enc_keylen_out, + auth->enc_key_out, 0, 0) == -1) goto fail_key; if (pfkey_reply(pfkey_fd, NULL) == -1) goto fail_key; if (pfkey_send(pfkey_fd, satype, SADB_ADD, 0, - &p->conf.remote_addr, local_addr, - p->conf.auth.spi_in, - pfkey_auth_alg(p->conf.auth.auth_alg_in), - p->conf.auth.auth_keylen_in, - p->conf.auth.auth_key_in, - pfkey_enc_alg(p->conf.auth.enc_alg_in), - p->conf.auth.enc_keylen_in, - p->conf.auth.enc_key_in, + remote_addr, local_addr, + auth->spi_in, + pfkey_auth_alg(auth->auth_alg_in), + auth->auth_keylen_in, + auth->auth_key_in, + pfkey_enc_alg(auth->enc_alg_in), + auth->enc_keylen_in, + auth->enc_key_in, 0, 0) == -1) goto fail_key; if (pfkey_reply(pfkey_fd, NULL) == -1) @@ -674,49 +657,52 @@ pfkey_ipsec_establish(struct peer *p) } if (pfkey_flow(pfkey_fd, satype, SADB_X_ADDFLOW, IPSP_DIRECTION_OUT, - local_addr, &p->conf.remote_addr, 0, BGP_PORT) == -1) + local_addr, remote_addr, 0, BGP_PORT) == -1) goto fail_flow; if (pfkey_reply(pfkey_fd, NULL) == -1) goto fail_flow; if (pfkey_flow(pfkey_fd, satype, SADB_X_ADDFLOW, IPSP_DIRECTION_OUT, - local_addr, &p->conf.remote_addr, BGP_PORT, 0) == -1) + local_addr, remote_addr, BGP_PORT, 0) == -1) goto fail_flow; if (pfkey_reply(pfkey_fd, NULL) == -1) goto fail_flow; if (pfkey_flow(pfkey_fd, satype, SADB_X_ADDFLOW, IPSP_DIRECTION_IN, - &p->conf.remote_addr, local_addr, 0, BGP_PORT) == -1) + remote_addr, local_addr, 0, BGP_PORT) == -1) goto fail_flow; if (pfkey_reply(pfkey_fd, NULL) == -1) goto fail_flow; if (pfkey_flow(pfkey_fd, satype, SADB_X_ADDFLOW, IPSP_DIRECTION_IN, - &p->conf.remote_addr, local_addr, BGP_PORT, 0) == -1) + remote_addr, local_addr, BGP_PORT, 0) == -1) goto fail_flow; if (pfkey_reply(pfkey_fd, NULL) == -1) goto fail_flow; /* save SPI so that they can be removed later on */ - p->auth.spi_in = p->conf.auth.spi_in; - p->auth.spi_out = p->conf.auth.spi_out; - p->auth.established = 1; + as->established = 1; + as->method = auth->method; + as->local_addr = *local_addr; + as->remote_addr = *remote_addr; + as->spi_in = auth->spi_in; + as->spi_out = auth->spi_out; return (0); fail_key: - log_peer_warn(&p->conf, "failed to insert ipsec key"); + log_warn("failed to insert ipsec key"); return (-1); fail_flow: - log_peer_warn(&p->conf, "failed to insert ipsec flow"); + log_warn("failed to insert ipsec flow"); return (-1); } static int -pfkey_ipsec_remove(struct peer *p) +pfkey_ipsec_remove(struct auth_state *as) { uint8_t satype; - switch (p->auth.method) { + switch (as->method) { case AUTH_IPSEC_IKE_ESP: satype = SADB_SATYPE_ESP; break; @@ -725,20 +711,18 @@ pfkey_ipsec_remove(struct peer *p) break; case AUTH_IPSEC_MANUAL_ESP: case AUTH_IPSEC_MANUAL_AH: - satype = p->auth.method == AUTH_IPSEC_MANUAL_ESP ? + satype = as->method == AUTH_IPSEC_MANUAL_ESP ? SADB_SATYPE_ESP : SADB_SATYPE_AH; if (pfkey_send(pfkey_fd, satype, SADB_DELETE, 0, - &p->auth.local_addr, &p->conf.remote_addr, - p->auth.spi_out, 0, 0, NULL, 0, 0, NULL, - 0, 0) == -1) + &as->local_addr, &as->remote_addr, + as->spi_out, 0, 0, NULL, 0, 0, NULL, 0, 0) == -1) goto fail_key; if (pfkey_reply(pfkey_fd, NULL) == -1) goto fail_key; if (pfkey_send(pfkey_fd, satype, SADB_DELETE, 0, - &p->conf.remote_addr, &p->auth.local_addr, - p->auth.spi_in, 0, 0, NULL, 0, 0, NULL, - 0, 0) == -1) + &as->remote_addr, &as->local_addr, + as->spi_in, 0, 0, NULL, 0, 0, NULL, 0, 0) == -1) goto fail_key; if (pfkey_reply(pfkey_fd, NULL) == -1) goto fail_key; @@ -748,88 +732,68 @@ pfkey_ipsec_remove(struct peer *p) } if (pfkey_flow(pfkey_fd, satype, SADB_X_DELFLOW, IPSP_DIRECTION_OUT, - &p->auth.local_addr, &p->conf.remote_addr, 0, BGP_PORT) == -1) + &as->local_addr, &as->remote_addr, 0, BGP_PORT) == -1) goto fail_flow; if (pfkey_reply(pfkey_fd, NULL) == -1) goto fail_flow; if (pfkey_flow(pfkey_fd, satype, SADB_X_DELFLOW, IPSP_DIRECTION_OUT, - &p->auth.local_addr, &p->conf.remote_addr, BGP_PORT, 0) == -1) + &as->local_addr, &as->remote_addr, BGP_PORT, 0) == -1) goto fail_flow; if (pfkey_reply(pfkey_fd, NULL) == -1) goto fail_flow; if (pfkey_flow(pfkey_fd, satype, SADB_X_DELFLOW, IPSP_DIRECTION_IN, - &p->conf.remote_addr, &p->auth.local_addr, 0, BGP_PORT) == -1) + &as->remote_addr, &as->local_addr, 0, BGP_PORT) == -1) goto fail_flow; if (pfkey_reply(pfkey_fd, NULL) == -1) goto fail_flow; if (pfkey_flow(pfkey_fd, satype, SADB_X_DELFLOW, IPSP_DIRECTION_IN, - &p->conf.remote_addr, &p->auth.local_addr, BGP_PORT, 0) == -1) + &as->remote_addr, &as->local_addr, BGP_PORT, 0) == -1) goto fail_flow; if (pfkey_reply(pfkey_fd, NULL) == -1) goto fail_flow; - p->auth.established = 0; - p->auth.spi_out = 0; - p->auth.spi_in = 0; + explicit_bzero(as, sizeof(*as)); return (0); fail_key: - log_peer_warn(&p->conf, "failed to remove ipsec key"); + log_warn("failed to remove ipsec key"); return (-1); fail_flow: - log_peer_warn(&p->conf, "failed to remove ipsec flow"); + log_warn("failed to remove ipsec flow"); return (-1); } int -pfkey_establish(struct peer *p) +pfkey_establish(struct auth_state *as, struct auth_config *auth, + const struct bgpd_addr *local_addr, const struct bgpd_addr *remote_addr) { - int rv; - - switch (p->conf.auth.method) { + switch (auth->method) { case AUTH_NONE: - rv = 0; - if (p->auth.established) - rv = pfkey_remove(p); - break; + return pfkey_remove(as); case AUTH_MD5SIG: - rv = pfkey_md5sig_establish(p); - break; + return pfkey_md5sig_establish(as, auth, local_addr, + remote_addr); default: - rv = pfkey_ipsec_establish(p); - break; + return pfkey_ipsec_establish(as, auth, local_addr, remote_addr); } - /* - * make sure we keep copies of everything we need to - * remove SAs and flows later again, even if the - * info in p->conf changed due to reload. - * We need: SPIs, method, local_addr, remote_addr. - * remote_addr cannot change, so no copy, SPI are - * handled by the method specific functions. - */ - memcpy(&p->auth.local_addr, pfkey_localaddr(p), - sizeof(p->auth.local_addr)); - p->auth.method = p->conf.auth.method; - - return (rv); } int -pfkey_remove(struct peer *p) +pfkey_remove(struct auth_state *as) { - if (p->auth.established == 0) + if (as->established == 0) return (0); - switch (p->auth.method) { + switch (as->method) { case AUTH_NONE: return (0); case AUTH_MD5SIG: - return (pfkey_md5sig_remove(p)); + return (pfkey_md5sig_remove(as)); default: - return (pfkey_ipsec_remove(p)); + return (pfkey_ipsec_remove(as)); } } @@ -847,26 +811,40 @@ pfkey_init(void) return (pfkey_fd); } -/* verify that connection is using TCP MD5UM if required by config */ int -tcp_md5_check(int fd, struct peer *p) +pfkey_send_conf(struct imsgbuf *imsgbuf, uint32_t id, struct auth_config *auth) +{ + /* SE only needs the auth method */ + return imsg_compose(imsgbuf, IMSG_RECONF_PEER_AUTH, id, 0, -1, + &auth->method, sizeof(auth->method)); +} + +int +pfkey_recv_conf(struct peer *p, struct imsg *imsg) +{ + struct auth_config *auth = &p->auth_conf; + + return imsg_get_data(imsg, &auth->method, sizeof(auth->method)); +} + +/* verify that connection is using TCP MD5SIG if required by config */ +int +tcp_md5_check(int fd, struct auth_config *auth) { socklen_t len; int opt; - if (p->conf.auth.method == AUTH_MD5SIG) { + if (auth->method == AUTH_MD5SIG) { if (sysdep.no_md5sig) { - log_peer_warnx(&p->conf, - "md5sig configured but not available"); + errno = ENOPROTOOPT; return -1; } len = sizeof(opt); if (getsockopt(fd, IPPROTO_TCP, TCP_MD5SIG, &opt, &len) == -1) - fatal("getsockopt TCP_MD5SIG"); + return -1; if (!opt) { /* non-md5'd connection! */ - log_peer_warnx(&p->conf, - "connection attempt without md5 signature"); + errno = ECONNREFUSED; return -1; } } @@ -875,21 +853,18 @@ tcp_md5_check(int fd, struct peer *p) /* enable or set TCP MD5SIG on a new client connection */ int -tcp_md5_set(int fd, struct peer *p) +tcp_md5_set(int fd, struct auth_config *auth, struct bgpd_addr *remote_addr) { int opt = 1; - if (p->conf.auth.method == AUTH_MD5SIG) { + if (auth->method == AUTH_MD5SIG) { if (sysdep.no_md5sig) { - log_peer_warnx(&p->conf, - "md5sig configured but not available"); + errno = ENOPROTOOPT; return -1; } if (setsockopt(fd, IPPROTO_TCP, TCP_MD5SIG, - &opt, sizeof(opt)) == -1) { - log_peer_warn(&p->conf, "setsockopt md5sig"); + &opt, sizeof(opt)) == -1) return -1; - } } return 0; } diff --git a/usr.sbin/bgpd/printconf.c b/usr.sbin/bgpd/printconf.c index 8aeeeeeee..e34380ffd 100644 --- a/usr.sbin/bgpd/printconf.c +++ b/usr.sbin/bgpd/printconf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: printconf.c,v 1.174 2024/08/14 19:09:51 claudio Exp $ */ +/* $OpenBSD: printconf.c,v 1.175 2024/10/01 11:49:24 claudio Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer @@ -45,8 +45,7 @@ void print_originsets(struct prefixset_head *); void print_roa(struct roa_tree *); void print_aspa(struct aspa_tree *); void print_rtrs(struct rtr_config_head *); -void print_peer(struct peer_config *, struct bgpd_config *, - const char *); +void print_peer(struct peer *, struct bgpd_config *, const char *); const char *print_auth_alg(enum auth_alg); const char *print_enc_alg(enum auth_enc_alg); void print_announce(struct peer_config *, const char *); @@ -729,10 +728,12 @@ print_rtrs(struct rtr_config_head *rh) } void -print_peer(struct peer_config *p, struct bgpd_config *conf, const char *c) +print_peer(struct peer *peer, struct bgpd_config *conf, const char *c) { - char *method; - struct in_addr ina; + struct in_addr ina; + char *method; + struct peer_config *p = &peer->conf; + struct auth_config *auth = &peer->auth_conf; if ((p->remote_addr.aid == AID_INET && p->remote_masklen != 32) || (p->remote_addr.aid == AID_INET6 && p->remote_masklen != 128)) @@ -831,30 +832,30 @@ print_peer(struct peer_config *p, struct bgpd_config *conf, const char *c) if (p->flags & PEERFLAG_LOG_UPDATES) printf("%s\tlog updates\n", c); - if (p->auth.method == AUTH_MD5SIG) + if (auth->method == AUTH_MD5SIG) printf("%s\ttcp md5sig\n", c); - else if (p->auth.method == AUTH_IPSEC_MANUAL_ESP || - p->auth.method == AUTH_IPSEC_MANUAL_AH) { - if (p->auth.method == AUTH_IPSEC_MANUAL_ESP) + else if (auth->method == AUTH_IPSEC_MANUAL_ESP || + auth->method == AUTH_IPSEC_MANUAL_AH) { + if (auth->method == AUTH_IPSEC_MANUAL_ESP) method = "esp"; else method = "ah"; printf("%s\tipsec %s in spi %u %s XXXXXX", c, method, - p->auth.spi_in, print_auth_alg(p->auth.auth_alg_in)); - if (p->auth.enc_alg_in) - printf(" %s XXXXXX", print_enc_alg(p->auth.enc_alg_in)); + auth->spi_in, print_auth_alg(auth->auth_alg_in)); + if (auth->enc_alg_in) + printf(" %s XXXXXX", print_enc_alg(auth->enc_alg_in)); printf("\n"); printf("%s\tipsec %s out spi %u %s XXXXXX", c, method, - p->auth.spi_out, print_auth_alg(p->auth.auth_alg_out)); - if (p->auth.enc_alg_out) + auth->spi_out, print_auth_alg(auth->auth_alg_out)); + if (auth->enc_alg_out) printf(" %s XXXXXX", - print_enc_alg(p->auth.enc_alg_out)); + print_enc_alg(auth->enc_alg_out)); printf("\n"); - } else if (p->auth.method == AUTH_IPSEC_IKE_AH) + } else if (auth->method == AUTH_IPSEC_IKE_AH) printf("%s\tipsec ah ike\n", c); - else if (p->auth.method == AUTH_IPSEC_IKE_ESP) + else if (auth->method == AUTH_IPSEC_IKE_ESP) printf("%s\tipsec esp ike\n", c); if (p->ttlsec) @@ -1196,39 +1197,36 @@ print_mrt(struct bgpd_config *conf, uint32_t pid, uint32_t gid, void print_groups(struct bgpd_config *conf) { - struct peer_config **peerlist; - struct peer *p; - u_int peer_cnt, i; - uint32_t prev_groupid; - const char *tab = "\t"; - const char *nada = ""; - const char *c; + struct peer **peerlist; + struct peer *p; + u_int peer_cnt, i; + uint32_t prev_groupid; + const char *c; peer_cnt = 0; RB_FOREACH(p, peer_head, &conf->peers) peer_cnt++; - - if ((peerlist = calloc(peer_cnt, sizeof(struct peer_config *))) == NULL) + if ((peerlist = calloc(peer_cnt, sizeof(*peerlist))) == NULL) fatal("print_groups calloc"); - i = 0; RB_FOREACH(p, peer_head, &conf->peers) - peerlist[i++] = &p->conf; + peerlist[i++] = p; - qsort(peerlist, peer_cnt, sizeof(struct peer_config *), peer_compare); + qsort(peerlist, peer_cnt, sizeof(*peerlist), peer_compare); prev_groupid = 0; for (i = 0; i < peer_cnt; i++) { - if (peerlist[i]->groupid) { - c = tab; - if (peerlist[i]->groupid != prev_groupid) { + if (peerlist[i]->conf.groupid) { + c = "\t"; + if (peerlist[i]->conf.groupid != prev_groupid) { if (prev_groupid) printf("}\n\n"); - printf("group \"%s\" {\n", peerlist[i]->group); - prev_groupid = peerlist[i]->groupid; + printf("group \"%s\" {\n", + peerlist[i]->conf.group); + prev_groupid = peerlist[i]->conf.groupid; } } else - c = nada; + c = ""; print_peer(peerlist[i], conf, c); } @@ -1242,13 +1240,13 @@ print_groups(struct bgpd_config *conf) int peer_compare(const void *aa, const void *bb) { - const struct peer_config * const *a; - const struct peer_config * const *b; + const struct peer * const *a; + const struct peer * const *b; a = aa; b = bb; - return ((*a)->groupid - (*b)->groupid); + return ((*a)->conf.groupid - (*b)->conf.groupid); } void diff --git a/usr.sbin/bgpd/session.c b/usr.sbin/bgpd/session.c index c176edb67..b62f6fc67 100644 --- a/usr.sbin/bgpd/session.c +++ b/usr.sbin/bgpd/session.c @@ -1,4 +1,4 @@ -/* $OpenBSD: session.c,v 1.482 2024/09/09 12:59:49 claudio Exp $ */ +/* $OpenBSD: session.c,v 1.484 2024/10/01 18:29:34 claudio Exp $ */ /* * Copyright (c) 2003, 2004, 2005 Henning Brauer @@ -1032,14 +1032,15 @@ session_accept(int listenfd) } open: - if (p->conf.auth.method != AUTH_NONE && sysdep.no_pfkey) { + if (p->auth_conf.method != AUTH_NONE && sysdep.no_pfkey) { log_peer_warnx(&p->conf, "ipsec or md5sig configured but not available"); close(connfd); return; } - if (tcp_md5_check(connfd, p) == -1) { + if (tcp_md5_check(connfd, &p->auth_conf) == -1) { + log_peer_warn(&p->conf, "check md5sig"); close(connfd); return; } @@ -1066,7 +1067,7 @@ int session_connect(struct peer *peer) { struct sockaddr *sa; - struct bgpd_addr *bind_addr = NULL; + struct bgpd_addr *bind_addr; socklen_t sa_len; /* @@ -1084,25 +1085,20 @@ session_connect(struct peer *peer) return (-1); } - if (peer->conf.auth.method != AUTH_NONE && sysdep.no_pfkey) { + if (peer->auth_conf.method != AUTH_NONE && sysdep.no_pfkey) { log_peer_warnx(&peer->conf, "ipsec or md5sig configured but not available"); bgp_fsm(peer, EVNT_CON_OPENFAIL); return (-1); } - tcp_md5_set(peer->fd, peer); + if (tcp_md5_set(peer->fd, &peer->auth_conf, + &peer->conf.remote_addr) == -1) + log_peer_warn(&peer->conf, "setting md5sig"); peer->wbuf.fd = peer->fd; /* if local-address is set we need to bind() */ - switch (peer->conf.remote_addr.aid) { - case AID_INET: - bind_addr = &peer->conf.local_addr_v4; - break; - case AID_INET6: - bind_addr = &peer->conf.local_addr_v6; - break; - } + bind_addr = session_localaddr(peer); if ((sa = addr2sa(bind_addr, 0, &sa_len)) != NULL) { if (bind(peer->fd, sa, sa_len) == -1) { log_peer_warn(&peer->conf, "session_connect bind"); @@ -3003,6 +2999,16 @@ session_dispatch_imsg(struct imsgbuf *imsgbuf, int idx, u_int *listener_cnt) if (RB_INSERT(peer_head, &nconf->peers, p) != NULL) fatalx("%s: peer tree is corrupt", __func__); break; + case IMSG_RECONF_PEER_AUTH: + if (idx != PFD_PIPE_MAIN) + fatalx("reconf request not from parent"); + if ((p = getpeerbyid(nconf, peerid)) == NULL) { + log_warnx("no such peer: id=%u", peerid); + break; + } + if (pfkey_recv_conf(p, &imsg) == -1) + fatal("pfkey_recv_conf"); + break; case IMSG_RECONF_LISTENER: if (idx != PFD_PIPE_MAIN) fatalx("reconf request not from parent"); @@ -3641,6 +3647,18 @@ session_stop(struct peer *peer, uint8_t subcode, const char *reason) bgp_fsm(peer, EVNT_STOP); } +struct bgpd_addr * +session_localaddr(struct peer *p) +{ + switch (p->conf.remote_addr.aid) { + case AID_INET: + return &p->conf.local_addr_v4; + case AID_INET6: + return &p->conf.local_addr_v6; + } + fatalx("Unknown AID in %s", __func__); +} + void merge_peers(struct bgpd_config *c, struct bgpd_config *nc) { @@ -3657,13 +3675,14 @@ merge_peers(struct bgpd_config *c, struct bgpd_config *nc) } /* peer no longer uses TCP MD5SIG so deconfigure */ - if (p->conf.auth.method == AUTH_MD5SIG && - np->conf.auth.method != AUTH_MD5SIG) + if (p->auth_conf.method == AUTH_MD5SIG && + np->auth_conf.method != AUTH_MD5SIG) tcp_md5_del_listener(c, p); - else if (np->conf.auth.method == AUTH_MD5SIG) + else if (np->auth_conf.method == AUTH_MD5SIG) tcp_md5_add_listener(c, np); memcpy(&p->conf, &np->conf, sizeof(p->conf)); + memcpy(&p->auth_conf, &np->auth_conf, sizeof(p->auth_conf)); RB_REMOVE(peer_head, &nc->peers, np); free(np); @@ -3706,7 +3725,7 @@ merge_peers(struct bgpd_config *c, struct bgpd_config *nc) RB_REMOVE(peer_head, &nc->peers, np); if (RB_INSERT(peer_head, &c->peers, np) != NULL) fatalx("%s: peer tree is corrupt", __func__); - if (np->conf.auth.method == AUTH_MD5SIG) + if (np->auth_conf.method == AUTH_MD5SIG) tcp_md5_add_listener(c, np); } } diff --git a/usr.sbin/bgpd/session.h b/usr.sbin/bgpd/session.h index 12e871eef..38c624cb8 100644 --- a/usr.sbin/bgpd/session.h +++ b/usr.sbin/bgpd/session.h @@ -1,4 +1,4 @@ -/* $OpenBSD: session.h,v 1.173 2024/09/04 13:30:10 claudio Exp $ */ +/* $OpenBSD: session.h,v 1.174 2024/10/01 11:49:24 claudio Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer @@ -163,6 +163,15 @@ struct peer_stats { char last_reason[REASON_LEN]; }; +struct auth_state { + struct bgpd_addr local_addr; + struct bgpd_addr remote_addr; + uint32_t spi_in; + uint32_t spi_out; + enum auth_method method; + uint8_t established; +}; + enum Timer { Timer_None, Timer_ConnectRetry, @@ -197,13 +206,8 @@ struct peer { struct capabilities peer; struct capabilities neg; } capa; - struct { - struct bgpd_addr local_addr; - uint32_t spi_in; - uint32_t spi_out; - enum auth_method method; - uint8_t established; - } auth; + struct auth_state auth_state; + struct auth_config auth_conf; struct bgpd_addr local; struct bgpd_addr local_alt; struct bgpd_addr remote; @@ -278,11 +282,14 @@ void mrt_done(struct mrt *); /* pfkey.c */ struct sadb_msg; int pfkey_read(int, struct sadb_msg *); -int pfkey_establish(struct peer *); -int pfkey_remove(struct peer *); +int pfkey_establish(struct auth_state *, struct auth_config *, + const struct bgpd_addr *, const struct bgpd_addr *); +int pfkey_remove(struct auth_state *); int pfkey_init(void); -int tcp_md5_check(int, struct peer *); -int tcp_md5_set(int, struct peer *); +int pfkey_send_conf(struct imsgbuf *, uint32_t, struct auth_config *); +int pfkey_recv_conf(struct peer *, struct imsg *); +int tcp_md5_check(int, struct auth_config *); +int tcp_md5_set(int, struct auth_config *, struct bgpd_addr *); int tcp_md5_prep_listener(struct listen_addr *, struct peer_head *); void tcp_md5_add_listener(struct bgpd_config *, struct peer *); void tcp_md5_del_listener(struct bgpd_config *, struct peer *); @@ -334,6 +341,7 @@ int imsg_ctl_parent(struct imsg *); int imsg_ctl_rde(struct imsg *); int imsg_ctl_rde_msg(int, uint32_t, pid_t); void session_stop(struct peer *, uint8_t, const char *); +struct bgpd_addr *session_localaddr(struct peer *); /* timer.c */ struct timer *timer_get(struct timer_head *, enum Timer); diff --git a/usr.sbin/pkg_add/OpenBSD/Log.pm b/usr.sbin/pkg_add/OpenBSD/Log.pm index 9eb45704e..79b381ad3 100644 --- a/usr.sbin/pkg_add/OpenBSD/Log.pm +++ b/usr.sbin/pkg_add/OpenBSD/Log.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: Log.pm,v 1.10 2023/06/13 09:07:17 espie Exp $ +# $OpenBSD: Log.pm,v 1.11 2024/10/01 18:48:29 tb Exp $ # # Copyright (c) 2007-2010 Marc Espie # @@ -104,7 +104,24 @@ sub fatal($self, @p) sub system($self, @p) { - if (open(my $grab, "-|", @p)) { + my ($todo, $todo2); + if (ref $p[0] eq 'CODE') { + $todo = shift @p; + } else { + $todo = sub() {}; + } + if (ref $p[0] eq 'CODE') { + $todo2 = shift @p; + } else { + $todo2 = sub() {}; + } + my $child_pid = open(my $grab, "-|"); + if (!defined $child_pid) { + $self->{p}->say("system(#1) was not run: #2 #3", + join(", ", @p), $!, $self->{p}->child_error); + } + if ($child_pid) { + &$todo2(); while (<$grab>) { $self->{p}->_print($_); } @@ -115,8 +132,9 @@ sub system($self, @p) } return $?; } else { - $self->{p}->say("system(#1) was not run: #2 #3", - join(", ", @p), $!, $self->{p}->child_error); + $DB::inhibit_exit = 0; + &$todo(); + exec {$p[0]} (@p) or exit 1; } } diff --git a/usr.sbin/pkg_add/pkg_add.1 b/usr.sbin/pkg_add/pkg_add.1 index 5a154bd22..120f904d9 100644 --- a/usr.sbin/pkg_add/pkg_add.1 +++ b/usr.sbin/pkg_add/pkg_add.1 @@ -1,4 +1,4 @@ -.\" $OpenBSD: pkg_add.1,v 1.167 2022/08/12 10:38:37 landry Exp $ +.\" $OpenBSD: pkg_add.1,v 1.168 2024/10/02 09:14:08 tb Exp $ .\" .\" Documentation and design originally from FreeBSD. All the code has .\" been rewritten since. We keep the documentation's notice: @@ -15,7 +15,7 @@ .\" Jordan K. Hubbard .\" .\" -.Dd $Mdocdate: August 12 2022 $ +.Dd $Mdocdate: October 2 2024 $ .Dt PKG_ADD 1 .Os .Sh NAME @@ -161,11 +161,6 @@ are defined, will use .Sq ./:installpath as a default. -Specifying -.Ql - -as a package name causes -.Nm -to read from the standard input. .Pp .Nm also understands @@ -288,7 +283,7 @@ dependencies with the list of packages left to install, then ask the user's opinion in interactive mode, then install default packages that satisfy the dependencies. .Pp -.Sy Warning: +.Sy Warning : Since .Nm may execute scripts or programs contained within a package file, diff --git a/usr.sbin/vmd/pci.c b/usr.sbin/vmd/pci.c index b159977f4..f606d9135 100644 --- a/usr.sbin/vmd/pci.c +++ b/usr.sbin/vmd/pci.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pci.c,v 1.34 2024/09/26 01:45:13 jsg Exp $ */ +/* $OpenBSD: pci.c,v 1.35 2024/10/02 17:05:56 dv Exp $ */ /* * Copyright (c) 2015 Mike Larkin @@ -73,7 +73,7 @@ pci_add_bar(uint8_t id, uint32_t type, void *barfn, void *cookie) /* Compute BAR address and add */ bar_reg_idx = (PCI_MAPREG_START + (bar_ct * 4)) / 4; if (type == PCI_MAPREG_TYPE_MEM) { - if (pci.pci_next_mmio_bar >= VMM_PCI_MMIO_BAR_END) + if (pci.pci_next_mmio_bar >= PCI_MMIO_BAR_END) return (1); pci.pci_devices[id].pd_cfg_space[bar_reg_idx] = @@ -216,7 +216,7 @@ pci_init(void) uint8_t id; memset(&pci, 0, sizeof(pci)); - pci.pci_next_mmio_bar = VMM_PCI_MMIO_BAR_BASE; + pci.pci_next_mmio_bar = PCI_MMIO_BAR_BASE; #ifdef __amd64__ pci.pci_next_io_bar = VM_PCI_IO_BAR_BASE; diff --git a/usr.sbin/vmd/pci.h b/usr.sbin/vmd/pci.h index 0b05a9298..8e36759aa 100644 --- a/usr.sbin/vmd/pci.h +++ b/usr.sbin/vmd/pci.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pci.h,v 1.11 2024/07/10 09:27:33 dv Exp $ */ +/* $OpenBSD: pci.h,v 1.12 2024/10/02 17:05:56 dv Exp $ */ /* * Copyright (c) 2015 Mike Larkin @@ -34,6 +34,9 @@ #define PCI_BAR_TYPE_IO 0x0 #define PCI_BAR_TYPE_MMIO 0x1 +#define PCI_MMIO_BAR_BASE 0xF0000000ULL +#define PCI_MMIO_BAR_END 0xFFDFFFFFULL /* 2 MiB below 4 GiB */ + #define PCI_MAX_PIC_IRQS 10 typedef int (*pci_cs_fn_t)(int dir, uint8_t reg, uint32_t *data); diff --git a/usr.sbin/vmd/x86_vm.c b/usr.sbin/vmd/x86_vm.c index 729e0c5f9..aa64ddb02 100644 --- a/usr.sbin/vmd/x86_vm.c +++ b/usr.sbin/vmd/x86_vm.c @@ -1,4 +1,4 @@ -/* $OpenBSD: x86_vm.c,v 1.4 2024/09/26 01:45:13 jsg Exp $ */ +/* $OpenBSD: x86_vm.c,v 1.5 2024/10/02 17:05:56 dv Exp $ */ /* * Copyright (c) 2015 Mike Larkin * @@ -192,7 +192,7 @@ create_memory_map(struct vm_create_params *vcp) /* If we have less than 2MB remaining, still create a 2nd BIOS area. */ if (mem_bytes <= MB(2)) { - vcp->vcp_memranges[2].vmr_gpa = VMM_PCI_MMIO_BAR_END; + vcp->vcp_memranges[2].vmr_gpa = PCI_MMIO_BAR_END; vcp->vcp_memranges[2].vmr_size = MB(2); vcp->vcp_memranges[2].vmr_type = VM_MEM_RESERVED; vcp->vcp_nmemranges = 3; @@ -204,8 +204,8 @@ create_memory_map(struct vm_create_params *vcp) * boundary while making sure we do not place physical memory into * MMIO ranges. */ - if (mem_bytes > VMM_PCI_MMIO_BAR_BASE - MB(1)) { - above_1m = VMM_PCI_MMIO_BAR_BASE - MB(1); + if (mem_bytes > PCI_MMIO_BAR_BASE - MB(1)) { + above_1m = PCI_MMIO_BAR_BASE - MB(1); above_4g = mem_bytes - above_1m; } else { above_1m = mem_bytes; @@ -218,13 +218,13 @@ create_memory_map(struct vm_create_params *vcp) vcp->vcp_memranges[2].vmr_type = VM_MEM_RAM; /* Fourth region: PCI MMIO range */ - vcp->vcp_memranges[3].vmr_gpa = VMM_PCI_MMIO_BAR_BASE; - vcp->vcp_memranges[3].vmr_size = VMM_PCI_MMIO_BAR_END - - VMM_PCI_MMIO_BAR_BASE + 1; + vcp->vcp_memranges[3].vmr_gpa = PCI_MMIO_BAR_BASE; + vcp->vcp_memranges[3].vmr_size = PCI_MMIO_BAR_END - + PCI_MMIO_BAR_BASE + 1; vcp->vcp_memranges[3].vmr_type = VM_MEM_MMIO; /* Fifth region: 2nd copy of BIOS above MMIO ending at 4GB */ - vcp->vcp_memranges[4].vmr_gpa = VMM_PCI_MMIO_BAR_END + 1; + vcp->vcp_memranges[4].vmr_gpa = PCI_MMIO_BAR_END + 1; vcp->vcp_memranges[4].vmr_size = MB(2); vcp->vcp_memranges[4].vmr_type = VM_MEM_RESERVED;