Compare commits

...
139 Commits
Author SHA1 Message Date
Gordon Tetlow f389e68ca9 Add UPDATING entries and bump version.
Approved by:	so
2025-02-20 21:45:32 -05:00
Ed Maste fe49460873 ssh: Bump VersionAddendum for CVE fixes
Security:	FreeBSD-SA-25:05.openssh
Approved by:	so
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 62df41ae0a)
(cherry picked from commit 24ce323f02)
2025-02-20 21:45:28 -05:00
Ed Maste 3053f92a16 ssh: Fix cases where error codes were not correctly set
Obtained from:	OpenSSH 38df39ecf278
Security:	CVE-2025-26465
Security:	FreeBSD-SA-25:05.openssh
Approved by:	so
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 170059d6d3)
(cherry picked from commit 4ad8c195cf)
2025-02-20 21:39:27 -05:00
Ed Maste 8d0540600b ssh: Don't reply to PING in preauth phase or during KEX
Obtained from:	OpenSSH 5e07dee272c3
Security:	CVE-2025-26466
Security:	FreeBSD-SA-25:05.openssh
Approved by:	so
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 8a16d0831e)
(cherry picked from commit 34798cb576)
2025-02-20 21:39:07 -05:00
Mark Johnston 89321a8f57 Add UPDATING entries and bump version
Approved by:	so
2025-01-29 18:46:31 +00:00
Mark Johnston b8945a926a etcupdate: Restrict access to the conflicts directory
In the window during conflict resolution, copies of installed files with
conflicts are added here with the default mode.  Restrict access.

Approved by:	so
Security:	FreeBSD-SA-25:03.etcupdate
PR:		277470
Reviewed by:	philip, jhb, emaste
Differential Revision:	https://reviews.freebsd.org/D48576

(cherry picked from commit c43ae7ab4b)
(cherry picked from commit 93836ff92b)
2025-01-29 17:13:21 +00:00
Ed Maste 88d5d81087 OpenSSH: correct logic error in ObscureKeystrokeTiming
Cherry-pick fix:
upstream: when sending ObscureKeystrokeTiming chaff packets, we
can't rely on channel_did_enqueue to tell that there is data to send. This
flag indicates that the channels code enqueued a packet on _this_ ppoll()
iteration, not that data was enqueued in _any_ ppoll() iteration in the
timeslice. ok markus@

OpenBSD-Commit-ID: 009b74fd2769b36b5284a0188ade182f00564136

Approved by:	so
Security:	FreeBSD-SA-25:01.openssh
Obtained from:	openssh-portable 146c420d29d0
Reviewed by:	gordon
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D45823

(cherry picked from commit b81424adf7)
(cherry picked from commit bf9a275b24)
2025-01-29 17:13:08 +00:00
Philip Paeps 40928c1241 contrib/tzdata: import tzdata 2025a
Changes: https://github.com/eggert/tz/blob/2025a/NEWS

Approved by:	so
Security:	FreeBSD-EN-25:03.tzdata

(cherry picked from commit 46226b0162)
(cherry picked from commit a158d26e89)
2025-01-29 17:12:52 +00:00
Philip Paeps 8635fea6ed contrib/tzdata: import tzdata 2024b
Changes: https://github.com/eggert/tz/blob/2024b/NEWS

Approved by:	so
Security:	FreeBSD-EN-25:03.tzdata

(cherry picked from commit e273650f2c)
(cherry picked from commit 7eb0b02bc4)
2025-01-29 17:12:35 +00:00
Rick Macklem c908660905 tarfs: Fix the size of struct tarfs_fid and add a static assert
File system specific *fid structures are copied into the generic
struct fid defined in sys/mount.h.
As such, they cannot be larger than struct fid.

This patch packs the structure and checks via a __Static_assert().

Approved by:	so
Security:	FreeBSD-SA-25:02.fs
Reviewed by:	markj
MFC after:	2 weeks

(cherry picked from commit 4db1b113b1)
(cherry picked from commit 155987e201)
2025-01-29 17:12:27 +00:00
Rick Macklem f2cc3336ad ext2fs: Fix the size of struct ufid and add a static assert
File system specific *fid structures are copied into the generic
struct fid defined in sys/mount.h.
As such, they cannot be larger than struct fid.

This patch packed the structure and checks via a __Static_assert().

Approved by:	so
Security:	FreeBSD-SA-25:02.fs
Reviewed by:	markj
MFC after:	2 weeks

(cherry picked from commit bfc8e3308b)
(cherry picked from commit 7a3a0402ae)
2025-01-29 17:12:14 +00:00
Mark Johnston d8083f5425 cd9660: Make sure that struct ifid fits in generic filehandle structure
File system specific *fid structures are copied into the generic
struct fid defined in sys/mount.h.
As such, they cannot be larger than struct fid.

This patch packs the structure and checks via a __Static_assert().

Approved by:	so
Security:	FreeBSD-SA-25:02.fs
Reported by:	Kevin Miller <[email protected]>
Reviewed by:	olce, imp, kib, emaste
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D47879

(cherry picked from commit 205659c43d)
(cherry picked from commit 54974e731f)
2025-01-29 17:11:57 +00:00
Mark Johnston 1574c53178 audit: Fix short-circuiting in syscallenter()
syscallenter() has a slow path to handle syscall auditing and dtrace
syscall tracing.  It uses AUDIT_SYSCALL_ENTER() to check whether to take
the slow path, but this macro also has side effects: it writes the audit
log entry.  When systrace (dtrace syscall tracing) is enabled, this
would get short-circuited, and we end up not writing audit log entries.

Introduce a pure macro to check whether auditing is enabled, use it in
syscallenter() instead of AUDIT_SYSCALL_ENTER().

Approved by:	so
Security:	FreeBSD-EN-25:02.audit
Reviewed by:	kib
Reported by:	Joe Duin <[email protected]>
Fixes:		2f7292437d ("Merge audit and systrace checks")
MFC after:	3 days
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D48448

(cherry picked from commit f78fe93085)
(cherry picked from commit 4b9ba274d7)
2025-01-29 17:11:43 +00:00
Rick Macklem 4fdb8d1ab3 svc.c: Check for a non-NULL xp_socket
Commit a16ff32f04 added support to the kernel RPC to set
TCP_USE_DDP.
However, for the unusual case of a NFSv4.1/4.2 non-NULL callback,
the xp_socket field of SVCXPRT is NULL, since it uses the same
socket as the client->server connection.

This patch adds the check for this to avoid crashes.

This only affects NFSv4.1/4.2 mounts where either pNFS or
delegations are in use.

Approved by:	so
Security:	FreeBSD-EN-25:01.rpc

(cherry picked from commit 6c9170e0af)
(cherry picked from commit 4c136aad80)
2025-01-29 17:11:29 +00:00
Ed Maste 74b6c98372 Add UPDATING entries and bump revision
EN-24:17.pam_xdg
SA-24:17.bhyve
SA-24:18.ctl
SA-24:19.fetch

Approved by:	so
2024-10-29 15:04:42 -04:00
Olivier Certner accf8cee6d pam_xdg: Fix user xdg runtime directory's descriptor leak
Approved by:    emaste (mentor)
Fixes:          6e69612d5d ("pam: Add pam_xdg module")
MFC after:      3 days
Security:	FreeBSD-EN-17.pam_xdg
Approved by:	so
Sponsored by:   The FreeBSD Foundation

(cherry picked from commit 06986e8999)
(cherry picked from commit 9e8d504bb5)
2024-10-29 14:56:03 -04:00
Franco Fichtner 0e8bf366e6 fetch: correct env var name for --crl option to work
Reviewed by:	grembo
MFC after:	3 days
Security:	FreeBSD-SA-24:19.fetch
Approved by:	so
Differential Revision: https://reviews.freebsd.org/D46973

(cherry picked from commit 1d7a33888e)
(cherry picked from commit 51676e0a3b)
2024-10-29 14:54:17 -04:00
Pierre Pronchery a8df235414 ctl: limit memory allocation in pci_virtio_scsi
The virtio_scsi device allows a VM guest to directly send SCSI commands
(ctsio->cdb array) to the kernel driver exposed on /dev/cam/ctl
(ctl.ko).

All kernel commands accessible from the guest are defined by
ctl_cmd_table.

The command ctl_persistent_reserve_out (cdb[0]=0x5F and cbd[1]=0) allows
the caller to call malloc() with an arbitrary size (uint32_t). This can
be used by the guest to overload the kernel memory (DOS attack).

Reported by:    Synacktiv
Reviewed by:	asomers
Security:       HYP-08
Security:	FreeBSD-SA-24:18.ctl
Approved by:	so
Sponsored by:   The Alpha-Omega Project
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D46044

(cherry picked from commit 64b0f52be2)
(cherry picked from commit 2e7f4728fa)
2024-10-29 14:44:17 -04:00
Chuck Tuffli fcd9a2d8a5 bhyve/nvme: Fix Infinite loop in queue processing
In the functions pci_nvme_handle_admin_cmd and pci_nvme_handle_io_cmd
infinite loops are possible in the bhyve process if the sq->tail value
is greater than sq->size.

An attacker could overload the host CPU.

Fix is to validate that doorbell values:
 - Are for a valid (i.e., created) queue
 - Are not the same as the previous value
 - Fit within the available capacity

The emulation will generate an Asynchronous Event Notification (Invalid
Doorbell or Invalid Doorbell Value) if enabled and ignore the doorbell
update.

While in the neighborhood, remove a redundant bounds check.

Reported by:	Synacktiv
MFC after:	1 week
Security:	HYP-14
Security:	FreeBSD-SA-24:17.bhyve
Approved by:	so
Sponsored by:	Alpha-Omega Project
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D46064

(cherry picked from commit 5374b9e146)
(cherry picked from commit 86ba5941b1)
2024-10-29 14:44:00 -04:00
Pierre Pronchery 538cb37f51 bhyve: improve bounds checks in hda_codec
The function hda_codec_command is vulnerable to buffer over-read, the
payload value is extracted from the command and used as an array index
without any validation.
Fortunately, the payload value is capped at 255, so the information
disclosure is limited and only a small part of .rodata of bhyve binary
can be disclosed.

The risk is low because the leaked information is not sensitive. An
attacker may be able to validate the version of the bhyve binary using
this information disclosure (layout of .rodata information, ex:
jmp_tables) before executing an exploit.

Reported by:	Synacktiv
Reviewed by:	christos, emaste
Security:	HYP-13
Security:	FreeBSD-SA-24:17.bhyve
Approved by:	so
Sponsored by:	The Alpha-Omega Project
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D46098

(cherry picked from commit e94a1d6a7f)
(cherry picked from commit 757bbf484c)
2024-10-29 14:43:47 -04:00
Ed Maste 6acac2ca9a bhyve: validate corb->wp to avoid infinite loop
Guests must set HDAC_CORBWP less than corb->size.  Treat invalid values
as an error rather than entering an infinite loop.

Reported by:	Synacktiv
Reviewed by:	markj
Security:	HYP-12
Security:	FreeBSD-SA-24:17.bhyve
Approved by:	so
Sponsored by:	The Alpha-Omega Project
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D46134

(cherry picked from commit a305f44d14)
(cherry picked from commit 6a645bb353)
2024-10-29 14:43:34 -04:00
Pierre Pronchery 9b11b88940 bhyve: avoid TOCTOU on iov_len in virtio_vq_recordon()
Avoid a race condition when accessing guest memory, by reading memory
contents only once.

This has also been applied to _vq_record() in
sys/dev/beri/virtio/virtio.c, as per markj@'s suggestion.

Reported by:	Synacktiv
Reviewed by:	markj
Security:	HYP-10
Security:	FreeBSD-SA-24:17.bhyve
Approved by:	so
Sponsored by:	The Alpha-Omega Project
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D45735

(cherry picked from commit 869d760cb9)
(cherry picked from commit ed03c30990)
2024-10-29 14:43:16 -04:00
Chuck Tuffli 97a933932e bhyve/nvme: Fix out-of-bounds read in NVMe log page
The function nvme_opc_get_log_page in the file usr.sbin/bhyve/pci_nvme.c
is vulnerable to buffer over-read. The value logoff is user controlled
but never checked against the value of logsize. Thus the difference:
	logsize - logoff
can underflow.

Due to the sc structure layout, an attacker can dump internals fields of
sc and the content of next heap allocation.

Reported by:	Synacktiv
Reviewed by:	emaste, jhb
Security:	HYP-07
Security:	FreeBSD-SA-24:17.bhyve
Approved by:	so
Sponsored by:	Alpha-Omega Project
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D46021

(cherry picked from commit b0a24be007)
(cherry picked from commit a5be19efbb)
2024-10-29 14:41:42 -04:00
Gordon Tetlow 524a425d30 Add UPDATING entries and bump revision.
Approved by:	so
2024-09-19 14:18:19 +01:00
Mariusz Zaborski f67468e6e5 libnv: correct the calculation of the structure's size
Reported by:	Milosz Kaniewski <[email protected]>
Approved by:	so
Security:	FreeBSD-SA-24:16.libnv
Security:	CVE-2024-45287

(cherry picked from commit 7f4731ab67)
(cherry picked from commit 056c50c48b)
2024-09-19 14:10:29 +01:00
Pierre Pronchery 3c6c0dcb5a bhyve: improve input validation in pci_xhci
Several functions did not validate the slot index resulting in OOB read
on the heap of the slot device structure which could lead to arbitrary
reads/writes and potentially code execution.

Reported by:	Synacktiv
Reviewed by:	markj (earlier), jhb
Approved by:	so
Security:	FreeBSD-SA-24:15.bhyve
Security:	CVE-2024-41721
Security:	HYP-02
Sponsored by:	The Alpha-Omega Project
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D45996

(cherry picked from commit e72d86ad9c)
(cherry picked from commit 419da61f82)
2024-09-19 14:07:18 +01:00
Kristof Provost 1e965d5399 pf: rework pf_icmp_state_lookup() failure mode
If pf_icmp_state_lookup() finds a state but rejects it for not matching the
expected direction we should unlock the state (and NULL out *state). This
simplifies life for callers, and also ensures there's no confusion about what a
non-NULL returned state means.

Previously it could have been left in there by the caller, resulting in callers
unlocking the same state twice.

Approved by:	so
Security:	FreeBSD-EN-24:16.pf
MFC after:	1 week
Sponsored by:	Rubicon Communications, LLC ("Netgate")

(cherry picked from commit 0578fe4922)
(cherry picked from commit 38f74de718)
2024-09-19 12:55:55 +00:00
Kristof Provost 94c6c986f3 pf: be less strict about icmp state checking for sloppy state tracking
Sloppy state tracking renders ICMP direction check useless
and harmful as we might see only half of the connection in
the asymmetric setups but ignore the state match.  The bug
was reported and fix was verified by Insan Praja <insan ()
ims-solusi ! com>.  Thanks!  OK mcbride, henning

Approved by:	so
Security:	FreeBSD-EN-24:16.pf
MFC after:	1 week
Obtained from:	OpenBSD, mikeb <[email protected]>, 538596657140
Sponsored by:	Rubicon Communications, LLC ("Netgate")

(cherry picked from commit 3da3eb6081)
(cherry picked from commit b822e3fab4)
2024-09-19 12:55:44 +00:00
Kristof Provost 95a1a22a83 pf: try to lookup the icmp state based on a correct packet descriptor
Approved by:	so
Security:	FreeBSD-EN-24:16.pf
MFC after:	1 week
Obtained from:	OpenBSD, mikeb <[email protected]>, e467ea25dcd3
Sponsored by:	Rubicon Communications, LLC ("Netgate")

(cherry picked from commit b8cd169efa)
(cherry picked from commit f40b0e7351)
2024-09-19 12:55:33 +00:00
Kristof Provost fdc0afd439 pf: improve the ICMPv6 direction check
Following bluhm's advice this changes the way we setup state keys and
perform state lookups for ICMPv6 Neighbor Discovery packets:
  - replace the NS-dst with ND target address;
  - replace the NA-src with ND target address;
  - replace the NA-dst with unspecified address if it is a multicast.

This allows pf to match Address Resolution, Neighbor Unreachability
Detection and Duplicate Address Detection packets to the corresponding
states without the need to create new ones or match unrelated ones.
As a side effect we're doing now one state table lookup for ND packets
instead of two.

Fixes a bug uncovered by one of the previous commits that virtually
breaks IPv6 connectivity after few minutes of use.

ok stsp henning, with and ok bluhm

Approved by:	so
Security:	FreeBSD-EN-24:16.pf
PR:		280701
MFC after:	1 week
Obtained from:	OpenBSD, mikeb <[email protected]>, 2633ae8c4c8a
Sponsored by:	Rubicon Communications, LLC ("Netgate")

(cherry picked from commit 5ab1e5f7e5)
(cherry picked from commit 0121a4baac)
2024-09-19 12:55:21 +00:00
Kristof Provost 84b57a4c5b pf: invert direction for inner icmp state lookups
(e.g. traceroute with icmp)
ok henning, jsing

Also extend the test case to cover this scenario.

Approved by:	so
Security:	FreeBSD-EN-24:16.pf
PR:		280701
Obtained from:	OpenBSD
MFC after:	1 week
Sponsored by:	Rubicon Communications, LLC ("Netgate")

(cherry picked from commit 89f6723288)
(cherry picked from commit 46c4fc50d3)
2024-09-19 12:55:09 +00:00
Kristof Provost fb925cf0a4 pf: fix icmp-in-icmp state lookup
In 534ee17e6 pf state checking for ICMP(v6) was made stricter. This change
failed to correctly set the pf_pdesc for ICMP-in-ICMP lookups, resulting in ICMP
error packets potentially being dropped incorrectly.
Specially, it copied the ICMP header into a separate variable, not into the
pf_pdesc.

Populate the required pf_pdesc fields for the embedded ICMP packet's state lookup.

Approved by:	so
Security:	FreeBSD-EN-24:16.pf
PR:		280701
MFC after:	1 week
Sponsored by:	Rubicon Communications, LLC ("Netgate")

(cherry picked from commit 2da98eef1f)
(cherry picked from commit 27a1a56b0d)
2024-09-19 12:54:47 +00:00
Kyle Evans 86d01789bf calendar: don't setlogin(2) in the -a user handlers
As of e67975d331 ("Fix 'calendar -a' in several ways."), `calendar -a`
will now fork off a new process for each user and do all of its own
processing in the user's own context.

As a side-effect, calendar(1) started calling setlogin(2) in each of the
forked processes and inadvertently hijacked the login name for the
session it was running under, which was typically not a fresh session
but rather that of whatever cron/periodic run spawned it.  Thus, daily
and security e-mails started coming from completely arbitrary user.

We could create a new session, but it appears that nothing calendar(1)
does really needs the login name to be clobbered; opt to just avoid the
setlogin(2) call entirely rather than incur the overhead of a new
session for each process.

PR:		280418
Reviewed by:	des, olce
Fixes:		e67975d331 ("Fix 'calendar -a' in several ways.")

(cherry picked from commit 6cb8b61efe)
(cherry picked from commit 33708452aa)

Approved by:	so
2024-09-04 14:31:57 -07:00
Ed Maste 57d27c4dc3 Add UPDATING entries and bump revision
EN-24:15.calendar
SA-24:09.libnv
SA-24:10.bhyve
SA-24:11.ctl
SA-24:12.bhyve
SA-24:13.openssl
SA-24:14.umtx

Approved by:	so
2024-09-04 20:46:55 +00:00
Olivier Certner f4a2dbb816 umtx: shm: 'ushm_refcnt > 0' => 'ushm_refcnt != 0'
'ushm_refcnt' is unsigned.  Don't leave the impression it isn't.

No functional change (intended).

Reviewed by:    kib
Approved by:    emaste (mentor)
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D46126

(cherry picked from commit c75a18905e)
(cherry picked from commit 4938f55446)

Approved by:	so
2024-09-04 20:46:55 +00:00
Olivier Certner a89b6e8cc7 umtx: shm: Prevent reference counting overflow
This hardens against provoked use-after-free occurences should there be
reference counting leaks in the future (which is currently not the
case).

At the deepest level, umtx_shm_find_reg_unlocked() now returns EOVERFLOW
when it cannot grant an additional reference to the registry object, and
so will umtx_shm_find_reg().  umtx_shm_create_reg() will fail if calling
umtx_shm_find_reg() returns EOVERFLOW (meaning a SHM object for the
passed key already exists, but we can't acquire another reference on
it), avoiding the creation of a duplicate registry entry for a given key
(this wouldn't pose problem for the rest of the code in its current
form, but is expressly avoided for intelligibility and hardening
purposes).

Since umtx_shm_find_reg*(), and consequently the whole _umtx_op() system
call, can only return EOVERFLOW on such a bug manifesting, we don't
document that return value.

Reviewed by:    kib, emaste
Approved by:    emaste (mentor)
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D46126

(cherry picked from commit c3e6dfe55c)
(cherry picked from commit b20ae16087)

Approved by:	so
2024-09-04 20:46:55 +00:00
Olivier Certner 094bd6281f umtx: shm: Fix use-after-free due to multiple drops of the registry reference
umtx_shm_unref_reg_locked() would unconditionally drop the "registry"
reference, tied to USHMF_LINKED.

This is not a problem for caller umtx_shm_object_terminated(), which
operates under the 'umtx_shm_lock' lock end-to-end, but it is for
indirect caller umtx_shm(), which drops the lock between
umtx_shm_find_reg() and the call to umtx_shm_unref_reg(true) that
deregisters the umtx shared region (from 'umtx_shm_registry';
umtx_shm_find_reg() only finds registered shared mutexes).

Thus, two concurrent user-space callers of _umtx_op() with UMTX_OP_SHM
and flags UMTX_SHM_DESTROY, both progressing past umtx_shm_find_reg()
but before umtx_shm_unref_reg(true), would then decrease twice the
reference count for the single reference standing for the shared mutex's
registration.

Reported by:    Synacktiv
Reviewed by:    kib
Approved by:    emaste (mentor)
Security:	FreeBSD-SA-24:14.umtx
Security:	CVE-2024-43102
Security:       CAP-01
Sponsored by:   The Alpha-Omega Project
Sponsored by:	The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D46126

(cherry picked from commit 62f40433ab)
(cherry picked from commit be7dc46139)

Approved by:	so
2024-09-04 20:46:54 +00:00
Olivier Certner 2e27b82531 umtx: shm: Collapse USHMF_REG_LINKED and USHMF_OBJ_LINKED flags
...into the only USHMF_LINKED, as they are always set or unset together.

This is both to stop giving the impression that they can be set/unset
independently, which they can't with the current code, and to make it
clearer that an upcoming reference counting fix is correct.

Reviewed by:    kib
Approved by:    emaste (mentor)
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D46126

(cherry picked from commit dd83da532c)
(cherry picked from commit 2d4511bb81)

Approved by:	so
2024-09-04 20:46:54 +00:00
Viktor Dukhovni 9a5a7c90d5 openssl: Avoid type errors in EAI-related name check logic.
The incorrectly typed data is read only, used in a compare operation, so
neither remote code execution, nor memory content disclosure were possible.
However, applications performing certificate name checks were vulnerable to
denial of service.

The GENERAL_TYPE data type is a union, and we must take care to access the
correct member, based on `gen->type`, not all the member fields have the same
structure, and a segfault is possible if the wrong member field is read.

The code in question was lightly refactored with the intent to make it more
obviously correct.

Security:	CVE-2024-6119
Obtained from:	OpenSSL Project

(cherry picked from commit 1486960d6cdb052e4fc0109a56a0597b4e902ba1)
(cherry picked from commit 5946b0c6cb)

Approved by:	so
2024-09-04 20:46:54 +00:00
Pierre Pronchery bb245c1420 bhyve: fix off by one error in pci_xhci
The function pci_xhci_find_stream validates that the streamid is valid
but the bound check accepts up to ep_MaxPStreams included.

The bug results in an out-of-bounds write on the heap with controlled
data.

Reported by:	Synacktiv
Reviewed by:	jhb
Security:	FreeBSD-SA-24:12.bhyve
Security:	CVE-2024-32668
Security:	HYP-04
Sponsored by:	The Alpha-Omega Project
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D45994

(cherry picked from commit 5c9308a413)
(cherry picked from commit 90af1336ed)

Approved by:	so
2024-09-04 20:46:54 +00:00
Ed Maste d30ffde080 ctl: avoid heap info leak in ctl_request_sense
Previously 3 bytes of data from the heap could be leaked to ctl
consumers.

Reported by:	Synacktiv
Reviewed by:	asomers, mav
Sponsored by:	The Alpha-Omega Project
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D46091

(cherry picked from commit db87c98168)
(cherry picked from commit 131b7dcb2f)

Approved by:	so
2024-09-04 20:46:54 +00:00
Pierre Pronchery 1c87288280 ctl: fix Out-Of-Bounds access in ctl_report_supported_opcodes
This vulnerability is directly accessible to a guest VM through the
pci_virtio_scsi bhyve device.

In the function ctl_report_supported_opcodes() accessible from the VM,
the option RSO_OPTIONS_OC_ASA does not check the requested
service_action value before accessing &ctl_cmd_table[].

Reported by:	Synacktiv
Reviewed by:	asomers
Security:	FreeBSD-SA-24:11.ctl
Security:	CVE-2024-42416
Security:	HYP-06
Sponsored by:	The Alpha-Omega Project
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D46027

(cherry picked from commit af438acbfd)
(cherry picked from commit 803e0c2ab2)

Approved by:	so
2024-09-04 20:46:54 +00:00
Pierre Pronchery 235b93d39d ctl: fix memory disclosure in read/write buffer commands
The functions ctl_write_buffer() and ctl_read_buffer() are vulnerable to
a kernel memory disclosure caused by an uninitialized kernel allocation.
If one of these functions is called for the first time for a given LUN, a
kernel allocation is performed without the M_ZERO flag. Then a call to
ctl_read_buffer() returns the content of this allocation, which may
contain kernel data.

Reported by:	Synacktiv
Reviewed by:	asomers
Reviewed by:	jhb
Security:	FreeBSD-SA-24:11.ctl
Security:	CVE-2024-8178
Security:	HYP-05
Sponsored by:	The Alpha-Omega Project
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D45952

(cherry picked from commit ea44766b78)
(cherry picked from commit cdfdb3b008)

Approved by:	so
2024-09-04 20:46:54 +00:00
Alan Somers 31d839d66e ctl: fix Use-After-Free in ctl_write_buffer
The virtio_scsi device allows a guest VM to directly send SCSI commands
to the kernel driver exposed on /dev/cam/ctl. This setup makes the
vulnerability directly accessible from VMs through the pci_virtio_scsi
bhyve device.

The function ctl_write_buffer sets the CTL_FLAG_ALLOCATED flag, causing
the kern_data_ptr to be freed when the command finishes processing.
However, the buffer is still stored in lun->write_buffer, leading to a
Use-After-Free vulnerability.

Since the buffer needs to persist indefinitely, so it can be accessed by
READ BUFFER, do not set CTL_FLAG_ALLOCATED.

Reported by:	Synacktiv
Reviewed by:	Pierre Pronchery <[email protected]>
Reviewed by:	jhb
Security:	FreeBSD-SA-24:11.ctl
Security:	CVE-2024-45063
Security:	HYP-03
Sponsored by:	Axcient
Sponsored by:	The Alpha-Omega Project
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D46424

(cherry picked from commit 670b582db6)
(cherry picked from commit 29937d7a1a)

Approved by:	so
2024-09-04 20:46:54 +00:00
Pierre Pronchery eab723be75 bhyve: fix Out-Of-Bounds read/write heap in tpm_ppi_mem_handler
The function tpm_ppi_mem_handler is vulnerable to buffer over-read and
over-write, the MMIO handler serves the heap allocated structure
tpm_ppi_qemu.
The issue is that the structure size is smaller than 0x1000 and the
handler does not validate the offset and size (sizeof is 0x15A while the
handler allows up to 0x1000 bytes)

Reported by:	Synacktiv
Reviewed by:	corvink
Security:	FreeBSD-SA-24:10.bhyve
Security:	CVE-2024-41928
Security:	HYP-01
Sponsored by:	The Alpha-Omega Project
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D45980

(cherry picked from commit a06fc21e77)
(cherry picked from commit 6ce4821f08)

Approved by:	so
2024-09-04 20:46:54 +00:00
Mariusz Zaborski d87f821959 libnv: verify that string is null terminated
During unpacking, we ensure that we do not read beyond the
declared size. However, unpack uses a function that copies
null-terminated strings. Prior to this commit, if the last string
was not null-terminated, it could result in copying data into a
buffer smaller than the allocated size.

Security:       FreeBSD-24:09.libnv
Security:       CVE-2024-45288
Security:       CAP-03
Reported by:    Synacktiv
Sponsored by:   The Alpha-Omega Project
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D46138

(cherry picked from commit 3aaaca1b51)
(cherry picked from commit 9c2ef10216)

Approved by:	so
2024-09-04 20:46:46 +00:00
Mariusz Zaborski 5fd7301afa libnv: allocate buffer in a safe way
Ensure that the calculation of size of array doesn't
overflow.

Security:	FreeBSD-24:09.libnv
Security:	CVE-2024-45287
Security:	CAP-02
Reported by:	Synacktiv
Reported by:	Taylor R Campbell (NetBSD)
Sponsored by:	The Alpha-Omega Project
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D46131

(cherry picked from commit 36fa90dbde)
(cherry picked from commit 371af89975)

Approved by:	so
2024-09-04 20:46:06 +00:00
Mark Johnston 1a207e5cdf Add UPDATING entries and bump the branch version
Approved by:	so
2024-08-07 13:43:30 +00:00
Mark Johnston 22d04990ce ktrace: Fix an inverted privilege check
Approved by:	so
Security:	FreeBSD-SA-24:06.ktrace
Security:	CVE-2024-6760
Fixes:	1762f674cc ("ktrace: pack all ktrace parameters into allocated structure ktr_io_params")

(cherry picked from commit 166b7573b5)
(cherry picked from commit 8b400c8488)
2024-08-07 13:43:27 +00:00
Michael Gmelin b9115dba07 ifconfig: Fix default netmask calculation
Approved by:	so
Security:	FreeBSD-EN-24:14.ifconfig
Reported by:	phk
Reviewed by:	emaste, kp
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D45570

(cherry picked from commit 8a9f0fa42b)
(cherry picked from commit 048ad7a9ef)
2024-08-07 13:32:56 +00:00
Ed Maste 4504250892 sshd: remove blacklist call from grace_alarm_timer
Under certain circumstances it may call log(3), which is not async-
signal-safe.

For now just remove the blacklist integration from this path, which
means that blacklistd will not detect and firewall hosts that establish
a connection but do nothing further.

Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D46203

(cherry picked from commit 2739a68450)
(cherry picked from commit 3d3bae9b95)

Approved by:	so
Security:	FreeBSD-SA-24:08.openssh
Security:	CVE-2024-7589

(cherry picked from commit 73466449a9)
2024-08-07 13:32:25 +00:00
Kristof Provost a66d33fcf3 pf: allow MLD LR to be sent without state
Change PF behavior to allow MLD Listener Report packets to be sent
without needing a previously created state by MLD Listener Query. It
wasn't working because: (1) you might not have a previous MLD Listener
Query and (2) the addresses of the Query and Report don't match.

ok mikeb@, sashan@

Approved by:	so
Security:	FreeBSD-SA-24:05.pf
Security:	CVE-2024-6640
MFC after:	1 day
Obtained From:	OpenBSD, rzalamena <[email protected]>, 5c526dbdb0f2
Sponsored by:	Rubicon Communications, LLC ("Netgate")

(cherry picked from commit 1afe4da75d)
(cherry picked from commit 3382c691dc)
2024-08-07 13:32:20 +00:00
Kristof Provost 6979b4db10 pf: split ICMP/ICMPv6 number space in pf_icmp_mapping()
In pf_icmp_mapping() the ICMP and ICMPv6 types shared the same
number space.  In fact they are independent and must be handled
separately.  Fix traceroute via pf by splitting pf_icmp_mapping()
into IPv4 and IPv6 sections.
ok henning@ mcbride@; tested mcbride@; sure deraadt@

Approved by:	so
Security:	FreeBSD-SA-24:05.pf
Security:	CVE-2024-6640
MFC after:      1 day
Obtained From:  OpenBSD, bluhm <[email protected]> ef4bccd7509e
Sponsored by:   Rubicon Communications, LLC ("Netgate")

(cherry picked from commit 46755f5224)
(cherry picked from commit 7f77305a5b)
2024-08-07 13:32:12 +00:00
Kristof Provost c95f99c0ab pf: some ICMP types that also have icmp_id, pointed out by markus@
ok henning markus

Approved by:	so
Security:	FreeBSD-SA-24:05.pf
Security:	CVE-2024-6640
MFC after:	1 day
Obtained From:	OpenBSD, mcbride <[email protected]> 8c0632cd274b
Sponsored by:	Rubicon Communications, LLC ("Netgate")

(cherry picked from commit e296b0de9e)
(cherry picked from commit c5081b8d39)
2024-08-07 13:32:00 +00:00
Kristof Provost 370e196bae pf: stricter state checking for ICMP and ICMPv6 packets
Include
the ICMP type in one port of the state key, using the type to determine which
side should be the id, and which should be the type.

Also:
- Handle ICMP6 messages which are typically sent to multicast addresses but
 recieve unicast replies, by doing fallthrough lookups against the correct
 multicast address.
- Clear up some mistaken assumptions in the PF code:
  - Not all ICMP packets have an icmp_id, so simulate one based on other
    data if we can, otherwise set it to 0.
 - Don't modify the icmp id field in NAT unless it's echo
 - Use the full range of possible id's when NATing icmp6 echoy

ok henning marco
testing matthieu todd

Approved by:	so
Security:	FreeBSD-SA-24:05.pf
Security:	CVE-2024-6640
MFC after:	1 day
Obtained From:	OpenBSD, mcbride <[email protected]> 70bf7555ef4c
Sponsored by:	Rubicon Communications, LLC ("Netgate")

(cherry picked from commit 534ee17e61)
(cherry picked from commit 2f6b4611b5)
2024-08-07 13:31:39 +00:00
Rick Macklem 8533e927af nfscl: Scan readdir reply filenames for invalid characters
The NFS RFCs are pretty loose with respect to what characters
can be in a filename returned by a Readdir.  However, FreeBSD,
as a POSIX system will not handle imbedded '/' or nul characters
in file names.  Also, for NFSv4, the file names "." and ".."
are handcrafted on the client and should not be returned by a
NFSv4 server.

This patch scans for the above in filenames returned by Readdir and
ignores any entry returned by Readdir which has them in it.
Because an imbedded nul would be a string terminator, it was
not possible to code this check efficiently using string(3)
functions.

Approved by:	so
Security:	FreeBSD-SA-24:07.nfsclient
Security:	CVE-2024-6759
Reported by:	Apple Security Engineering and Architecture (SEAR)

(cherry picked from commit 026cdaa3b3)
(cherry picked from commit 9328ded386)
2024-08-07 13:30:29 +00:00
Philip Paeps dcdea9e862 UPDATING: correct typo in branch version
The most recent update was 14.1-RELEASE-p2, not 14.1-RELEASE-p1.

Reported by:	Graham Perrin
Approved by:	so
2024-07-05 11:26:59 +08:00
Philip Paeps 1eba659e2f Add UPDATING entries and bump the branch version.
Approved by:	so
2024-07-01 16:50:42 +08:00
Philip Paeps 8f80def8aa openssh: Fix pre-authentication remote code execution in sshd.
Reported by:	Qualys Threat Research Unit (TRU)
Approved by:	so
Security:	FreeBSD-SA-24:04.openssh
Security:	CVE-2024-6387

(cherry picked from commit 2abea9df01)
(cherry picked from commit 620a6a54bb)
2024-07-01 16:23:50 +08:00
Gordon Tetlow 0892dff104 Add UPDATING entries and bump the branch version.
Approved by:    so
2024-06-19 13:22:12 -07:00
Dimitry Andric 8e0e6b428c Merge commit 382f70a877f0 from llvm-project (by Louis Dionne):
[libc++][NFC] Rewrite function call on two lines for clarity (#79141)

  Previously, there was a ternary conditional with a less-than comparison
  appearing inside a template argument, which was really confusing because
  of the <...> of the function template. This patch rewrites the same
  statement on two lines for clarity.

Merge commit d129ea8d2fa3 from llvm-project (by Vitaly Buka):

  [libcxx] Align `__recommend() + 1`  by __endian_factor (#90292)

  This is detected by asan after #83774

  Allocation size will be divided by `__endian_factor` before storing. If
  it's not aligned,
  we will not be able to recover allocation size to pass into
  `__alloc_traits::deallocate`.

  we have code like this
  ```
   auto __allocation = std::__allocate_at_least(__alloc(), __recommend(__sz) + 1);
      __p               = __allocation.ptr;
      __set_long_cap(__allocation.count);

  void __set_long_cap(size_type __s) _NOEXCEPT {
      __r_.first().__l.__cap_     = __s / __endian_factor;
      __r_.first().__l.__is_long_ = true;
    }

  size_type __get_long_cap() const _NOEXCEPT {
      return __r_.first().__l.__cap_ * __endian_factor;
    }

  inline ~basic_string() {
      __annotate_delete();
      if (__is_long())
        __alloc_traits::deallocate(__alloc(), __get_long_pointer(), __get_long_cap());
    }
  ```
  1. __recommend() -> even size
  2. `std::__allocate_at_least(__alloc(), __recommend(__sz) + 1)` - > not
  even size
  3. ` __set_long_cap() `- > lose one bit of size for __endian_factor == 2
  (see `/ __endian_factor`)
  4. `__alloc_traits::deallocate(__alloc(), __get_long_pointer(),
  __get_long_cap())` -> uses even size (see `__get_long_cap`)

This should fix incorrect deallocation sizes for some instances of
std::string. Memory profiling or debugging tools like AddressSanitizer,
LeakSanitizer or TCMalloc could then complain about the the size passed
to a deallocation not matching the size originally passed to the
allocation.

Reported by:	Aliaksei Kandratsenka <[email protected]>
PR:		279560
Approved by:	so
Security:	FreeBSD-EN-24:13.libc++

(cherry picked from commit ead8e4c081)
(cherry picked from commit 55c5dad2f3)
2024-06-18 10:36:40 -07:00
Alexander Motin f566b7eb8d Destroy ARC buffer in case of fill error
In case of error dmu_buf_fill_done() returns the buffer back into
DB_UNCACHED state.  Since during transition from DB_UNCACHED into
DB_FILL state dbuf_noread() allocates an ARC buffer, we must free
it here, otherwise it will be leaked.

Reviewed-by: Brian Behlendorf <[email protected]>
Reviewed-by: Jorgen Lundman <[email protected]>
Signed-off-by: Alexander Motin <[email protected]>
Sponsored by: iXsystems, Inc.
Closes #15665
Closes #15802
Closes #16216

PR:	276341
Approved by:	so
Security:	FreeBSD-EN-24:10.zfs

(cherry picked from commit 02c5aa9b09)
(cherry picked from commit 1c27279ed2)
2024-06-18 10:35:52 -07:00
Colin Percival 10e31f0946 Update in preparation for 14.1-RELEASE
- Bump BRANCH to RELEASE
- Add the anticipated RELEASE announcement date
- Set a static __FreeBSD_version

Approved by:    re (implicit)
Sponsored by:   https://www.patreon.com/cperciva
2024-05-30 17:31:16 -07:00
Colin Percival 4de43de58f 14.1: update to RC1
Now that we're at RC1, switch from "quarterly" packages to the release
package set.

Approved by:	re (implicit)
2024-05-23 17:10:09 -07:00
Colin Percival 8f7da18ea2 Modernize DVD package set in preparation for 14.1
Remove archivers/unzip (now in base) and emulators/linux_base-c7 (old
and unlikely to be useful without other linux packages being installed),
ports-mgmt/portmaster (now largely obsolete and discouraged in favour
of using pkg and binary packages) and x11-drivers/xf86-video-vmware
(questionably useful).

Replace devel/git with devel/git@lite (sufficient for most purposes),
and adjust the "ensure the ports exist to sanitize the list" code to
ignore the @lite part when checking that /usr/ports/devel/git exists.

Add sysutils/seatd and x11-wm/sway for wayland support.

Approved by:	re (cperciva)
MFC after:	1 minute
Differential Revision:	https://reviews.freebsd.org/D45278

(cherry picked from commit d31ed58b9f)
(cherry picked from commit 0543cdc36a)
2024-05-23 17:08:37 -07:00
Graham Perrin cf1e3e15dd pkg-stage.sh: add x11/sddm
Approved by:	re (cperciva)
MFC After: 2 days
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/996

(cherry picked from commit 5ff76402da)
(cherry picked from commit 9317a4a3a8)
2024-05-23 17:08:22 -07:00
Alexander Motin 856d353372 Fix scn_queue races on very old pools
Code for pools before version 11 uses dmu_objset_find_dp() to scan
for children datasets/clones.  It calls enqueue_clones_cb() and
enqueue_cb() callbacks in parallel from multiple taskq threads.
It ends up bad for scan_ds_queue_insert(), corrupting scn_queue
AVL-tree.  Fix it by introducing a mutex to protect those two
scan_ds_queue_insert() calls.  All other calls are done from the
sync thread and so serialized.

Reviewed-by:	Brian Behlendorf <[email protected]>
Reviewed-by:	Brian Atkinson <[email protected]>
Signed-off-by:	Alexander Motin <[email protected]>
Sponsored by:	iXsystems, Inc.
Closes	#16162
PR:	278414
Approved by:	re (cperciva)

(cherry picked from commit 49086aa35d)
(cherry picked from commit 455ce17293)
2024-05-23 14:11:36 -04:00
Mariusz Zaborski 309946854f geli: allocate a UMA pool earlier
The functions g_eli_init_uma and g_eli_fini_uma are used to trace
the number of devices in GELI. There is an issue where the g_eli_create
function may fail before g_eli_init_uma is called, however
g_eli_fini_uma is still executed in the fail path. This can
incorrectly decrease the device count to zero, potentially leading to
the UMA pool being freed. Accessing the device after the pool has been
freed causes a system panic.

This commit resolves the issue by ensuring devices count is increassed
eariler.

PR:		278828
Reported by:	Andre Albsmeier <[email protected]>
Reviewed by:	asomers
MFC after:	3 days
Approved by:	re (cperciva)
Differential Revision:	https://reviews.freebsd.org/D45225

(cherry picked from commit 4b3141f5d5)
(cherry picked from commit ea5a708625)
2024-05-23 10:07:19 +02:00
Jeremy Collin 3b9c88fa99 fix (nuageinit): SSH keys are not handled in metadata but in userdata
MFC After: 1 day
Approved by:	re (cperciva)

(cherry picked from commit 48edad2edf)
(cherry picked from commit 5601feb720)
2024-05-23 09:50:01 +02:00
Baptiste Daroussin d31c10fca3 nuageinit: by default to not enable nuageinit
MFC After:	1 day
Reported by:	karels@
Approved by:	re (cperciva)

(cherry picked from commit 5681636ead)
(cherry picked from commit 2c5c85cbcf)
2024-05-23 09:49:46 +02:00
Marko Zec 782f020042 fib_dxr: check if cached fib_data matches the new request in dxr_init()
When calling dxr_init(), the FIB_ALGO infrastructure may provide a
pointer to a previous dxr instance, which permits reuse of auxiliary
dxr structures, i.e. incremental lookup structure updates.  For dxr this
is a crucial feature provided by FIB_ALGO, since dxr incremental updates
are typically several orders of magnitude faster than full lookup table
rebuilds.

However, the auxiliary dxr structure caches a pointer to struct fib_data and
relies upon it for performing incremental updates.  Apparently, incremental
rebuild requests from FIB_ALGO, i.e. a calls to dxr_init() with a pointer
old_data set, may (under not yet fully understood circumstances) be invoked
within a different fib_data context than the one cached in the previous
version of dxr auxiliary structures.  In such (rare) events, we ignore the
offered old dxr context, and proceed with a full lookup structure rebuild
instead of attempting an incremental one using a fib_data context which
may or may not no longer be valid, and thus lead to a system crash.

PR:		278422
MFC after:	1 week
Approved by:    re (cperciva)

(cherry picked from commit 4ab122e8ef)
(cherry picked from commit d6e32525c7)
2024-05-23 06:29:22 +02:00
Marko Zec 0e5e6a9419 fib_dxr: s/KASSERT/MPASS/
MFC after:	1 week
Approved by:    re (cperciva)

(cherry picked from commit 1261fc325c)
2024-05-23 06:28:30 +02:00
Marko Zec cf879fdb48 fib_dxr: KASSERTs for chasing NULL ptr and runaway refcount suspects
MFC after:	1 week
Approved by:    re (cperciva)

(cherry picked from commit 52075e4cfa)
2024-05-23 06:28:02 +02:00
Marko Zec 47fb63a288 fib_dxr: move the bulko of malloc() failure logging into dxr_build()
Approved by:    re (cperciva)

(cherry picked from commit e474704b9c)
2024-05-23 06:27:33 +02:00
Marko Zec 4df0c59feb fib_dxr: update comment.
MFC after:	1 week
Approved by:    re (cperciva)

(cherry picked from commit df376a714a)
2024-05-23 06:27:07 +02:00
Marko Zec 78782f3dd2 fib_dxr: free() does nothing if arg is NULL, so remove a redundant check.
MFC after:	1 week
Approved by:    re (cperciva)

(cherry picked from commit 64136682ba)
2024-05-23 06:26:37 +02:00
Marko Zec 78ae540dec fib_dxr: log malloc() failures.
MFC after:	1 week
Approved by:    re (cperciva)

(cherry picked from commit e9927f4e61)
2024-05-23 06:25:27 +02:00
Eric Joyner f9b5ecd257 iavf(4): Improve man page
MFC after:	3 days
Reviewed by:	erj
Differential Revision:	https://reviews.freebsd.org/D43093

(cherry picked from commit ba222f6fb4)
(cherry picked from commit 4c380c44c8)

Approved by:	re (karels)
2024-05-23 04:46:00 +02:00
Dag-Erling Smørgrav fb18c369c3 access(2): Discourage use of these system calls.
Fixes:		421025a274
PR:		262895
MFC after:	3 days
Reviewed by:	emaste
Differential Revision:	https://reviews.freebsd.org/D45240

(cherry picked from commit a4be1eb211)
(cherry picked from commit 79b39f23e1)

Approved by:	re (cperciva)
2024-05-23 04:45:55 +02:00
Gordon Bergling 8766ae10d3 access.2: Mention that lstat(2) should be used for symbolic links
access(), eaccess() and faccessat() will always dereference
symbolic links.

So add a note in the manual page, that lstat(2) should be
used in the case of symbolic links.

PR:	262895
Reviewed by:	gbe, pauamma_gundo.com
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D44890

(cherry picked from commit 421025a274)
(cherry picked from commit f075b61137)

Approved by:	re (cperciva)
2024-05-23 04:45:49 +02:00
Mathieu Simon 3cec7e14b0 Add man page for the ice network driver.
PR:		262892
MFC after:	3 days
Reviewed by:	[email protected], erj
Differential Revision:	https://reviews.freebsd.org/D45270

(cherry picked from commit 8e5e42d54a)
(cherry picked from commit 42e50eaf7f)

Approved by:	re (karels)
2024-05-23 04:45:25 +02:00
Zhenlei Huang 34db75d218 if_vxlan(4): Add checking for loops and nesting of tunnels
User misconfiguration, either tunnel loops, or a large number of
different nested tunnels, can overflow the kernel stack. Prevent that
by using if_tunnel_check_nesting().

PR:		278394
Diagnosed by:	markj
Reviewed by:	kp
Approved by:	re (cperciva)
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D45197

(cherry picked from commit 93fbfef0b5)
(cherry picked from commit 3ebd2b1c73)
2024-05-23 07:00:03 +08:00
Marko Zec b0a1a3138a fib_dxr: set fib_data field in struct dxr_aux early enough
Previously it was possible for dxr_build() to return with da->fd
unset in case of range_tbl or x_tbl malloc() failures.  This
may have led to NULL ptr dereferencing in dxr_change_rib_batch().

Approved by:	re (cperciva)
MFC after:	1 week

PR:		278422
(cherry picked from commit 0418d7a090)
2024-05-22 19:50:29 +02:00
Allan Jude 207e8cef0b ftpd: stop using -g flag for /bin/ls
In 3bfbb521 the behaviour of ls was changed such that -g was no longer
a noop for compatibility with BSD 4.3, but instead changed the output
of long mode to exclude the owner of the file and display only the
group.

Update how FTPd invokes ls to restore the previous behaviour

Reported-by:	Andrew Fengler <[email protected]>
Reviewed-by:	jrtc27, des, imp
Approved by:	re (cperciva)
MFC after:	3 days
Sponsored-by:	ScaleEngine Inc.
Fixes:		3bfbb521fe ("ls: Improve POSIX compatibility for -g and -n.")

(cherry picked from commit 5af3225e0448be6af7f0312e10d2a1dfbe150c25)
(cherry picked from commit e5fadc41b4)
2024-05-22 17:18:07 +00:00
Christos Margiolis 0b367134dd sound: Make SNDST_UNVLBUF_MAX a power of two
Fixes:		074d337ad6 ("sound: Check user-supplied size passed to SNDSTIOC_ADD_USER_DEVS*")
Reported by:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 day
Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D45277

(cherry picked from commit d59058f3b3)
(cherry picked from commit eba949c37e)

Approved by:	re (cperciva)
2024-05-22 15:22:54 +02:00
Christos Margiolis 8d3f96bd85 sound: Correctly check nvlist_unpack() error
The current check is never false and if nvlist_unpack() fails, we might
panic later down the road.

PR:		266144
Sponsored by:	The FreeBSD Foundation
MFC after:	1 day
Reviewed by:	dev_submerge.ch, emaste
Differential Revision:	https://reviews.freebsd.org/D45237

(cherry picked from commit 64f4e2db6d)
(cherry picked from commit 45feaa73c6)

Approved by:	re (cperciva)
2024-05-22 15:22:40 +02:00
Christos Margiolis 18f80d6d46 sound: Check user-supplied size passed to SNDSTIOC_ADD_USER_DEVS*
SNDSTIOC_ADD_USER_DEVS* expects a user-supplied sndstioc_nv_arg->nbytes,
however we currently do not check whether this size is actually valid,
which results in a panic when SNDSTIOC_ADD_USER_DEVS* is called with an
invalid size. sndstat_add_user_devs() calls
sndstat_unpack_user_nvlbuf(), which then calls malloc() with that size.

PR:		266142
Sponsored by:	The FreeBSD Foundation
MFC after:	1 day
Reviewed by:	brooks
Differential Revision:	https://reviews.freebsd.org/D45236

(cherry picked from commit 074d337ad6)
(cherry picked from commit 5830a00c2c)

Approved by:	re (cperciva)
2024-05-22 15:22:26 +02:00
Christos Margiolis 5a9a2f5eed snd_hda: Rename LENOVO_I* to LENOVO_IDEAPAD*
Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
Reviewed by:	emaste
Differential Revision:	https://reviews.freebsd.org/D45105

(cherry picked from commit 278953360e)
(cherry picked from commit 7814ed2bd3)

Approved by:	re (cperciva)
2024-05-22 15:22:10 +02:00
Christos Margiolis cb23e0eebf snd_hda: Add patch for Lenovo Ideapad 3
Reported by:	[email protected]
Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
Reviewed by:	emaste
Differential Revision:	https://reviews.freebsd.org/D45100

(cherry picked from commit 54cc353f50)
(cherry picked from commit 9a620018af)

Approved by:	re (cperciva)
2024-05-22 15:21:56 +02:00
Christos Margiolis a0ff4e0f3e sound: Fix oss_sysinfo->numcards
According to the OSS manual, oss_sysinfo->numcards holds the number of
detected audio devices in the system, while the current ncards variable,
whose value is assigned to oss_sysinfo->numcards, holds the number of
currently registered devices only.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
Reviewed by:	dev_submerge.ch, emaste
Differential Revision:	https://reviews.freebsd.org/D45136

(cherry picked from commit 59d98edae3)
(cherry picked from commit 2b36982887)

Approved by:	re (cperciva)
2024-05-22 15:21:36 +02:00
Christos Margiolis a4a473104e sound: Remove nmix variable from mixer_oss_mixerinfo()
nmix is used to compare against oss_mixerinfo->dev, which is a
user-supplied value to select the mixer device (if not -1, in which case
we'll select the default one) we want to fetch the information of. It is
also used to set oss_mixerinfo->dev in case it is -1.

However, nmix is at best redundant, since we have the loop counter
already (i), and confusing at worst.

For example, suppose a system with 3 mixer devices. We call
SNDCTL_MIXERINFO with oss_mixerinfo->dev=1, meaning we want to get
information for /dev/mixer1. Suppose /dev/mixer0 detaches while inside
the loop, so we'll hit the loop's "continue" case, and nmix won't get
incremented (i.e will stay 0 for now). At this point nmix counts 1
device less, so when it reaches 1, we'll be fetching /dev/mixer2's
information instead of /dev/mixer1's.

This is also true in case the mixer device disappears prior to the call
to mixer_oss_mixerinfo().

Simply remove nmix and use the loop counter to both set
oss_mixerinfo->dev and check against it in case a non -1 value is
supplied.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
Reviewed by:	dev_submerge.ch
Differential Revision:	https://reviews.freebsd.org/D45135

(cherry picked from commit 2f31a5eb75)
(cherry picked from commit 8b4e2ba31d)

Approved by:	re (cperciva)
2024-05-22 15:20:42 +02:00
Cy Schubert dcde37c417 unbound: Vendor import 1.20.0
Release notes at
	https://www.nlnetlabs.nl/news/2024/May/08/unbound-1.20.0-released/

Security:	The DNSBomb vulnerability CVE-2024-33655

Merge commit 'c2a80056864d6eda0398fd127dc0ae515b39752b' into main

(cherry picked from commit 335c7cda12)
(cherry picked from commit 7a2bb28f8e)

Approved by:	re (cperciva)
2024-05-21 22:17:21 +02:00
Alexander Ziaee 39f92a4c4c networking.7 : create network quickstart guide
Now that the handbook has been moved to ports, I think it's very nice to
have a network quickstart guide in-band, in base, in the system manual.
If the user uses any of the following terms "man -k
{network,networking,wifi,quickstart}" this page will come up, which is I
think a very common use case for new users.

Currently, this document explains connecting to a basic Ethernet
network, a basic wifi network, scanning for wifi networks, and airplane
mode, as well as linking to other sections, including the handbook

Co-authored-by: Graham Perrin <[email protected]>
Reviewed by: imp, bcr, [email protected]
Pull Request: https://github.com/freebsd/freebsd-src/pull/833

(cherry picked from commit 75eda0096b)
(cherry picked from commit 5dced41439)

Approved-by: re (cperciva)
2024-05-21 14:09:04 -06:00
Alexander Ziaee 839a522e2e intro.2 as errno.2: Update maximum hard link limit
MFC after:	1 week
Co-authored-by: brooks
Reviewed by:	brooks, emaste, imp
Pull Request:	https://github.com/freebsd/freebsd-src/pull/1192

(cherry picked from commit 6dfbe695c3)
(cherry picked from commit 828e648b26)
Approved-by: re (cperciva)
2024-05-21 14:08:58 -06:00
Alexander Ziaee e59ebcf36f intro.2: Add sys/syscall.h to SYNOPSIS
MFC after:	1 week
Co-authored-by: brooks
Reviewed by:	brooks, emaste, imp
Pull Request:	https://github.com/freebsd/freebsd-src/pull/1192

(cherry picked from commit 69ff2d754c)
(cherry picked from commit cbe2436dda)
Approved-by: re (cperciva)
2024-05-21 14:08:53 -06:00
Lexi Winter 2507479f70 sys/modules/dpdk_lpm4: do not build without INET
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1236

(cherry picked from commit 304a03275a)
(cherry picked from commit 040a7e0dcb)
Approved-by: re (cperciva)
2024-05-21 14:08:48 -06:00
Lexi Winter 6df9fa1c6b sys/netinet6/in6_pcb.c: fix compile without INET
in6_mapped_sockaddr() and in6_mapped_peeraddr() both define a local
variable named 'inp', but in the non-INET case, this variable is set
and never used, causing a compiler error:

/src/freebsd/src/lf/sys/netinet6/in6_pcb.c:547:16: error:
	variable 'inp' set but not used [-Werror,-Wunused-but-set-variable]
  547 |         struct  inpcb *inp;
      |                        ^
/src/freebsd/src/lf/sys/netinet6/in6_pcb.c:573:16: error:
	variable 'inp' set but not used [-Werror,-Wunused-but-set-variable]
  573 |         struct  inpcb *inp;

Fix this by guarding all the INET-specific logic, including the variable
definition, behind #ifdef INET.

While here, tweak formatting in in6_mapped_peeraddr() so both functions
are the same.

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1155

(cherry picked from commit 042fb58d00)
(cherry picked from commit f30c2d86c3)
Approved-by: re (cperciva)
2024-05-21 14:08:41 -06:00
Lexi Winter 78ccc5af3d sys/dev/irdma/irdma_cm: fix compile without INET
irdma_get_vlan_ipv4() calls ip_ifp_find() even if INET isn't defined, in
which case this function isn't available.

Stub this out for the non-INET case to return an error (0xffff) instead.

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1156

(cherry picked from commit 0478a03562)
(cherry picked from commit 7aba922879)
Approved-by: re (cperciva)
2024-05-21 14:08:35 -06:00
Warner Losh e8adcfd14a stand: Spell LUA_COMPILE_SET correctly.
MFC After: 2 days
Sponsored by:		Netflix

(cherry picked from commit e63d20b70e)
(cherry picked from commit 5dd6fb108d)
Approved-by: re (cperciva)
2024-05-21 14:08:28 -06:00
Brooks Davis 07f9866016 msun/riscv: expose fe{disable,enable}except
This is required for GCC to build.

PR:		272759
Reported by:	[email protected]
Approved by:	re (cperciva)
Submitted by:	jrtc27
Differential Revision:	https://reviews.freebsd.org/D44333

(cherry picked from commit 1947a9383e)
(cherry picked from commit 7ad1775107)
2024-05-20 23:23:30 +01:00
Dag-Erling Smørgrav 5df49242be ldns: Ignore commented-out lines in resolv.conf.
This merges upstream PR 238 + an additional bug fix.

PR:		278721
MFC after:	1 week

(cherry picked from commit 3b092e4936)
(cherry picked from commit 7daf360284)

Approved by:	re (cperciva)
2024-05-20 22:37:46 +02:00
Dag-Erling Smørgrav 0829f9334c atf: Guard against multiple evaluation.
Note that the ATF-C++ macros have the same issue, but they are not as
easily fixed.

MFC after:	3 days
Reviewed by:	ngie
Differential Revision:	https://reviews.freebsd.org/D45148

(cherry picked from commit a7beca6fb1)
(cherry picked from commit 745ee87003)

Approved by:	re (cperciva)
2024-05-20 22:37:40 +02:00
Dag-Erling Smørgrav f44abb7055 ifconfig: Add format shortcuts.
MFC after:	1 week
Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D45166

(cherry picked from commit 847ef59d4b)

ifconfig: Markup nits.

MFC after:	3 days
Reviewed by:	imp, allanjude
Differential Revision:	https://reviews.freebsd.org/D45209

(cherry picked from commit 42b28f8152)
(cherry picked from commit dd1a16c9e2)

Approved by:	re (cperciva)
2024-05-20 22:37:28 +02:00
Dimitry Andric 2f9bf48e79 Merge commit 87f3407856e6 from llvm-project (by Phoebe Wang):
[X86][Driver] Do not add `-evex512` for `-march=native` when the target doesn't support AVX512 (#91694)

This prevents problems with ports that fail to build with
CPUTYPE=native, if the native CPU supports AVX512F, resulting in errors
like:

  /wrkdirs/usr/ports/archivers/libdeflate/work/libdeflate-1.20/lib/x86/adler32_template.h:197:21: error: always_inline function '_mm512_set1_epi8' requires target feature 'evex512', but would be inlined into function 'adler32_x86_avx512_vl512_vnni' that is compiled without support for 'evex512'
    197 |         const vec_t ones = VSET1_8(1);
        |                            ^
  /wrkdirs/usr/ports/archivers/libdeflate/work/libdeflate-1.20/lib/x86/adler32_template.h:116:23: note: expanded from macro 'VSET1_8'
    116 | #  define VSET1_8(a)            _mm512_set1_epi8(a)
        |                                 ^
  /wrkdirs/usr/ports/archivers/libdeflate/work/libdeflate-1.20/lib/x86/adler32_template.h:197:21: error: AVX vector return of type '__m512i' (vector of 8 'long long' values) without 'evex512' enabled changes the ABI
  /wrkdirs/usr/ports/archivers/libdeflate/work/libdeflate-1.20/lib/x86/adler32_template.h:116:23: note: expanded from macro 'VSET1_8'
    116 | #  define VSET1_8(a)            _mm512_set1_epi8(a)
        |                                 ^

Ports known to be affected are: archivers/libdeflate, devel/highway,
www/node20, and lang/rust.

(For rust itself there is also a similar issue reported at
https://github.com/rust-lang/rust/pull/121088).

PR:		276104
Reported by:	netchild
Approved by:	re (cperciva)
MFC after:	3 days

(cherry picked from commit fcfb2d6393)
(cherry picked from commit 14efb9bb71)
2024-05-20 19:06:20 +02:00
Kristof Provost fecd303882 if: guard against if_ioctl being NULL
There are situations where an struct ifnet has a NULL if_ioctl pointer.

For example, e6000sw creates such struct ifnets for each of its ports so it can
call into the MII code.

If there is then a link state event this calls do_link_state_change()
-> rtnl_handle_ifevent() -> dump_iface() -> get_operstate() ->
get_operstate_ether(). That wants to know if the link is up or down, so it tries
to ioctl(SIOCGIFMEDIA), which doesn't go well if if_ioctl is NULL.

Guard against this, and return EOPNOTSUPP.

PR:		275920
MFC ater:	3 days
Approved by:	re (cperciva)
Sponsored by:   Rubicon Communications, LLC ("Netgate")

(cherry picked from commit 43387b4e57)
(cherry picked from commit 9a8a26aefb)
2024-05-20 09:38:40 +02:00
Colin Percival 2a964a7fc3 14.1: update to BETA3
Approved by:	re (implicit)
Sponsored by:	https://www.patreon.com/cperciva
2024-05-17 09:15:43 -07:00
Colin Percival 1f2c98c92c Revert "Reapply "release.sh: Add -jN to make release""
Release builds on 14.x have been failing for unclear reasons; the most
likely culprit is the recently-enabled parallel release building.  Turn
it off on the 14.1 release branch to make sure we don't run into any
problems with building the release.

This is a direct commit to releng/14.1 -- I'm leaving parallel release
building turned on in stable/14 so I can try to track down the problems
there (and it's also enabled in HEAD, where I haven't seen any failures).

This reverts commit db34bbcedb.

Discussed with:	karels
Approved by:	re (cperciva)
2024-05-17 09:15:33 -07:00
Kirk McKusick 6b2af2d88f Enable soft updates by default for UFS2 filesystems.
Differential Revision: https://reviews.freebsd.org/D45201

(cherry picked from commit 61dece6d27)
(cherry picked from commit 7465f9fc06)

Approved by: re (Colin Percival)
2024-05-16 16:43:01 -07:00
Fernando Apesteguía 8930e7d8ea save-entropy: Add manual page
Succinct manual page for save-entropy(8).

PR:			223998
Reported by:		AJ Jordan <[email protected]>
Reviewed by:		carlavilla@, delphij@, lwhsu@, pauamma_gundo.com
Approved by:		delphi, lwhsu (src)
Differential Revision:	https://reviews.freebsd.org/D41768

(cherry picked from commit 8dc9b10e38)
(cherry picked from commit 227f81c8bd)

Approved by:	re (cperciva)
2024-05-16 14:24:30 -03:00
Ed Maste 147c7e4dde Increase IOAPIC_MAX_ID to 255 (from 254)
A test system provided by AMD panicked with "madt_parse_apics:
I/O APIC ID 255 too high".  I/O APIC ID 255 is acceptable, so increase
the limit.

Reviewed by:	jhb, kib
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D45157

(cherry picked from commit 4e32868183)
(cherry picked from commit 18119e711f)

Approved by:	re (cperciva)
2024-05-16 08:23:05 -04:00
Dag-Erling Smørgrav b45d038b5f expand: Fix markup for the -t option.
PR:		274897
Fixes:		8993d785a2
MFC after:	3 days
Reviewed by:	gbe
Differential Revision:	https://reviews.freebsd.org/D45167

(cherry picked from commit f3eeeb959c)
(cherry picked from commit 0d230c89f5)

Approved by:	re (cperciva)
2024-05-16 12:04:05 +02:00
Dag-Erling Smørgrav 0a09b741a7 adduser: Additional variable fixes.
One function used `_input` without making it local, causing its value to
leak into other functions.  This broke the `-f` case.  Fix that instance
and initialize all local variables that weren't already initialized.

Fixes:		170d088290
MFC after:	3 days
Reviewed by:	karels
Differential Revision:	https://reviews.freebsd.org/D45204

(cherry picked from commit 46a619c6d4)
(cherry picked from commit db5aefb1ca)

Approved by:	re (cperciva)
2024-05-15 20:47:24 +02:00
Mike Karels b827afb9e3 Revert "intrng: switch from MAXCPU to mp_ncpus"
This reverts commit b4d11915c7.
This is a direct commit to stable/14.  The change breaks booting
on older Raspberry Pi 4's, although that works on main.  The cause
is unknown.  The original commit should be redone on stable/14
if/when it catches up with main.

(cherry picked from commit 3e627553bb)

Approved-by:	re (cperciva)
2024-05-15 11:35:38 -05:00
Colin Percival 67f4116a10 release: make dependencies, not recursive make
For historical reasons, the vm-release and cloudware-release targets
were written as recursive makes of ${VMTARGETS} and ${CLOUDTARGETS};
this worked fine until we started running `make release -jN` and
had both VM and cloud targets depending on ${QEMUTGT}, at which
point things exploded when we tried to build the port twice at the
same time.

Switch vm-release and cloudware-release to have make dependencies on
their individual components; this way a single make process runs and
is aware of the duplicate dependency (and only runs it once).

MFC after:	5 days
Approved by:	re (delphij)

(cherry picked from commit ce7756fdca)
(cherry picked from commit e306ad1c19)
2024-05-14 14:38:17 -07:00
Colin Percival 0db0821fb8 release: Rework vm_extra_pre_umount
The vm_extra_pre_umount function in vmimage.subr served two purposes:
It removed /etc/resolv.conf and /qemu (if cross-building), and it
provided a function for cloudware to override in order to make cloud
specific changes to the filesystem before constructing a disk image.

This resulted in a number of bugs:
1. When cross-building, the emulator binary was left as /qemu in the
Azure, GCE, Openstack and Vagrant images.
2. The build host's resolv.conf was left as /etc/resolv.conf in the
basic-ci and basic-cloudinit images.
3. When building GCE images, a Google-specific resolv.conf file was
constructed, and then deleted before the disk image was created.

Move the bits needed for running code inside a VM staging directory
from vm_install_base into a new vm_emulation_setup routine, and move
the corresponding cleanup bits from vm_extra_pre_umount to a new
vm_emulation_cleanup routine.

Remove the /qemu and /etc/resolv.conf cleanups from the cloudware
configuration files (where they exist) since we will now be running
vm_emulation_cleanup to remove those even when vm_extra_pre_umount
has been overridden.

Override vm_emulation_cleanup in gce.conf since in that one case (and
*only* that one case) we don't want to clean up resolv.conf (since it
was constructed for the VM image rather than copied from the host).

releng/14.1 candidate.

MFC after:	1 week
Approved by:	re (delphij)
Sponsored by:	https://www.patreon.com/cperciva

(cherry picked from commit 0b1c5628c7)
(cherry picked from commit c5342be39c)
2024-05-14 14:38:09 -07:00
Colin Percival 1653215de8 release: Use qemu when cross-building vm images
For a bit over 5 years, we have used qemu when cross-building cloudware
images; in particular, it's necessary when installing packages which
might include post-install scripts.

Use qemu in the vm-images target too; while "generic" vm images don't
install packages, they still run newaliases and /etc/rc.d/ldconfig,
both of which fail without appropriate emulation.

MFC after:	1 week
Approved by:	re (delphij)

(cherry picked from commit 9287d1853c)
(cherry picked from commit 166432191c)
2024-05-14 14:37:47 -07:00
Mike Karels 096a438138 in6.h: expose s6_addr* definitions to user level
The only element of of in6_addr that is specified in RFC 3493 or
in POSIX.1-2017 is s6_addr, implemented via a #define to a union
member.  However, FreeBSD and other BSD systems have additional
definitions for the other union members, s6_addr{8,16,32} which
are defined for the kernel and loader.  Some Linux applications
also use them, and they seem to be allowed by the RFC and POSIX.
Remove the current ifdefs, exposing the additional fields to user
level, and replace with #if __BSD_VISIBLE.  Add an explanatory
comment expanding on the previous "nonstandard" comment.

Reviewed by:	bz
Differential Revision:	https://reviews.freebsd.org/D44979
Approved by:	re (cperciva)

(cherry picked from commit eb3dbf2dbe)
(cherry picked from commit a5a2e963f9)
2024-05-14 15:01:43 -05:00
Olivier Certner 81ddf56306 sched: Simplify sched_lend_user_prio_cond()
If 'td_lend_user_pri' has the expected value, there is no need to check
the fields that sched_lend_user_prio() modifies, they either are already
good or soon will be ('td->td_lend_user_pri' has just been changed by
a concurrent update).

Reviewed by:            kib
Approved by:            emaste (mentor)
MFC after:              2 weeks
Sponsored by:           The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D44050

(cherry picked from commit aeff15b392)

Approved by:            emaste (mentor)

(cherry picked from commit b8b729e23c)

Approved by:            emaste (mentor)
Approved by:            re (cperciva)
2024-05-14 15:37:42 +02:00
Olivier Certner 9dad96bc63 PP mutexes: lock: Reduce 'umtx_lock' holding before taking the user lock
There is no need to have it for the priority check (that the thread
doesn't have a higher priority than the mutex's ceiling), and there's
also no need to take it if the thread doesn't have privileges to set its
priority to the mutex's ceiling.

While here, turn 'su' into a 'bool' and compute the internal priority
corresponding to the mutex's ceiling once and for all, putting it in new
'new_pri'.

Reviewed by:            kib
Approved by:            emaste (mentor)
MFC after:              2 weeks
Sponsored by:           The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D44045

(cherry picked from commit 39e4665c96)

Approved by:            emaste (mentor)

(cherry picked from commit ce7dc52f07)

Approved by:            emaste (mentor)
Approved by:            re (cperciva)
2024-05-14 15:37:35 +02:00
Olivier Certner 8bd89740cb PP mutexes: lock: Check if priority is too high against base one
Doing this instead of using the current (user) priority, which includes
current lendings, prevents gratuitous failures for threads involved in
multiple locking groups, where each group is defined as the threads that
can lock a particular PP or PI mutex.  No deadlock can occur in this
case.  Indeed, if a thread holds such a lock A giving it a higher
priority than the ceiling of some other lock B that is PP, and B is
acquired by another thread, effectively the latter may not be able to
run but this situation can only last until the first thread releases A,
which it will do eventually.

Reviewed by:            kib
Approved by:            emaste (mentor)
MFC after:              2 weeks
Sponsored by:           The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D44044

(cherry picked from commit 9ac3ac9ece)

Approved by:            emaste (mentor)

(cherry picked from commit f9e9c02241)

Approved by:            emaste (mentor)
Approved by:            re (cperciva)
2024-05-14 15:37:26 +02:00
Olivier Certner 21284ecd1e PP mutexes: unlock: Reset inherited prio regardless of privileges
'uq_inherited_pri' contains the current priority inherited from Priority
Protection mutexes.  If -1 is passed through 'm_ceilings[1]', meaning
that there are no such mutexes held anymore, this must be reflected into
it by setting it to PRI_MAX, regardless of whether the thread has
privilege to set realtime priorities (PRI_MAX is also obviously not
a realtime priority level).  By contrast, it shall not be updated and
the computed 'new_inherited_pri' shall stay unused if the thread doesn't
have the ability to set a realtime priority, possibly keeping an older
such priority acquired previously.

Reviewed by:            kib
Approved by:            emaste (mentor)
MFC after:              2 weeks
Sponsored by:           The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D43984

(cherry picked from commit 1df8700aa6)

Approved by:            emaste (mentor)

(cherry picked from commit eded8fea5c)

Approved by:            emaste (mentor)
Approved by:            re (cperciva)
2024-05-14 15:36:38 +02:00
Dimitry Andric 975e833ff7 lld: work around elftoolchain bug which causes bloated RISCV binaries
The elftoolchain strip(1) command appears to have trouble with the new
.riscv.attributes sections being added by lld 17 to RISCV binaries. This
causes huge 'holes' in the files, making them larger than necessary.

Since nothing in the base system uses the new section yet, patch lld to
leave it out for now.

Direct commit to stable/13, since this intended to go into the 13.3
release, while the elftoolchain bug is being investigated.

Cherry-pick to stable/14 from stable/13 for the 14.1 release; the
bug has not been fixed yet.  Hopefully it will be fixed (or the code
replaced) in time for 14.2.  When that happens, this can be reverted.

Reported by:	karels
Submitted by:	jrtc27
Approved by:	re (cperciva)

(cherry picked from commit 42ceb92e6a)
(cherry picked from commit 8f0bd08e98)
2024-05-13 15:58:20 -05:00
Rick Macklem 2c65656b29 nfsd: Fix Link conformance with RFC8881 for delegations
RFC8881 specifies that, when a Link operation occurs on an
NFSv4, that file delegations issued to other clients must
be recalled.  Discovered during a recent discussion on [email protected].

Although I have not observed a problem caused by not doing
the required delegation recall, it is definitely required
by the RFC, so this patch makes the server do the recall.

Tested during a recent NFSv4 IETF Bakeathon event.

Approved by:	re (cperciva)

(cherry picked from commit 3f65000b6b)
(cherry picked from commit 3c414a8c2f)
2024-05-12 21:49:04 -07:00
Dimitry Andric ba0bd7cea4 Merge commit 73bb8d9d92f6 from llvm-project (by Jonathan Peyton):
[OpenMP] Fix child processes to use affinity_none (#91391)

  When a child process is forked with OpenMP already initialized, the
  child process resets its affinity mask and sets proc-bind-var to false
  so that the entire original affinity mask is used. This patch corrects
  an issue with the affinity initialization code setting affinity to
  compact instead of none for this special case of forked children.

  The test trying to catch this only testing explicit setting of
  KMP_AFFINITY=none. Add test run for no KMP_AFFINITY setting.

  Fixes: #91098

This should fix OpenMP processes sometimes getting stuck on a single CPU
core.

PR:		278845
Reported by:	Cassidy B. Larson <[email protected]>
Approved by:	re (cperciva)
MFC after:	3 days

(cherry picked from commit 22b3e7898e)
(cherry picked from commit 91df7d335d)
2024-05-12 20:08:46 +02:00
Dimitry Andric aec52a27f9 Merge commit 5300a6731e98 from llvm-project (by Jonathan Peyton):
[OpenMP] Fix re-locking hang found in issue 86684 (#88539)

  This was initially reported here (including stacktraces):
  https://stackoverflow.com/questions/78183545/does-compiling-imagick-with-openmp-enabled-in-freebsd-13-2-cause-sched-yield

  If `__kmp_register_library_startup()` detects that another instance of
  the library is present, `__kmp_is_address_mapped()` is eventually
  called. which uses `kmpc_alloc()` to allocate memory. This function
  calls `__kmp_entry_thread()` to access the thread-local memory pool,
  which is a bad idea during initialization. This macro internally calls
  `__kmp_get_global_thread_id_reg()` which sets the bootstrap lock at the
  beginning (before calling `__kmp_register_library_startup()`).

  The fix is to use `KMP_INTERNAL_MALLOC()`/`KMP_INTERNAL_FREE()` instead
  of `kmpc_malloc()`/`kmpc_free()`. `KMP_INTERNAL_MALLOC` and
  `KMP_INTERNAL_FREE` do not use any bootstrap locks. They just translate
  to `malloc()`/`free()` and are meant to be used during library
  initialization before other library-specific allocators have been
  initialized.

  Fixes: #86684

This should fix OpenMP processes sometimes getting locked with 100% CPU
usage, endlessly calling sched_yield(2).

PR:		278845
Reported by:	Cassidy B. Larson <[email protected]>
Approved by:	re (cperciva)
MFC after:	3 days

(cherry picked from commit da15ed2e98)
(cherry picked from commit 426e07d791)
2024-05-12 20:08:18 +02:00
Mark Johnston 502a101800 bhyve: Do not define GDB_LOG
This had been added for debugging and shouldn't have been committed.

Approved by:	re (cperciva)
Fixes:		f81cdf24ba ("bhyve: Add support for XML register definitions")
MFC after:	3 days

(cherry picked from commit 5d62025d82)
(cherry picked from commit d8ccaa995f)
2024-05-12 12:36:26 -04:00
Tijl Coosemans fe13793bb4 linuxkpi: Make arch_io_*_memtype_wc amd64-only
Linux only implements these functions on x86.  They return 0 on other
architectures.  The FreeBSD implementation calls PHYS_TO_DMAP but this
panics on i386 because it does not have a direct map so return 0 on i386
as well for now.  These functions are only used by graphics/drm-*-kmod
to mark the VRAM aperture write-combining but this is also accomplished
by a call to vm_phys_fictitious_reg_range so this change is sufficient
to fix drm-*-kmod on i386 for FreeBSD 14.1.

Reviewed by:	kib
Approved by:	re (cperciva)
Differential Revision:	https://reviews.freebsd.org/D45125

(cherry picked from commit 2ae0f5a4d0)
(cherry picked from commit 2d97bd0639)
2024-05-12 17:56:55 +02:00
Tijl Coosemans e6cdeb9d91 linuxkpi: Fix set_memory_*
set_memory_* is currently implemented using PHYS_TO_DMAP but not all
architectures have a DMAP.  Looking at how this function is used the
given address isn't physical but virtual so the PHYS_TO_DMAP call can
simply be removed.

Also cast numpages before shifting it to avoid overflow.

Reviewed by:	kib, markj
Approved by:	re (cperciva)
Differential Revision:	https://reviews.freebsd.org/D45057

(cherry picked from commit 7206f7c619)
(cherry picked from commit 147ea7d409)
2024-05-12 17:55:14 +02:00
Colin Percival e3e57ae30c 14.1: update to BETA2
Approved by:	re (implicit)
Sponsored by:	https://www.patreon.com/cperciva
2024-05-09 17:27:15 -07:00
Dag-Erling Smørgrav 01872b3665 adduser: Fix confusion between uclass and _class.
This caused adduser to produce an invalid `pw(8)` command line.  Due to
bugs in `pw(8)`, the command line was silently accepted and led to the
user being created, but locked out and with no home directory.

Also fix the default value for the “Another user?” prompt.

Fixes:		170d088290
MFC after:	3 days
Reviewed by:	karels, allanjude
Differential Revision:	https://reviews.freebsd.org/D45098

(cherry picked from commit 46c4e86ebf)
(cherry picked from commit e121845426)

Approved by:	re (cperciva)
2024-05-09 16:31:21 +02:00
Dag-Erling Smørgrav 1691bcc8b0 pw: Rename some enums.
Rename `M_PRINT` and `M_UPDATE` to `M_SHOW` and `M_MODIFY` to match the
names of the commands they represent.  No functional change intended.

MFC after:	3 days
Reviewed by:	allanjude
Differential Revision:	https://reviews.freebsd.org/D45096

(cherry picked from commit a9ea647c29)

pw: Don't silently ignore unparsed command line arguments.

MFC after:	3 days
Reviewed by:	allanjude
Differential Revision:	https://reviews.freebsd.org/D45097

(cherry picked from commit c86119328e)

pw: Test home directory ownership and mode.

MFC after:	3 days
Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D45099

(cherry picked from commit e12b7446bd)
(cherry picked from commit 2f59ee8287)

Approved by:	re (cperciva)
2024-05-09 16:31:12 +02:00
Olivier Certner 2beba7b456 Remove remnants of portsnap(8)
This was prompted by noticing that '/var/db/portsnap' still exists on
newly-installed machines.

With this change, all mentions of portsnap(8) in the tree are gone,
except for the historical note in the AUTHORS section of manpage
phttpget(8).

locate(1) will thus start indexing again '/var/db/portsnap' on machines
where this directory still exists, which may be a good way to push
administrators to delete it.

Reviewed by:            cperciva
Approved by:            emaste (mentor)
MFC after:              3 days
Sponsored by:           The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D45023

(cherry picked from commit 9b30b96c1f)

ObsoleteFiles.inc: Remove /var/db/portsnap

This is a followup to commit "Remove remnants of portsnap(8)"
(9b30b96c1f).  I wasn't aware of OLD_DIRS.

Approved by:            markj (mentor)
MFC after:              1 day
MFC with:               9b30b96c1f
Sponsored by:           The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D45023

(cherry picked from commit 54bbcc09a7)

Approved by:            markj (mentor)

(cherry picked from commit 9f06e6c990)

Approved by:            markj (mentor)
Approved by:            re (cperciva)
2024-05-09 17:18:53 +09:00
Martin Matuska 74b67dbc90 zfs: unbreak aarch64 build with non-gcc compilers
Vendor did not backport this fix into zfs-2.2-release yet.

OpenZFS PR: #16103 35bf25848 Fix: FreeBSD Arm64 does not build currently
Approved by:	re (cperciva)

(cherry picked from commit b9dee1dca2)
(cherry picked from commit 7e10c2d27a)
2024-05-08 17:25:09 +02:00
Martin Matuska 78c9d8f1ce zfs: merge openzfs/zfs@256659204 (zfs-2.2-release) into stable/14
OpenZFS release 2.2.4

Notable upstream pull request merges:
 #15076 fdd97e009 Refactor dmu_prefetch()
 #15225 5972bb856 Use ASSERT0P() to check that a pointer is NULL
 #15381 7ea833100 ZIL: Detect single-threaded workloads
 #15515 8b1a132de ZIO: Optimize zio_flush()
 #15225 d6da6cbd7 Clean up existing VERIFY*() macros
 #15225 5dda8c091 Add VERIFY0P() and ASSERT0P() macros
 #15436 61f3638a3 Add prefetch property
 #15509 6f323353d Add ashift validation when adding devices to a pool
 #15539 ea3f7c12a Extend import_progress kstat with a notes field
 #15635 25ea8ce94 ZIL: Improve next log block size prediction
 #15784 16c223eec Do no use .cfi_negate_ra_state within the assembly on
                  Arm64
 #15839 706307445 vdev probe to slow disk can stall mmp write checker
 #15879 86b39b41a zpool: Fix locale-specific time
 #15927 fa5de0c5c Update resume token at object receive
 #15941 fdd8c0aea BRT: Skip duplicate BRT prefetches
 #15942 889152ce4 Give better message from 'zpool get' with invalid pool
                  name
 #15950 3e91a9c52 BRT: Skip getting length in brt_entry_lookup()
 #15951 19bf54b76 ZAP: Massively switch to _by_dnode() interfaces
 #15954 f7c1db636 BRT: Change brt_pending_tree sorting order
 #15955 457e62d7c BRT: Relax brt_pending_apply() locking
 #15967 c94f73007 BRT: Make BRT block sizes configurable
 #15976 dced953b6 ZAP: Some cleanups/micro-optimizations
 #15983 531572b59 Fix panics when truncating/deleting files
 #15992 5fc134ff2 zvol: use multiple taskq
 #16007 2ea370a4e BRT: Fix holes cloning
 #16008 67995229a zpool: Fix option string, adding -e and fixing order
 #16015 8a5604713 Add support for zfs mount -R <filesystem>
 #16022 026fe7964 Speculative prefetch for reordered requests
 #16040 575872cc3 L2ARC: Relax locking during write
 #16042 d5fb6abd3 Improve dbuf_read() error reporting
 #16051 5d859a2e2 xdr: header cleanup
 #16052 602b5dca7 Fix read errors race after block cloning
 #16057 97d7228f4 Remove db_state DB_NOFILL checks from syncing context
 #16072 f4ce02ae4 Small fix to prefetch ranges aggregation
 #16074 97889c037 return NULL at end of send_progress_thread
 #16086 7aaf6ce9d Add the BTI elf note to the AArch64 SHA2 assembly
 #16094 4d17e200d Add zfetch stats in arcstats
 #16128 3d4d61988 Fix updating the zvol_htable when renaming a zvol
 #16141 b3b37b84e Fix arcstats for FreeBSD after zfetch support

Obtained from:	OpenZFS
OpenZFS commit:	2566592045
OpenZFS tag:	zfs-2.2.4
Approved by:	re (cperciva)

(cherry picked from commit 9a5f0cb5b6)
2024-05-08 17:24:29 +02:00
Dimitry Andric 6102863fd8 lib/clang: clean out old llvm/clang Sparc target remnants
The WITH_LLVM_TARGET_ENABLE_SPARC option was removed a long time ago,
but some ifdefs were still laying around, so clean them up.

PR:		276104
Approved by:	re (cperciva)
MFC after:	3 days

(cherry picked from commit 6f44401900)
(cherry picked from commit 0b8cdac883)
2024-05-07 19:30:21 +02:00
Dimitry Andric 8210cd3c39 Fixup: Merge llvm-project release/18.x llvmorg-18.1.5-0-g617a15a9eac9
Update version numbers, config headers, etc. Git tricked me into losing
these before pushing.

PR:		276104
Approved by:	re (cperciva)
Fixes:		d67fc74b9249
MFC after:	3 days

(cherry picked from commit 894cb08f0d)
(cherry picked from commit a17c251dd6)
2024-05-07 19:29:58 +02:00
Dimitry Andric 90a5e985e5 Merge llvm-project release/18.x llvmorg-18.1.5-0-g617a15a9eac9
This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
openmp to llvm-project release/18.x llvmorg-18.1.5-0-g617a15a9eac9.

PR:		276104
Approved by:	re (cperciva)
MFC after:	3 days

(cherry picked from commit 5678d1d98a)
(cherry picked from commit fe72d8ecb9)
2024-05-07 19:28:36 +02:00
Ed Maste 25c2d762af Enable kernel reproducible builds on stable branch
When the stable/13 branch was created the userland knob (in
share/mk/src.opts.mk) was changed to default to yes, but the kernel
default was not changed.  These two should always have the same default.
Regenerate src.conf.5, as the differing defaults previously confused
`makeman`.

Fixes: bfd1570515 ("Create the stable/13 branch")
Sponsored by: The FreeBSD Foundation
Approved by:	re (cperciva)

(cherry picked from commit d8644a5d24)
(cherry picked from commit 3a8e15354e)
2024-05-03 15:23:27 -07:00
Colin Percival 3f5f38755b 14.1: create releng/14.1 branch
Update from PRERELEASE to BETA1
Switch pkg(8) configuration to use the quarterly repository
Bump __FreeBSD_version

Approved by:	re (implicit)
Sponsored by:	https://www.patreon.com/cperciva
2024-05-02 23:13:50 -07:00
464 changed files with 62534 additions and 17261 deletions

No files matched your search

+3
View File
@@ -51,6 +51,9 @@
# xargs -n1 | sort | uniq -d;
# done
# 20240509: Remove remnants of portsnap(8)
OLD_DIRS+=var/db/portsnap
# 20240419: new clang import which bumps version from 17 to 18
OLD_FILES+=usr/lib/clang/17/include/__clang_cuda_builtin_vars.h
OLD_FILES+=usr/lib/clang/17/include/__clang_cuda_cmath.h
+105
View File
@@ -12,6 +12,111 @@ Items affecting the ports and packages system can be found in
/usr/ports/UPDATING. Please read that file before updating system packages
and/or ports.
20250221:
14.1-RELEASE-p8 SA-25:05.openssh
Multiple vulnerabilities in OpenSSH [SA-25:05.openssh]
20250129:
14.1-RELEASE-p7 SA-25:01.openssh
SA-25:02.fs
SA-25:03.etcupdate
EN-25:01.rpc
EN-25:02.audit
EN-25:03.tzdata
OpenSSH Keystroke Obfuscation Bypass [SA-25:01.openssh]
Buffer overflow in some filesystems via NFS [SA-25:02.fs]
Unprivileged access to system files [SA-25:03.etcupdate]
NULL pointer dereference in the NFSv4 client [EN-25:01.rpc]
System call auditing disabled by DTrace [EN-25:02.audit]
Timezone database information update [EN-25:03.tzdata]
20241029:
14.1-RELEASE-p6 EN-24:17.pam_xdg
SA-24:17.bhyve
SA-24:18.ctl
SA-24.19.fetch
XDG runtime directory's file descriptor leak at login [EN-24:17.pam_xdg]
Multiple issues in the bhyve hypervisor [SA-24:17.bhyve]
Unbounded allocation in ctl(4) CAM Target Layer [SA-24:18.ctl]
Certificate revocation list fetch(1) option fails [SA-24:19.fetch]
20240919:
14.1-RELEASE-p5 EN-24:16.pf
SA-24:15.bhyve
SA-24:16.libnv
Fix incorrect ICMPv6 state handling in pf [EN-24:16.pf]
Fix bhyve(8) out-of-bounds read access via XHCI emulation [SA-24:15.bhyve]
Fix integer overflow in libnv [SA-24:16.libnv]
20240904:
14.1-RELEASE-p4 EN-24:15.calendar
SA-24:09.libnv
SA-24:10.bhyve
SA-24:11.ctl
SA-24:12.bhyve
SA-24:13.openssl
SA-24:14.umtx
cron(8) / periodic(8) session login [EN-24:15.calendar]
Multiple vulnerabilities in libnv [SA-24:09.libnv]
bhyve(8) privileged guest escape via TPM device passthrough [SA-24:10.bhyve]
Multiple issues in ctl(4) CAM Target Layer [SA-24:11.ctl]
bhyve(8) privileged guest escape via USB controller [SA-24:12.bhyve]
Possible DoS in X.509 name checks in OpenSSL [SA-24:13.openssl]
umtx Kernel panic or Use-After-Free [SA-24:14.umtx]
20240807:
14.1-RELEASE-p3 EN-24:14.ifconfig
SA-24:05.pf
SA-24:06.ktrace
SA-24:07.nfsclient
SA-24:08.openssh
Incorrect ifconfig netmask assignment [EN-24:14.ifconfig]
pf incorrectly matches different ICMPv6 states in the state table [SA-24:05.pf]
ktrace(2) fails to detach when executing a setuid binary [SA-24:06.ktrace]
NFS client accepts file names containing path separators [SA-24:07.nfsclient]
OpenSSH pre-authentication async signal safety issue [SA-24:08.openssh]
20240701:
14.1-RELEASE-p2 SA-24:04.openssh
Fix pre-authentication remote code execution in sshd [SA-24:04.openssh]
20240619:
14.1-RELEASE-p1 EN-24:10.zfs
EN-24:13.libc++
Fix kernel memory leak in ZFS [EN-24:10.zfs]
Fix incorrect size passed to heap allocated std::string delete [EN-24:13.libc++]
20240604:
14.1-RELEASE.
20240202:
Loader now also read configuration files listed in local_loader_conf_files.
Files listed here are the last ones read. And /boot/loader.conf.local was
-2
View File
@@ -27,6 +27,4 @@ CFLAGS+= -I${SRCTOP}/cddl/compat/opensolaris/include
CFLAGS+= -include ${SRCTOP}/sys/contrib/openzfs/include/os/freebsd/spl/sys/ccompile.h
CFLAGS+= -DHAVE_ISSETUGID -DHAVE_CONFIG_H -DHAVE_XDR_BYTESREC
CFLAGS.nvpair.c+= -UHAVE_RPC_TYPES
.include <bsd.lib.mk>
+84 -45
View File
@@ -167,65 +167,104 @@
ATF_CHECK_MSG((expected) == (actual), "%s != %s: " fmt, \
#expected, #actual, ##__VA_ARGS__)
#define ATF_REQUIRE_STREQ(expected, actual) \
ATF_REQUIRE_MSG(strcmp(expected, actual) == 0, "%s != %s (%s != %s)", \
#expected, #actual, expected, actual)
#define ATF_REQUIRE_STREQ(expected, actual) do { \
const char *_atf_expected = (expected); \
const char *_atf_actual = (actual); \
ATF_REQUIRE_MSG(strcmp(_atf_expected, _atf_actual) == 0, \
"%s != %s (%s != %s)", #expected, #actual, \
_atf_expected, _atf_actual); \
} while (0)
#define ATF_CHECK_STREQ(expected, actual) \
ATF_CHECK_MSG(strcmp(expected, actual) == 0, "%s != %s (%s != %s)", \
#expected, #actual, expected, actual)
#define ATF_CHECK_STREQ(expected, actual) do { \
const char *_atf_expected = (expected); \
const char *_atf_actual = (actual); \
ATF_CHECK_MSG(strcmp(_atf_expected, _atf_actual) == 0, \
"%s != %s (%s != %s)", #expected, #actual, \
_atf_expected, _atf_actual); \
} while (0)
#define ATF_REQUIRE_STREQ_MSG(expected, actual, fmt, ...) \
ATF_REQUIRE_MSG(strcmp(expected, actual) == 0, \
"%s != %s (%s != %s): " fmt, \
#expected, #actual, expected, actual, ##__VA_ARGS__)
#define ATF_REQUIRE_STREQ_MSG(expected, actual, fmt, ...) do { \
const char *_atf_expected = (expected); \
const char *_atf_actual = (actual); \
ATF_REQUIRE_MSG(strcmp(_atf_expected, _atf_actual) == 0, \
"%s != %s (%s != %s): " fmt, #expected, #actual, \
_atf_expected, _atf_actual, ##__VA_ARGS__); \
} while (0)
#define ATF_CHECK_STREQ_MSG(expected, actual, fmt, ...) \
ATF_CHECK_MSG(strcmp(expected, actual) == 0, \
"%s != %s (%s != %s): " fmt, \
#expected, #actual, expected, actual, ##__VA_ARGS__)
#define ATF_CHECK_STREQ_MSG(expected, actual, fmt, ...) do { \
const char *_atf_expected = (expected); \
const char *_atf_actual = (actual); \
ATF_CHECK_MSG(strcmp(_atf_expected, _atf_actual) == 0, \
"%s != %s (%s != %s): " fmt, #expected, #actual, \
_atf_expected, _atf_actual, ##__VA_ARGS__); \
} while (0)
#define ATF_REQUIRE_INTEQ(expected, actual) \
ATF_REQUIRE_MSG((expected) == (actual), "%s != %s (%jd != %jd)", \
#expected, #actual, (intmax_t)(expected), \
(intmax_t)(actual))
#define ATF_REQUIRE_INTEQ(expected, actual) do { \
intmax_t _atf_expected = (expected); \
intmax_t _atf_actual = (actual); \
ATF_REQUIRE_MSG(_atf_expected == _atf_actual, \
"%s != %s (%jd != %jd)", #expected, #actual, \
_atf_expected, _atf_actual); \
} while (0)
#define ATF_CHECK_INTEQ(expected, actual) \
ATF_CHECK_MSG((expected) == (actual), "%s != %s (%jd != %jd)", #expected, \
#actual, (intmax_t)(expected), (intmax_t)(actual))
#define ATF_CHECK_INTEQ(expected, actual) do { \
intmax_t _atf_expected = (expected); \
intmax_t _atf_actual = (actual); \
ATF_CHECK_MSG(_atf_expected == _atf_actual, \
"%s != %s (%jd != %jd)", #expected, #actual, \
_atf_expected, _atf_actual); \
} while (0)
#define ATF_REQUIRE_INTEQ_MSG(expected, actual, fmt, ...) \
ATF_REQUIRE_MSG((expected) == (actual), "%s != %s (%jd != %jd): " fmt, \
#expected, #actual, (intmax_t)(expected), \
(intmax_t)(actual), ##__VA_ARGS__)
#define ATF_REQUIRE_INTEQ_MSG(expected, actual, fmt, ...) do { \
intmax_t _atf_expected = (expected); \
intmax_t _atf_actual = (actual); \
ATF_REQUIRE_MSG(_atf_expected == _atf_actual, \
"%s != %s (%jd != %jd): " fmt, #expected, #actual, \
_atf_expected, _atf_actual, ##__VA_ARGS__); \
} while (0)
#define ATF_CHECK_INTEQ_MSG(expected, actual, fmt, ...) \
ATF_CHECK_MSG((expected) == (actual), "%s != %s (%jd != %jd): " fmt, \
#expected, #actual, (intmax_t)(expected), \
(intmax_t)(actual), ##__VA_ARGS__)
#define ATF_CHECK_INTEQ_MSG(expected, actual, fmt, ...) do { \
intmax_t _atf_expected = (expected); \
intmax_t _atf_actual = (actual); \
ATF_CHECK_MSG(_atf_expected == _atf_actual, \
"%s != %s (%jd != %jd): " fmt, #expected, #actual, \
_atf_expected, _atf_actual, ##__VA_ARGS__); \
} while (0)
#define ATF_REQUIRE_MATCH(regexp, string) \
ATF_REQUIRE_MSG(atf_utils_grep_string("%s", string, regexp), \
"'%s' not matched in '%s'", regexp, string);
#define ATF_REQUIRE_MATCH(regexp, string) do { \
const char *_atf_regexp = (regexp); \
const char *_atf_string = (string); \
ATF_REQUIRE_MSG(atf_utils_grep_string("%s", _atf_string, _atf_regexp), \
"'%s' not matched in '%s'", _atf_regexp, _atf_string); \
} while (0)
#define ATF_CHECK_MATCH(regexp, string) \
ATF_CHECK_MSG(atf_utils_grep_string("%s", string, regexp), \
"'%s' not matched in '%s'", regexp, string);
#define ATF_CHECK_MATCH(regexp, string) do { \
const char *_atf_regexp = (regexp); \
const char *_atf_string = (string); \
ATF_CHECK_MSG(atf_utils_grep_string("%s", _atf_string, _atf_regexp), \
"'%s' not matched in '%s'", _atf_regexp, _atf_string); \
} while (0)
#define ATF_REQUIRE_MATCH_MSG(regexp, string, fmt, ...) \
ATF_REQUIRE_MSG(atf_utils_grep_string("%s", string, regexp), \
"'%s' not matched in '%s': " fmt, regexp, string, \
##__VA_ARGS__);
#define ATF_REQUIRE_MATCH_MSG(regexp, string, fmt, ...) do { \
const char *_atf_regexp = (regexp); \
const char *_atf_string = (string); \
ATF_REQUIRE_MSG(atf_utils_grep_string("%s", _atf_string, _atf_regexp), \
"'%s' not matched in '%s': " fmt, _atf_regexp, _atf_string, \
##__VA_ARGS__); \
} while (0)
#define ATF_CHECK_MATCH_MSG(regexp, string, fmt, ...) \
ATF_CHECK_MSG(atf_utils_grep_string("%s", string, regexp), \
"'%s' not matched in '%s': " fmt, regexp, string, \
##__VA_ARGS__);
#define ATF_CHECK_MATCH_MSG(regexp, string, fmt, ...) do { \
const char *_atf_regexp = (regexp); \
const char *_atf_string = (string); \
ATF_CHECK_MSG(atf_utils_grep_string("%s", _atf_string, _atf_regexp), \
"'%s' not matched in '%s': " fmt, _atf_regexp, _atf_string, \
##__VA_ARGS__); \
} while (0)
#define ATF_CHECK_ERRNO(exp_errno, bool_expr) \
atf_tc_check_errno(__FILE__, __LINE__, exp_errno, #bool_expr, bool_expr)
atf_tc_check_errno(__FILE__, __LINE__, (exp_errno), #bool_expr, (bool_expr))
#define ATF_REQUIRE_ERRNO(exp_errno, bool_expr) \
atf_tc_require_errno(__FILE__, __LINE__, exp_errno, #bool_expr, bool_expr)
atf_tc_require_errno(__FILE__, __LINE__, (exp_errno), #bool_expr, (bool_expr))
#endif /* !defined(ATF_C_MACROS_H) */
+2
View File
@@ -95,6 +95,8 @@ ssize_t ldns_fget_token_l(FILE *f, char *token, const char *delim, size_t limit,
*/
ldns_status ldns_fget_token_l_st(FILE *f, char **token, size_t *limit, bool fixed, const char *delim, int *line_nr);
ssize_t ldns_fget_token_l_resolv_conf(FILE *f, char *token, const char *delim, size_t limit, int *line_nr);
/**
* returns a token/char from the buffer b.
* This function deals with ( and ) in the buffer,
+31 -4
View File
@@ -27,9 +27,14 @@ ldns_fget_token(FILE *f, char *token, const char *delim, size_t limit)
return ldns_fget_token_l(f, token, delim, limit, NULL);
}
ldns_status
ldns_fget_token_l_st(FILE *f, char **token, size_t *limit, bool fixed
, const char *delim, int *line_nr)
enum file_type2parse {
zone_file_type, resolv_conf_file_type
};
static ldns_status
ldns_fget_token_l_st_file_type(FILE *f, char **token, size_t *limit,
bool fixed, const char *delim, int *line_nr,
enum file_type2parse file_type)
{
int c, prev_c;
int p; /* 0 -> no parentheses seen, >0 nr of ( seen */
@@ -98,7 +103,9 @@ ldns_fget_token_l_st(FILE *f, char **token, size_t *limit, bool fixed
}
/* do something with comments ; */
if (c == ';' && quoted == 0) {
if ((c == ';'
|| (c == '#' && file_type == resolv_conf_file_type))
&& quoted == 0) {
if (prev_c != '\\') {
com = 1;
}
@@ -215,6 +222,26 @@ tokenread:
return i == 0 ? LDNS_STATUS_SYNTAX_EMPTY : LDNS_STATUS_OK;
}
ldns_status
ldns_fget_token_l_st(FILE *f, char **token, size_t *limit, bool fixed
, const char *delim, int *line_nr)
{
return ldns_fget_token_l_st_file_type(
f, token, limit, fixed, delim, line_nr, zone_file_type);
}
ssize_t
ldns_fget_token_l_resolv_conf(FILE *f, char *token, const char *delim,
size_t limit, int *line_nr)
{
if (limit == 0)
limit = LDNS_MAX_LINELEN;
if (ldns_fget_token_l_st_file_type(f, &token, &limit, true, delim,
line_nr, resolv_conf_file_type))
return -1;
else
return (ssize_t)strlen(token);
}
ssize_t
ldns_fget_token_l(FILE *f, char *token, const char *delim, size_t limit, int *line_nr)
+9 -44
View File
@@ -775,7 +775,7 @@ ldns_resolver_new_frm_fp_l(ldns_resolver **res, FILE *fp, int *line_nr)
#endif
ssize_t gtr, bgtr;
ldns_buffer *b;
int lnr = 0, oldline;
int lnr = 0;
FILE* myfp = fp;
if(!line_nr) line_nr = &lnr;
@@ -809,36 +809,18 @@ ldns_resolver_new_frm_fp_l(ldns_resolver **res, FILE *fp, int *line_nr)
gtr = 1;
word[0] = 0;
oldline = *line_nr;
expect = LDNS_RESOLV_KEYWORD;
while (gtr > 0) {
/* check comments */
if (word[0] == '#') {
word[0]='x';
if(oldline == *line_nr) {
/* skip until end of line */
int c;
do {
c = fgetc(myfp);
} while(c != EOF && c != '\n');
if(c=='\n') (*line_nr)++;
}
/* and read next to prepare for further parsing */
oldline = *line_nr;
continue;
}
oldline = *line_nr;
switch(expect) {
case LDNS_RESOLV_KEYWORD:
/* keyword */
gtr = ldns_fget_token_l(myfp, word, LDNS_PARSE_NORMAL, 0, line_nr);
gtr = ldns_fget_token_l_resolv_conf(myfp, word, LDNS_PARSE_NORMAL, 0, line_nr);
if (gtr != 0) {
if(word[0] == '#') continue;
for(i = 0; i < LDNS_RESOLV_KEYWORDS; i++) {
if (strcasecmp(keyword[i], word) == 0) {
/* chosen the keyword and
* expect values carefully
*/
*/
expect = i;
break;
}
@@ -856,16 +838,12 @@ ldns_resolver_new_frm_fp_l(ldns_resolver **res, FILE *fp, int *line_nr)
break;
case LDNS_RESOLV_DEFDOMAIN:
/* default domain dname */
gtr = ldns_fget_token_l(myfp, word, LDNS_PARSE_NORMAL, 0, line_nr);
gtr = ldns_fget_token_l_resolv_conf(myfp, word, LDNS_PARSE_NORMAL, 0, line_nr);
if (gtr == 0) {
if(!fp) fclose(myfp);
ldns_resolver_deep_free(r);
return LDNS_STATUS_SYNTAX_MISSING_VALUE_ERR;
}
if(word[0] == '#') {
expect = LDNS_RESOLV_KEYWORD;
continue;
}
tmp = ldns_rdf_new_frm_str(LDNS_RDF_TYPE_DNAME, word);
if (!tmp) {
if(!fp) fclose(myfp);
@@ -879,16 +857,12 @@ ldns_resolver_new_frm_fp_l(ldns_resolver **res, FILE *fp, int *line_nr)
break;
case LDNS_RESOLV_NAMESERVER:
/* NS aaaa or a record */
gtr = ldns_fget_token_l(myfp, word, LDNS_PARSE_NORMAL, 0, line_nr);
gtr = ldns_fget_token_l_resolv_conf(myfp, word, LDNS_PARSE_NORMAL, 0, line_nr);
if (gtr == 0) {
if(!fp) fclose(myfp);
ldns_resolver_deep_free(r);
return LDNS_STATUS_SYNTAX_MISSING_VALUE_ERR;
}
if(word[0] == '#') {
expect = LDNS_RESOLV_KEYWORD;
continue;
}
if(strchr(word, '%')) {
/* snip off interface labels,
* fe80::222:19ff:fe31:4222%eth0 */
@@ -911,7 +885,7 @@ ldns_resolver_new_frm_fp_l(ldns_resolver **res, FILE *fp, int *line_nr)
break;
case LDNS_RESOLV_SEARCH:
/* search list domain dname */
gtr = ldns_fget_token_l(myfp, word, LDNS_PARSE_SKIP_SPACE, 0, line_nr);
gtr = ldns_fget_token_l_resolv_conf(myfp, word, LDNS_PARSE_SKIP_SPACE, 0, line_nr);
b = LDNS_MALLOC(ldns_buffer);
if(!b) {
ldns_resolver_deep_free(r);
@@ -929,10 +903,6 @@ ldns_resolver_new_frm_fp_l(ldns_resolver **res, FILE *fp, int *line_nr)
bgtr = ldns_bget_token(b, word, LDNS_PARSE_NORMAL, (size_t) gtr + 1);
while (bgtr > 0) {
gtr -= bgtr;
if(word[0] == '#') {
expect = LDNS_RESOLV_KEYWORD;
break;
}
tmp = ldns_rdf_new_frm_str(LDNS_RDF_TYPE_DNAME, word);
if (!tmp) {
ldns_resolver_deep_free(r);
@@ -954,28 +924,23 @@ ldns_resolver_new_frm_fp_l(ldns_resolver **res, FILE *fp, int *line_nr)
}
break;
case LDNS_RESOLV_SORTLIST:
gtr = ldns_fget_token_l(myfp, word, LDNS_PARSE_SKIP_SPACE, 0, line_nr);
gtr = ldns_fget_token_l_resolv_conf(myfp, word, LDNS_PARSE_SKIP_SPACE, 0, line_nr);
/* sortlist not implemented atm */
expect = LDNS_RESOLV_KEYWORD;
break;
case LDNS_RESOLV_OPTIONS:
gtr = ldns_fget_token_l(myfp, word, LDNS_PARSE_SKIP_SPACE, 0, line_nr);
gtr = ldns_fget_token_l_resolv_conf(myfp, word, LDNS_PARSE_SKIP_SPACE, 0, line_nr);
/* options not implemented atm */
expect = LDNS_RESOLV_KEYWORD;
break;
case LDNS_RESOLV_ANCHOR:
/* a file containing a DNSSEC trust anchor */
gtr = ldns_fget_token_l(myfp, word, LDNS_PARSE_NORMAL, 0, line_nr);
gtr = ldns_fget_token_l_resolv_conf(myfp, word, LDNS_PARSE_NORMAL, 0, line_nr);
if (gtr == 0) {
ldns_resolver_deep_free(r);
if(!fp) fclose(myfp);
return LDNS_STATUS_SYNTAX_MISSING_VALUE_ERR;
}
if(word[0] == '#') {
expect = LDNS_RESOLV_KEYWORD;
continue;
}
#ifdef HAVE_SSL
tmp_rr = ldns_read_anchor_file(word);
(void) ldns_resolver_push_dnssec_anchor(r, tmp_rr);
@@ -823,29 +823,32 @@ const FieldDecl *CodeGenFunction::FindFlexibleArrayMemberField(
ASTContext &Ctx, const RecordDecl *RD, StringRef Name, uint64_t &Offset) {
const LangOptions::StrictFlexArraysLevelKind StrictFlexArraysLevel =
getLangOpts().getStrictFlexArraysLevel();
unsigned FieldNo = 0;
bool IsUnion = RD->isUnion();
uint32_t FieldNo = 0;
for (const Decl *D : RD->decls()) {
if (const auto *Field = dyn_cast<FieldDecl>(D);
Field && (Name.empty() || Field->getNameAsString() == Name) &&
if (RD->isImplicit())
return nullptr;
for (const FieldDecl *FD : RD->fields()) {
if ((Name.empty() || FD->getNameAsString() == Name) &&
Decl::isFlexibleArrayMemberLike(
Ctx, Field, Field->getType(), StrictFlexArraysLevel,
Ctx, FD, FD->getType(), StrictFlexArraysLevel,
/*IgnoreTemplateOrMacroSubstitution=*/true)) {
const ASTRecordLayout &Layout = Ctx.getASTRecordLayout(RD);
Offset += Layout.getFieldOffset(FieldNo);
return Field;
return FD;
}
if (const auto *Record = dyn_cast<RecordDecl>(D))
if (const FieldDecl *Field =
FindFlexibleArrayMemberField(Ctx, Record, Name, Offset)) {
QualType Ty = FD->getType();
if (Ty->isRecordType()) {
if (const FieldDecl *Field = FindFlexibleArrayMemberField(
Ctx, Ty->getAsRecordDecl(), Name, Offset)) {
const ASTRecordLayout &Layout = Ctx.getASTRecordLayout(RD);
Offset += Layout.getFieldOffset(FieldNo);
return Field;
}
}
if (!IsUnion && isa<FieldDecl>(D))
if (!RD->isUnion())
++FieldNo;
}
@@ -1581,6 +1581,11 @@ bool CodeGenModule::ReturnTypeUsesSRet(const CGFunctionInfo &FI) {
return RI.isIndirect() || (RI.isInAlloca() && RI.getInAllocaSRet());
}
bool CodeGenModule::ReturnTypeHasInReg(const CGFunctionInfo &FI) {
const auto &RI = FI.getReturnInfo();
return RI.getInReg();
}
bool CodeGenModule::ReturnSlotInterferesWithArgs(const CGFunctionInfo &FI) {
return ReturnTypeUsesSRet(FI) &&
getTargetCodeGenInfo().doesReturnSlotInterfereWithArgs();
@@ -2903,23 +2903,29 @@ CGObjCGNU::GenerateMessageSend(CodeGenFunction &CGF,
break;
case CodeGenOptions::Mixed:
case CodeGenOptions::NonLegacy:
StringRef name = "objc_msgSend";
if (CGM.ReturnTypeUsesFPRet(ResultType)) {
imp =
CGM.CreateRuntimeFunction(llvm::FunctionType::get(IdTy, IdTy, true),
"objc_msgSend_fpret")
.getCallee();
name = "objc_msgSend_fpret";
} else if (CGM.ReturnTypeUsesSRet(MSI.CallInfo)) {
// The actual types here don't matter - we're going to bitcast the
// function anyway
imp =
CGM.CreateRuntimeFunction(llvm::FunctionType::get(IdTy, IdTy, true),
"objc_msgSend_stret")
.getCallee();
} else {
imp = CGM.CreateRuntimeFunction(
llvm::FunctionType::get(IdTy, IdTy, true), "objc_msgSend")
.getCallee();
name = "objc_msgSend_stret";
// The address of the memory block is be passed in x8 for POD type,
// or in x0 for non-POD type (marked as inreg).
bool shouldCheckForInReg =
CGM.getContext()
.getTargetInfo()
.getTriple()
.isWindowsMSVCEnvironment() &&
CGM.getContext().getTargetInfo().getTriple().isAArch64();
if (shouldCheckForInReg && CGM.ReturnTypeHasInReg(MSI.CallInfo)) {
name = "objc_msgSend_stret2";
}
}
// The actual types here don't matter - we're going to bitcast the
// function anyway
imp = CGM.CreateRuntimeFunction(llvm::FunctionType::get(IdTy, IdTy, true),
name)
.getCallee();
}
// Reset the receiver in case the lookup modified it
@@ -1239,6 +1239,9 @@ public:
/// Return true iff the given type uses 'sret' when used as a return type.
bool ReturnTypeUsesSRet(const CGFunctionInfo &FI);
/// Return true iff the given type has `inreg` set.
bool ReturnTypeHasInReg(const CGFunctionInfo &FI);
/// Return true iff the given type uses an argument slot when 'sret' is used
/// as a return type.
bool ReturnSlotInterferesWithArgs(const CGFunctionInfo &FI);
@@ -1207,6 +1207,12 @@ struct CounterCoverageMappingBuilder
/// Find a valid gap range between \p AfterLoc and \p BeforeLoc.
std::optional<SourceRange> findGapAreaBetween(SourceLocation AfterLoc,
SourceLocation BeforeLoc) {
// Some statements (like AttributedStmt and ImplicitValueInitExpr) don't
// have valid source locations. Do not emit a gap region if this is the case
// in either AfterLoc end or BeforeLoc end.
if (AfterLoc.isInvalid() || BeforeLoc.isInvalid())
return std::nullopt;
// If AfterLoc is in function-like macro, use the right parenthesis
// location.
if (AfterLoc.isMacroID()) {
@@ -1370,9 +1376,8 @@ struct CounterCoverageMappingBuilder
for (const Stmt *Child : S->children())
if (Child) {
// If last statement contains terminate statements, add a gap area
// between the two statements. Skipping attributed statements, because
// they don't have valid start location.
if (LastStmt && HasTerminateStmt && !isa<AttributedStmt>(Child)) {
// between the two statements.
if (LastStmt && HasTerminateStmt) {
auto Gap = findGapAreaBetween(getEnd(LastStmt), getStart(Child));
if (Gap)
fillGapAreaWithCount(Gap->getBegin(), Gap->getEnd(),
@@ -1135,9 +1135,15 @@ static bool isTrivialForMSVC(const CXXRecordDecl *RD, QualType Ty,
return false;
if (RD->hasNonTrivialCopyAssignment())
return false;
for (const CXXConstructorDecl *Ctor : RD->ctors())
if (Ctor->isUserProvided())
return false;
for (const Decl *D : RD->decls()) {
if (auto *Ctor = dyn_cast<CXXConstructorDecl>(D)) {
if (Ctor->isUserProvided())
return false;
} else if (auto *Template = dyn_cast<FunctionTemplateDecl>(D)) {
if (isa<CXXConstructorDecl>(Template->getTemplatedDecl()))
return false;
}
}
if (RD->hasNonTrivialDestructor())
return false;
return true;
@@ -674,7 +674,13 @@ void ContinuationIndenter::addTokenOnCurrentLine(LineState &State, bool DryRun,
// arguments to function calls. We do this by ensuring that either all
// arguments (including any lambdas) go on the same line as the function
// call, or we break before the first argument.
auto PrevNonComment = Current.getPreviousNonComment();
const auto *Prev = Current.Previous;
if (!Prev)
return false;
// For example, `/*Newline=*/false`.
if (Prev->is(TT_BlockComment) && Current.SpacesRequiredBefore == 0)
return false;
const auto *PrevNonComment = Current.getPreviousNonComment();
if (!PrevNonComment || PrevNonComment->isNot(tok::l_paren))
return false;
if (Current.isOneOf(tok::comment, tok::l_paren, TT_LambdaLSquare))
@@ -3532,6 +3532,8 @@ void TokenAnnotator::calculateFormattingInformation(AnnotatedLine &Line) const {
}
} else if (ClosingParen) {
for (auto *Tok = ClosingParen->Next; Tok; Tok = Tok->Next) {
if (Tok->is(TT_CtorInitializerColon))
break;
if (Tok->is(tok::arrow)) {
Tok->setType(TT_TrailingReturnArrow);
break;
@@ -5157,12 +5159,8 @@ bool TokenAnnotator::mustBreakBefore(const AnnotatedLine &Line,
return true;
if (Left.IsUnterminatedLiteral)
return true;
// FIXME: Breaking after newlines seems useful in general. Turn this into an
// option and recognize more cases like endl etc, and break independent of
// what comes after operator lessless.
if (Right.is(tok::lessless) && Right.Next &&
Right.Next->is(tok::string_literal) && Left.is(tok::string_literal) &&
Left.TokenText.ends_with("\\n\"")) {
if (Right.is(tok::lessless) && Right.Next && Left.is(tok::string_literal) &&
Right.Next->is(tok::string_literal)) {
return true;
}
if (Right.is(TT_RequiresClause)) {
@@ -489,18 +489,23 @@ void UnwrappedLineParser::calculateBraceTypes(bool ExpectClassBody) {
};
SmallVector<StackEntry, 8> LBraceStack;
assert(Tok->is(tok::l_brace));
do {
// Get next non-comment, non-preprocessor token.
FormatToken *NextTok;
do {
NextTok = Tokens->getNextToken();
} while (NextTok->is(tok::comment));
while (NextTok->is(tok::hash) && !Line->InMacroBody) {
NextTok = Tokens->getNextToken();
do {
NextTok = Tokens->getNextToken();
} while (NextTok->is(tok::comment) ||
(NextTok->NewlinesBefore == 0 && NextTok->isNot(tok::eof)));
if (!Line->InMacroBody) {
// Skip PPDirective lines and comments.
while (NextTok->is(tok::hash)) {
do {
NextTok = Tokens->getNextToken();
} while (NextTok->NewlinesBefore == 0 && NextTok->isNot(tok::eof));
while (NextTok->is(tok::comment))
NextTok = Tokens->getNextToken();
}
}
switch (Tok->Tok.getKind()) {
@@ -534,16 +539,6 @@ void UnwrappedLineParser::calculateBraceTypes(bool ExpectClassBody) {
if (Style.Language == FormatStyle::LK_Proto) {
ProbablyBracedList = NextTok->isOneOf(tok::comma, tok::r_square);
} else {
// Skip NextTok over preprocessor lines, otherwise we may not
// properly diagnose the block as a braced intializer
// if the comma separator appears after the pp directive.
while (NextTok->is(tok::hash)) {
ScopedMacroState MacroState(*Line, Tokens, NextTok);
do {
NextTok = Tokens->getNextToken();
} while (NextTok->isNot(tok::eof));
}
// Using OriginalColumn to distinguish between ObjC methods and
// binary operators is a bit hacky.
bool NextIsObjCMethod = NextTok->isOneOf(tok::plus, tok::minus) &&
@@ -602,6 +597,16 @@ void UnwrappedLineParser::calculateBraceTypes(bool ExpectClassBody) {
NextTok = Tokens->getNextToken();
ProbablyBracedList = NextTok->isNot(tok::l_square);
}
// Cpp macro definition body that is a nonempty braced list or block:
if (Style.isCpp() && Line->InMacroBody && PrevTok != FormatTok &&
!FormatTok->Previous && NextTok->is(tok::eof) &&
// A statement can end with only `;` (simple statement), a block
// closing brace (compound statement), or `:` (label statement).
// If PrevTok is a block opening brace, Tok ends an empty block.
!PrevTok->isOneOf(tok::semi, BK_Block, tok::colon)) {
ProbablyBracedList = true;
}
}
if (ProbablyBracedList) {
Tok->setBlockKind(BK_BracedInit);
@@ -631,6 +636,7 @@ void UnwrappedLineParser::calculateBraceTypes(bool ExpectClassBody) {
default:
break;
}
PrevTok = Tok;
Tok = NextTok;
} while (Tok->isNot(tok::eof) && !LBraceStack.empty());
@@ -216,21 +216,17 @@ std::vector<SymbolRef> taint::getTaintedSymbolsImpl(ProgramStateRef State,
std::vector<SymbolRef> TaintedSymbols;
if (!Reg)
return TaintedSymbols;
// Element region (array element) is tainted if either the base or the offset
// are tainted.
// Element region (array element) is tainted if the offset is tainted.
if (const ElementRegion *ER = dyn_cast<ElementRegion>(Reg)) {
std::vector<SymbolRef> TaintedIndex =
getTaintedSymbolsImpl(State, ER->getIndex(), K, returnFirstOnly);
llvm::append_range(TaintedSymbols, TaintedIndex);
if (returnFirstOnly && !TaintedSymbols.empty())
return TaintedSymbols; // return early if needed
std::vector<SymbolRef> TaintedSuperRegion =
getTaintedSymbolsImpl(State, ER->getSuperRegion(), K, returnFirstOnly);
llvm::append_range(TaintedSymbols, TaintedSuperRegion);
if (returnFirstOnly && !TaintedSymbols.empty())
return TaintedSymbols; // return early if needed
}
// Symbolic region is tainted if the corresponding symbol is tainted.
if (const SymbolicRegion *SR = dyn_cast<SymbolicRegion>(Reg)) {
std::vector<SymbolRef> TaintedRegions =
getTaintedSymbolsImpl(State, SR->getSymbol(), K, returnFirstOnly);
@@ -239,6 +235,8 @@ std::vector<SymbolRef> taint::getTaintedSymbolsImpl(ProgramStateRef State,
return TaintedSymbols; // return early if needed
}
// Any subregion (including Element and Symbolic regions) is tainted if its
// super-region is tainted.
if (const SubRegion *ER = dyn_cast<SubRegion>(Reg)) {
std::vector<SymbolRef> TaintedSubRegions =
getTaintedSymbolsImpl(State, ER->getSuperRegion(), K, returnFirstOnly);
@@ -318,4 +316,4 @@ std::vector<SymbolRef> taint::getTaintedSymbolsImpl(ProgramStateRef State,
}
}
return TaintedSymbols;
}
}
@@ -205,8 +205,12 @@ void InvalidPtrChecker::postPreviousReturnInvalidatingCall(
CE, LCtx, CE->getType(), C.blockCount());
State = State->BindExpr(CE, LCtx, RetVal);
const auto *SymRegOfRetVal =
dyn_cast_or_null<SymbolicRegion>(RetVal.getAsRegion());
if (!SymRegOfRetVal)
return;
// Remember to this region.
const auto *SymRegOfRetVal = cast<SymbolicRegion>(RetVal.getAsRegion());
const MemRegion *MR = SymRegOfRetVal->getBaseRegion();
State = State->set<PreviousCallResultMap>(FD, MR);
+3 -3
View File
@@ -1943,10 +1943,10 @@ private:
if (__s < __min_cap) {
return static_cast<size_type>(__min_cap) - 1;
}
size_type __guess =
__align_it < sizeof(value_type) < __alignment ? __alignment / sizeof(value_type) : 1 > (__s + 1) - 1;
const size_type __boundary = sizeof(value_type) < __alignment ? __alignment / sizeof(value_type) : __endian_factor;
size_type __guess = __align_it<__boundary>(__s + 1) - 1;
if (__guess == __min_cap)
++__guess;
__guess += __endian_factor;
return __guess;
}
@@ -25,7 +25,7 @@ export {
using ::system;
// [c.malloc], C library memory allocation
using ::aligned_alloc;
using ::aligned_alloc _LIBCPP_USING_IF_EXISTS;
using ::calloc;
using ::free;
using ::malloc;
+4
View File
@@ -2148,9 +2148,13 @@ template <class ELFT> void Writer<ELFT>::finalizeSections() {
addPhdrForSection(part, SHT_MIPS_OPTIONS, PT_MIPS_OPTIONS, PF_R);
addPhdrForSection(part, SHT_MIPS_ABIFLAGS, PT_MIPS_ABIFLAGS, PF_R);
}
#if 0
// XXX: This stops elftoolchain strip adjusting .riscv.attributes,
// leaving large holes in binaries.
if (config->emachine == EM_RISCV)
addPhdrForSection(part, SHT_RISCV_ATTRIBUTES, PT_RISCV_ATTRIBUTES,
PF_R);
#endif
}
Out::programHeaders->size = sizeof(Elf_Phdr) * mainPart->phdrs.size();
@@ -35,11 +35,23 @@ struct LegalityQuery;
class MachineRegisterInfo;
namespace GISelAddressing {
/// Helper struct to store a base, index and offset that forms an address
struct BaseIndexOffset {
class BaseIndexOffset {
private:
Register BaseReg;
Register IndexReg;
int64_t Offset = 0;
bool IsIndexSignExt = false;
std::optional<int64_t> Offset;
public:
BaseIndexOffset() = default;
Register getBase() { return BaseReg; }
Register getBase() const { return BaseReg; }
Register getIndex() { return IndexReg; }
Register getIndex() const { return IndexReg; }
void setBase(Register NewBase) { BaseReg = NewBase; }
void setIndex(Register NewIndex) { IndexReg = NewIndex; }
void setOffset(std::optional<int64_t> NewOff) { Offset = NewOff; }
bool hasValidOffset() const { return Offset.has_value(); }
int64_t getOffset() const { return *Offset; }
};
/// Returns a BaseIndexOffset which describes the pointer in \p Ptr.
@@ -89,7 +101,7 @@ private:
// order stores are writing to incremeneting consecutive addresses. So when
// we walk the block in reverse order, the next eligible store must write to
// an offset one store width lower than CurrentLowestOffset.
uint64_t CurrentLowestOffset;
int64_t CurrentLowestOffset;
SmallVector<GStore *> Stores;
// A vector of MachineInstr/unsigned pairs to denote potential aliases that
// need to be checked before the candidate is considered safe to merge. The
@@ -8154,6 +8154,7 @@ static bool optimizeBranch(BranchInst *Branch, const TargetLowering &TLI,
IRBuilder<> Builder(Branch);
if (UI->getParent() != Branch->getParent())
UI->moveBefore(Branch);
UI->dropPoisonGeneratingFlags();
Value *NewCmp = Builder.CreateCmp(ICmpInst::ICMP_EQ, UI,
ConstantInt::get(UI->getType(), 0));
LLVM_DEBUG(dbgs() << "Converting " << *Cmp << "\n");
@@ -8167,6 +8168,7 @@ static bool optimizeBranch(BranchInst *Branch, const TargetLowering &TLI,
IRBuilder<> Builder(Branch);
if (UI->getParent() != Branch->getParent())
UI->moveBefore(Branch);
UI->dropPoisonGeneratingFlags();
Value *NewCmp = Builder.CreateCmp(Cmp->getPredicate(), UI,
ConstantInt::get(UI->getType(), 0));
LLVM_DEBUG(dbgs() << "Converting " << *Cmp << "\n");
@@ -591,8 +591,8 @@ bool CombinerHelper::matchCombineExtendingLoads(MachineInstr &MI,
UseMI.getOpcode() == TargetOpcode::G_ZEXT ||
(UseMI.getOpcode() == TargetOpcode::G_ANYEXT)) {
const auto &MMO = LoadMI->getMMO();
// For atomics, only form anyextending loads.
if (MMO.isAtomic() && UseMI.getOpcode() != TargetOpcode::G_ANYEXT)
// Don't do anything for atomics.
if (MMO.isAtomic())
continue;
// Check for legality.
if (!isPreLegalize()) {
@@ -4180,6 +4180,10 @@ LegalizerHelper::fewerElementsVectorPhi(GenericMachineInstr &MI,
}
}
// Set the insert point after the existing PHIs
MachineBasicBlock &MBB = *MI.getParent();
MIRBuilder.setInsertPt(MBB, MBB.getFirstNonPHI());
// Merge small outputs into MI's def.
if (NumLeftovers) {
mergeMixedSubvectors(MI.getReg(0), OutputRegs);
@@ -84,21 +84,20 @@ BaseIndexOffset GISelAddressing::getPointerInfo(Register Ptr,
MachineRegisterInfo &MRI) {
BaseIndexOffset Info;
Register PtrAddRHS;
if (!mi_match(Ptr, MRI, m_GPtrAdd(m_Reg(Info.BaseReg), m_Reg(PtrAddRHS)))) {
Info.BaseReg = Ptr;
Info.IndexReg = Register();
Info.IsIndexSignExt = false;
Register BaseReg;
if (!mi_match(Ptr, MRI, m_GPtrAdd(m_Reg(BaseReg), m_Reg(PtrAddRHS)))) {
Info.setBase(Ptr);
Info.setOffset(0);
return Info;
}
Info.setBase(BaseReg);
auto RHSCst = getIConstantVRegValWithLookThrough(PtrAddRHS, MRI);
if (RHSCst)
Info.Offset = RHSCst->Value.getSExtValue();
Info.setOffset(RHSCst->Value.getSExtValue());
// Just recognize a simple case for now. In future we'll need to match
// indexing patterns for base + index + constant.
Info.IndexReg = PtrAddRHS;
Info.IsIndexSignExt = false;
Info.setIndex(PtrAddRHS);
return Info;
}
@@ -114,15 +113,16 @@ bool GISelAddressing::aliasIsKnownForLoadStore(const MachineInstr &MI1,
BaseIndexOffset BasePtr0 = getPointerInfo(LdSt1->getPointerReg(), MRI);
BaseIndexOffset BasePtr1 = getPointerInfo(LdSt2->getPointerReg(), MRI);
if (!BasePtr0.BaseReg.isValid() || !BasePtr1.BaseReg.isValid())
if (!BasePtr0.getBase().isValid() || !BasePtr1.getBase().isValid())
return false;
int64_t Size1 = LdSt1->getMemSize();
int64_t Size2 = LdSt2->getMemSize();
int64_t PtrDiff;
if (BasePtr0.BaseReg == BasePtr1.BaseReg) {
PtrDiff = BasePtr1.Offset - BasePtr0.Offset;
if (BasePtr0.getBase() == BasePtr1.getBase() && BasePtr0.hasValidOffset() &&
BasePtr1.hasValidOffset()) {
PtrDiff = BasePtr1.getOffset() - BasePtr0.getOffset();
// If the size of memory access is unknown, do not use it to do analysis.
// One example of unknown size memory access is to load/store scalable
// vector objects on the stack.
@@ -151,8 +151,8 @@ bool GISelAddressing::aliasIsKnownForLoadStore(const MachineInstr &MI1,
// able to calculate their relative offset if at least one arises
// from an alloca. However, these allocas cannot overlap and we
// can infer there is no alias.
auto *Base0Def = getDefIgnoringCopies(BasePtr0.BaseReg, MRI);
auto *Base1Def = getDefIgnoringCopies(BasePtr1.BaseReg, MRI);
auto *Base0Def = getDefIgnoringCopies(BasePtr0.getBase(), MRI);
auto *Base1Def = getDefIgnoringCopies(BasePtr1.getBase(), MRI);
if (!Base0Def || !Base1Def)
return false; // Couldn't tell anything.
@@ -520,16 +520,20 @@ bool LoadStoreOpt::addStoreToCandidate(GStore &StoreMI,
Register StoreAddr = StoreMI.getPointerReg();
auto BIO = getPointerInfo(StoreAddr, *MRI);
Register StoreBase = BIO.BaseReg;
uint64_t StoreOffCst = BIO.Offset;
Register StoreBase = BIO.getBase();
if (C.Stores.empty()) {
C.BasePtr = StoreBase;
if (!BIO.hasValidOffset()) {
C.CurrentLowestOffset = 0;
} else {
C.CurrentLowestOffset = BIO.getOffset();
}
// This is the first store of the candidate.
// If the offset can't possibly allow for a lower addressed store with the
// same base, don't bother adding it.
if (StoreOffCst < ValueTy.getSizeInBytes())
if (BIO.hasValidOffset() &&
BIO.getOffset() < static_cast<int64_t>(ValueTy.getSizeInBytes()))
return false;
C.BasePtr = StoreBase;
C.CurrentLowestOffset = StoreOffCst;
C.Stores.emplace_back(&StoreMI);
LLVM_DEBUG(dbgs() << "Starting a new merge candidate group with: "
<< StoreMI);
@@ -549,8 +553,12 @@ bool LoadStoreOpt::addStoreToCandidate(GStore &StoreMI,
// writes to the next lowest adjacent address.
if (C.BasePtr != StoreBase)
return false;
if ((C.CurrentLowestOffset - ValueTy.getSizeInBytes()) !=
static_cast<uint64_t>(StoreOffCst))
// If we don't have a valid offset, we can't guarantee to be an adjacent
// offset.
if (!BIO.hasValidOffset())
return false;
if ((C.CurrentLowestOffset -
static_cast<int64_t>(ValueTy.getSizeInBytes())) != BIO.getOffset())
return false;
// This writes to an adjacent address. Allow it.
@@ -9636,8 +9636,15 @@ static SDValue combineShiftOfShiftedLogic(SDNode *Shift, SelectionDAG &DAG) {
if (ShiftAmtVal->getBitWidth() != C1Val.getBitWidth())
return false;
// The fold is not valid if the sum of the shift values doesn't fit in the
// given shift amount type.
bool Overflow = false;
APInt NewShiftAmt = C1Val.uadd_ov(*ShiftAmtVal, Overflow);
if (Overflow)
return false;
// The fold is not valid if the sum of the shift values exceeds bitwidth.
if ((*ShiftAmtVal + C1Val).uge(V.getScalarValueSizeInBits()))
if (NewShiftAmt.uge(V.getScalarValueSizeInBits()))
return false;
return true;
@@ -4885,19 +4885,9 @@ defm UABDL : SIMDLongThreeVectorBHSabdl<1, 0b0111, "uabdl",
def : Pat<(abs (v8i16 (sub (zext (v8i8 V64:$opA)),
(zext (v8i8 V64:$opB))))),
(UABDLv8i8_v8i16 V64:$opA, V64:$opB)>;
def : Pat<(xor (v8i16 (AArch64vashr v8i16:$src, (i32 15))),
(v8i16 (add (sub (zext (v8i8 V64:$opA)),
(zext (v8i8 V64:$opB))),
(AArch64vashr v8i16:$src, (i32 15))))),
(UABDLv8i8_v8i16 V64:$opA, V64:$opB)>;
def : Pat<(abs (v8i16 (sub (zext (extract_high_v16i8 (v16i8 V128:$opA))),
(zext (extract_high_v16i8 (v16i8 V128:$opB)))))),
(UABDLv16i8_v8i16 V128:$opA, V128:$opB)>;
def : Pat<(xor (v8i16 (AArch64vashr v8i16:$src, (i32 15))),
(v8i16 (add (sub (zext (extract_high_v16i8 (v16i8 V128:$opA))),
(zext (extract_high_v16i8 (v16i8 V128:$opB)))),
(AArch64vashr v8i16:$src, (i32 15))))),
(UABDLv16i8_v8i16 V128:$opA, V128:$opB)>;
def : Pat<(abs (v4i32 (sub (zext (v4i16 V64:$opA)),
(zext (v4i16 V64:$opB))))),
(UABDLv4i16_v4i32 V64:$opA, V64:$opB)>;
@@ -2358,6 +2358,11 @@ bool SIGfx12CacheControl::enableVolatileAndOrNonTemporal(
bool Changed = false;
if (IsNonTemporal) {
// Set non-temporal hint for all cache levels.
Changed |= setTH(MI, AMDGPU::CPol::TH_NT);
}
if (IsVolatile) {
Changed |= setScope(MI, AMDGPU::CPol::SCOPE_SYS);
@@ -2370,11 +2375,6 @@ bool SIGfx12CacheControl::enableVolatileAndOrNonTemporal(
Position::AFTER);
}
if (IsNonTemporal) {
// Set non-temporal hint for all cache levels.
Changed |= setTH(MI, AMDGPU::CPol::TH_NT);
}
return Changed;
}
@@ -14559,7 +14559,7 @@ static SDValue tryFoldSelectIntoOp(SDNode *N, SelectionDAG &DAG,
EVT VT = N->getValueType(0);
SDLoc DL(N);
SDValue OtherOp = TrueVal.getOperand(1 - OpToFold);
EVT OtherOpVT = OtherOp->getValueType(0);
EVT OtherOpVT = OtherOp.getValueType();
SDValue IdentityOperand =
DAG.getNeutralElement(Opc, DL, OtherOpVT, N->getFlags());
if (!Commutative)
@@ -2923,11 +2923,10 @@ bool X86DAGToDAGISel::selectAddr(SDNode *Parent, SDValue N, SDValue &Base,
}
bool X86DAGToDAGISel::selectMOV64Imm32(SDValue N, SDValue &Imm) {
// Cannot use 32 bit constants to reference objects in kernel code model.
// Cannot use 32 bit constants to reference objects in large PIC mode since
// GOTOFF is 64 bits.
// Cannot use 32 bit constants to reference objects in kernel/large code
// model.
if (TM.getCodeModel() == CodeModel::Kernel ||
(TM.getCodeModel() == CodeModel::Large && TM.isPositionIndependent()))
TM.getCodeModel() == CodeModel::Large)
return false;
// In static codegen with small code model, we can get the address of a label
@@ -47038,10 +47038,13 @@ static SDValue combineShiftRightArithmetic(SDNode *N, SelectionDAG &DAG,
if (SDValue V = combineShiftToPMULH(N, DAG, Subtarget))
return V;
// fold (ashr (shl, a, [56,48,32,24,16]), SarConst)
// into (shl, (sext (a), [56,48,32,24,16] - SarConst)) or
// into (lshr, (sext (a), SarConst - [56,48,32,24,16]))
// depending on sign of (SarConst - [56,48,32,24,16])
// fold (SRA (SHL X, ShlConst), SraConst)
// into (SHL (sext_in_reg X), ShlConst - SraConst)
// or (sext_in_reg X)
// or (SRA (sext_in_reg X), SraConst - ShlConst)
// depending on relation between SraConst and ShlConst.
// We only do this if (Size - ShlConst) is equal to 8, 16 or 32. That allows
// us to do the sext_in_reg from corresponding bit.
// sexts in X86 are MOVs. The MOVs have the same code size
// as above SHIFTs (only SHIFT on 1 has lower code size).
@@ -47057,29 +47060,29 @@ static SDValue combineShiftRightArithmetic(SDNode *N, SelectionDAG &DAG,
SDValue N00 = N0.getOperand(0);
SDValue N01 = N0.getOperand(1);
APInt ShlConst = N01->getAsAPIntVal();
APInt SarConst = N1->getAsAPIntVal();
APInt SraConst = N1->getAsAPIntVal();
EVT CVT = N1.getValueType();
if (SarConst.isNegative())
if (CVT != N01.getValueType())
return SDValue();
if (SraConst.isNegative())
return SDValue();
for (MVT SVT : { MVT::i8, MVT::i16, MVT::i32 }) {
unsigned ShiftSize = SVT.getSizeInBits();
// skipping types without corresponding sext/zext and
// ShlConst that is not one of [56,48,32,24,16]
// Only deal with (Size - ShlConst) being equal to 8, 16 or 32.
if (ShiftSize >= Size || ShlConst != Size - ShiftSize)
continue;
SDLoc DL(N);
SDValue NN =
DAG.getNode(ISD::SIGN_EXTEND_INREG, DL, VT, N00, DAG.getValueType(SVT));
SarConst = SarConst - (Size - ShiftSize);
if (SarConst == 0)
if (SraConst.eq(ShlConst))
return NN;
if (SarConst.isNegative())
if (SraConst.ult(ShlConst))
return DAG.getNode(ISD::SHL, DL, VT, NN,
DAG.getConstant(-SarConst, DL, CVT));
DAG.getConstant(ShlConst - SraConst, DL, CVT));
return DAG.getNode(ISD::SRA, DL, VT, NN,
DAG.getConstant(SarConst, DL, CVT));
DAG.getConstant(SraConst - ShlConst, DL, CVT));
}
return SDValue();
}
@@ -244,7 +244,8 @@ public:
// TODO: Currently we're always allowing widening on CPUs without VLX,
// because for many cases we don't have a better option.
bool canExtendTo512DQ() const {
return hasAVX512() && (!hasVLX() || getPreferVectorWidth() >= 512);
return hasAVX512() && hasEVEX512() &&
(!hasVLX() || getPreferVectorWidth() >= 512);
}
bool canExtendTo512BW() const {
return hasBWI() && canExtendTo512DQ();
@@ -1266,8 +1266,10 @@ static void getAvailableFeatures(unsigned ECX, unsigned EDX, unsigned MaxLeaf,
setFeature(X86::FEATURE_AVX2);
if (HasLeaf7 && ((EBX >> 8) & 1))
setFeature(X86::FEATURE_BMI2);
if (HasLeaf7 && ((EBX >> 16) & 1) && HasAVX512Save)
if (HasLeaf7 && ((EBX >> 16) & 1) && HasAVX512Save) {
setFeature(X86::FEATURE_AVX512F);
setFeature(X86::FEATURE_EVEX512);
}
if (HasLeaf7 && ((EBX >> 17) & 1) && HasAVX512Save)
setFeature(X86::FEATURE_AVX512DQ);
if (HasLeaf7 && ((EBX >> 19) & 1))
@@ -1772,6 +1774,8 @@ bool sys::getHostCPUFeatures(StringMap<bool> &Features) {
Features["rtm"] = HasLeaf7 && ((EBX >> 11) & 1);
// AVX512 is only supported if the OS supports the context save for it.
Features["avx512f"] = HasLeaf7 && ((EBX >> 16) & 1) && HasAVX512Save;
if (Features["avx512f"])
Features["evex512"] = true;
Features["avx512dq"] = HasLeaf7 && ((EBX >> 17) & 1) && HasAVX512Save;
Features["rdseed"] = HasLeaf7 && ((EBX >> 18) & 1);
Features["adx"] = HasLeaf7 && ((EBX >> 19) & 1);
@@ -2606,7 +2606,7 @@ static Instruction *foldSelectWithSRem(SelectInst &SI, InstCombinerImpl &IC,
// %cnd = icmp slt i32 %rem, 0
// %add = add i32 %rem, %n
// %sel = select i1 %cnd, i32 %add, i32 %rem
if (match(TrueVal, m_Add(m_Value(RemRes), m_Value(Remainder))) &&
if (match(TrueVal, m_Add(m_Specific(RemRes), m_Value(Remainder))) &&
match(RemRes, m_SRem(m_Value(Op), m_Specific(Remainder))) &&
IC.isKnownToBeAPowerOfTwo(Remainder, /*OrZero*/ true) &&
FalseVal == RemRes)
@@ -279,6 +279,9 @@ bool InductiveRangeCheck::parseRangeCheckICmp(Loop *L, ICmpInst *ICI,
Value *LHS = ICI->getOperand(0);
Value *RHS = ICI->getOperand(1);
if (!LHS->getType()->isIntegerTy())
return false;
// Canonicalize to the `Index Pred Invariant` comparison
if (IsLoopInvariant(LHS)) {
std::swap(LHS, RHS);
@@ -6426,6 +6426,8 @@ void __kmp_env_initialize(char const *string) {
}
if ((__kmp_nested_proc_bind.bind_types[0] != proc_bind_intel) &&
(__kmp_nested_proc_bind.bind_types[0] != proc_bind_default)) {
if (__kmp_nested_proc_bind.bind_types[0] == proc_bind_false)
__kmp_affinity.type = affinity_none;
if (__kmp_affinity.type == affinity_default) {
__kmp_affinity.type = affinity_compact;
__kmp_affinity.flags.dups = FALSE;
@@ -2129,10 +2129,10 @@ int __kmp_is_address_mapped(void *addr) {
// We pass from number of vm entry's semantic
// to size of whole entry map list.
lstsz = lstsz * 4 / 3;
buf = reinterpret_cast<char *>(kmpc_malloc(lstsz));
buf = reinterpret_cast<char *>(KMP_INTERNAL_MALLOC(lstsz));
rc = sysctl(mib, 4, buf, &lstsz, NULL, 0);
if (rc < 0) {
kmpc_free(buf);
KMP_INTERNAL_FREE(buf);
return 0;
}
@@ -2156,7 +2156,7 @@ int __kmp_is_address_mapped(void *addr) {
}
lw += cursz;
}
kmpc_free(buf);
KMP_INTERNAL_FREE(buf);
#elif KMP_OS_DARWIN
+11 -7
View File
@@ -23,10 +23,10 @@ such as renaming, adding or removing zones, please read
"Theory and pragmatics of the tz code and data"
<https://www.iana.org/time-zones/repository/theory.html>.
It is also good to browse the mailing list archives
<https://mm.icann.org/pipermail/tz/> for examples of patches that tend
to work well. Additions to data should contain commentary citing
reliable sources as justification. Citations should use "https:" URLs
if available.
<https://lists.iana.org/hyperkitty/list/[email protected]/>
for examples of patches that tend to work well.
Changes should contain commentary citing reliable sources.
Citations should use "https:" URLs if available.
For changes that fix sensitive security-related bugs, please see the
distribution's 'SECURITY' file.
@@ -63,12 +63,16 @@ If you use Git the following workflow may be helpful:
* Edit source files. Include commentary that justifies the
changes by citing reliable sources.
* Debug the changes, e.g.:
* Debug the changes locally, e.g.:
make check
make install
make TOPDIR=$PWD/tz clean check install
./zdump -v America/Los_Angeles
Although builds assume only basic POSIX, they use extra features
if available. 'make check' accesses validator.w3.org unless you
lack 'curl' or use 'make CURL=:'. If you have the latest GCC,
"make CFLAGS='$(GCC_DEBUG_FLAGS)'" does extra checking.
* For each separable change, commit it in the new branch, e.g.:
git add northamerica
+230 -208
View File
@@ -3,17 +3,17 @@
# 2009-05-17 by Arthur David Olson.
# Request POSIX conformance; this must be the first non-comment line.
.POSIX:
# On older platforms you may need to scrounge for a POSIX-conforming 'make'.
# For example, on Solaris 10 (2005), use /usr/sfw/bin/gmake or
# /usr/xpg4/bin/make, not /usr/ccs/bin/make.
# On older platforms you may need to scrounge for POSIX conformance.
# For example, on Solaris 10 (2005) with Sun Studio 12 aka Sun C 5.9 (2007),
# use 'PATH=/usr/xpg4/bin:$PATH make CC=c99'.
# To affect how this Makefile works, you can run a shell script like this:
#
# #!/bin/sh
# make CC='gcc -std=gnu11' "$@"
# make CC='gcc -std=gnu23' "$@"
#
# This example script is appropriate for a pre-2017 GNU/Linux system
# where a non-default setting is needed to support this package's use of C99.
# This example script is appropriate for a circa 2024 GNU/Linux system
# where a non-default setting enables this package's optional use of C23.
#
# Alternatively, you can simply edit this Makefile to tailor the following
# macro definitions.
@@ -53,7 +53,7 @@ DATAFORM= main
LOCALTIME= Factory
# The POSIXRULES macro controls interpretation of POSIX-2017.1-like TZ
# The POSIXRULES macro controls interpretation of POSIX-like TZ
# settings like TZ='EET-2EEST' that lack DST transition rules.
# If POSIXRULES is '-', no template is installed; this is the default.
# Any other value for POSIXRULES is obsolete and should not be relied on, as:
@@ -132,11 +132,12 @@ LIBDIR = $(TOPDIR)/$(USRDIR)/lib
# Types to try, as an alternative to time_t.
TIME_T_ALTERNATIVES = $(TIME_T_ALTERNATIVES_HEAD) $(TIME_T_ALTERNATIVES_TAIL)
TIME_T_ALTERNATIVES_HEAD = int_least64_t
TIME_T_ALTERNATIVES_TAIL = int_least32_t uint_least32_t uint_least64_t
TIME_T_ALTERNATIVES_HEAD = int_least64_t.ck
TIME_T_ALTERNATIVES_TAIL = int_least32_t.ck uint_least32_t.ck \
uint_least64_t.ck
# What kind of TZif data files to generate. (TZif is the binary time
# zone data format that zic generates; see Internet RFC 8536.)
# zone data format that zic generates; see Internet RFC 9636.)
# If you want only POSIX time, with time values interpreted as
# seconds since the epoch (not counting leap seconds), use
# REDO= posix_only
@@ -219,6 +220,7 @@ LDLIBS=
# than what POSIX specifies, assuming local time is UT.
# For example, N is 252460800 on AmigaOS.
# -DHAVE_DECL_ASCTIME_R=0 if <time.h> does not declare asctime_r
# on POSIX platforms predating POSIX.1-2024
# -DHAVE_DECL_ENVIRON if <unistd.h> declares 'environ'
# -DHAVE_DECL_TIMEGM=0 if <time.h> does not declare timegm
# -DHAVE_DIRECT_H if mkdir needs <direct.h> (MS-Windows)
@@ -229,7 +231,7 @@ LDLIBS=
# where LDLIBS also needs to contain -lintl on some hosts;
# -DHAVE_GETTEXT=0 to avoid using gettext
# -DHAVE_INCOMPATIBLE_CTIME_R if your system's time.h declares
# ctime_r and asctime_r incompatibly with the POSIX standard
# ctime_r and asctime_r incompatibly with POSIX.1-2017 and earlier
# (Solaris when _POSIX_PTHREAD_SEMANTICS is not defined).
# -DHAVE_INTTYPES_H=0 if <inttypes.h> does not work*+
# -DHAVE_LINK=0 if your system lacks a link function
@@ -253,6 +255,7 @@ LDLIBS=
# -DHAVE_UNISTD_H=0 if <unistd.h> does not work*
# -DHAVE_UTMPX_H=0 if <utmpx.h> does not work*
# -Dlocale_t=XXX if your system uses XXX instead of locale_t
# -DMKTIME_MIGHT_OVERFLOW if mktime might fail due to time_t overflow
# -DPORT_TO_C89 if tzcode should also run on mostly-C89 platforms+
# Typically it is better to use a later standard. For example,
# with GCC 4.9.4 (2016), prefer '-std=gnu11' to '-DPORT_TO_C89'.
@@ -260,9 +263,12 @@ LDLIBS=
# feature (integers at least 64 bits wide) and maybe more.
# -DRESERVE_STD_EXT_IDS if your platform reserves standard identifiers
# with external linkage, e.g., applications cannot define 'localtime'.
# -Dssize_t=long on hosts like MS-Windows that lack ssize_t
# -DSUPPORT_C89 if the tzcode library should support C89 callers+
# However, this might trigger latent bugs in C99-or-later callers.
# -Dssize_t=int on hosts like MS-Windows that lack ssize_t
# -DSUPPORT_C89=0 if the tzcode library should not support C89 callers
# Although -DSUPPORT_C89=0 might work around latent bugs in callers,
# it does not conform to POSIX.
# -DSUPPORT_POSIX2008 if the library should support older POSIX callers+
# However, this might cause problems in POSIX.1-2024-or-later callers.
# -DSUPPRESS_TZDIR to not prepend TZDIR to file names; this has
# security implications and is not recommended for general use
# -DTHREAD_SAFE to make localtime.c thread-safe, as POSIX requires;
@@ -274,13 +280,13 @@ LDLIBS=
# -DTZ_DOMAINDIR=\"/path\" to use "/path" for gettext directory;
# the default is system-supplied, typically "/usr/lib/locale"
# -DTZDEFRULESTRING=\",date/time,date/time\" to default to the specified
# DST transitions for POSIX.1-2017-style TZ strings lacking them,
# DST transitions for proleptic format TZ strings lacking them,
# in the usual case where POSIXRULES is '-'. If not specified,
# TZDEFRULESTRING defaults to US rules for future DST transitions.
# This mishandles some past timestamps, as US DST rules have changed.
# It also mishandles settings like TZ='EET-2EEST' for eastern Europe,
# as Europe and US DST rules differ.
# -DTZNAME_MAXIMUM=N to limit time zone abbreviations to N bytes (default 255)
# -DTZNAME_MAXIMUM=N to limit time zone abbreviations to N bytes (default 254)
# -DUNINIT_TRAP if reading uninitialized storage can cause problems
# other than simply getting garbage data
# -DUSE_LTZ=0 to build zdump with the system time zone library
@@ -302,23 +308,26 @@ LDLIBS=
#
# * Options marked "*" can be omitted if your compiler is C23 compatible.
# * Options marked "+" are obsolescent and are planned to be removed
# once the code assumes C99 or later, say in the year 2029.
# once the code assumes C99 or later (say in the year 2029)
# and POSIX.1-2024 or later (say in the year 2034).
#
# Select instrumentation via "make GCC_INSTRUMENT='whatever'".
GCC_INSTRUMENT = \
-fsanitize=undefined -fsanitize-address-use-after-scope \
-fsanitize-undefined-trap-on-error -fstack-protector
# Omit -fanalyzer from GCC_DEBUG_FLAGS, as it makes GCC too slow.
GCC_DEBUG_FLAGS = -DGCC_LINT -g3 -O3 -fno-common \
GCC_DEBUG_FLAGS = -DGCC_LINT -g3 -O3 \
$(GCC_INSTRUMENT) \
-Wall -Wextra \
-Walloc-size-larger-than=100000 -Warray-bounds=2 \
-Wbad-function-cast -Wbidi-chars=any,ucn -Wcast-align=strict -Wdate-time \
-Wbad-function-cast -Wbidi-chars=any,ucn -Wcast-align=strict -Wcast-qual \
-Wdate-time \
-Wdeclaration-after-statement -Wdouble-promotion \
-Wduplicated-branches -Wduplicated-cond \
-Wduplicated-branches -Wduplicated-cond -Wflex-array-member-not-at-end \
-Wformat=2 -Wformat-overflow=2 -Wformat-signedness -Wformat-truncation \
-Wimplicit-fallthrough=5 -Winit-self -Wlogical-op \
-Wmissing-declarations -Wmissing-prototypes -Wnested-externs \
-Wmissing-declarations -Wmissing-prototypes \
-Wmissing-variable-declarations -Wnested-externs \
-Wnull-dereference \
-Wold-style-definition -Woverlength-strings -Wpointer-arith \
-Wshadow -Wshift-overflow=2 -Wstrict-overflow \
@@ -327,10 +336,9 @@ GCC_DEBUG_FLAGS = -DGCC_LINT -g3 -O3 -fno-common \
-Wsuggest-attribute=const -Wsuggest-attribute=format \
-Wsuggest-attribute=malloc \
-Wsuggest-attribute=noreturn -Wsuggest-attribute=pure \
-Wtrampolines -Wundef -Wuninitialized -Wunused-macros -Wuse-after-free=3 \
-Wtrampolines -Wundef -Wunused-macros -Wuse-after-free=3 \
-Wvariadic-macros -Wvla -Wwrite-strings \
-Wno-address -Wno-format-nonliteral -Wno-sign-compare \
-Wno-type-limits
-Wno-format-nonliteral -Wno-sign-compare -Wno-type-limits
#
# If your system has a "GMT offset" field in its "struct tm"s
# (or if you decide to add such a field in your system's "time.h" file),
@@ -341,9 +349,8 @@ GCC_DEBUG_FLAGS = -DGCC_LINT -g3 -O3 -fno-common \
# Similarly, if your system has a "zone abbreviation" field, define
# -DTM_ZONE=tm_zone
# and define NO_TM_ZONE to suppress any guessing.
# Although these two fields are not required by POSIX.1-2017,
# POSIX 202x/D4 requires them and they are widely available
# on GNU/Linux and BSD systems.
# Although POSIX.1-2024 requires these fields and they are widely available
# on GNU/Linux and BSD systems, some older systems lack them.
#
# The next batch of options control support for external variables
# exported by tzcode. In practice these variables are less useful
@@ -353,7 +360,9 @@ GCC_DEBUG_FLAGS = -DGCC_LINT -g3 -O3 -fno-common \
# # -DHAVE_TZNAME=0 # do not support "tzname"
# # -DHAVE_TZNAME=1 # support "tzname", which is defined by system library
# # -DHAVE_TZNAME=2 # support and define "tzname"
# # to the "CFLAGS=" line. "tzname" is required by POSIX.1-1988 and later.
# # to the "CFLAGS=" line. Although "tzname" is required by POSIX.1-1988
# # and later, its contents are unspecified if you use a geographical TZ
# # and the variable is planned to be removed in a future POSIX edition.
# # If not defined, the code attempts to guess HAVE_TZNAME from other macros.
# # Warning: unless time_tz is also defined, HAVE_TZNAME=1 can cause
# # crashes when combined with some platforms' standard libraries,
@@ -364,7 +373,9 @@ GCC_DEBUG_FLAGS = -DGCC_LINT -g3 -O3 -fno-common \
# # -DUSG_COMPAT=1 # support, and variables are defined by system library
# # -DUSG_COMPAT=2 # support and define variables
# # to the "CFLAGS=" line; "timezone" and "daylight" are inspired by Unix
# # Systems Group code and are required by POSIX.1-2008 and later (with XSI).
# # Systems Group code and are required by POSIX.1-2008 and later (with XSI),
# # although their contents are unspecified if you use a geographical TZ
# # and the variables are planned to be removed in a future edition of POSIX.
# # If not defined, the code attempts to guess USG_COMPAT from other macros.
# #
# # To support the external variable "altzone", add
@@ -428,18 +439,13 @@ GCC_DEBUG_FLAGS = -DGCC_LINT -g3 -O3 -fno-common \
# The name of a POSIX-like library archiver, its flags, C compiler,
# linker flags, and 'make' utility. Ordinarily the defaults suffice.
# The commented-out values are the defaults specified by POSIX.1-202x/D4.
# The commented-out values are the defaults specified by POSIX.1-2024.
#AR = ar
#ARFLAGS = -rv
#CC = c17
#LDFLAGS =
#MAKE = make
# For leap seconds, this Makefile uses LEAPSECONDS='-L leapseconds' in
# submake command lines. The default is no leap seconds.
LEAPSECONDS=
# Where to fetch leap-seconds.list from.
leaplist_URI = \
https://hpiers.obspm.fr/iers/bul/bulc/ntp/leap-seconds.list
@@ -461,7 +467,7 @@ ZFLAGS=
# How to use zic to install TZif files.
ZIC_INSTALL= $(ZIC) -d '$(DESTDIR)$(TZDIR)' $(LEAPSECONDS)
ZIC_INSTALL= $(ZIC) -d '$(DESTDIR)$(TZDIR)'
# The name of a POSIX-compliant 'awk' on your system.
# mawk 1.3.3 and Solaris 10 /usr/bin/awk do not work.
@@ -480,6 +486,7 @@ KSHELL= /bin/bash
# Name of curl <https://curl.haxx.se/>, used for HTML validation
# and to fetch leap-seconds.list from upstream.
# Set CURL=: to disable use of the Internet.
CURL= curl
# Name of GNU Privacy Guard <https://gnupg.org/>, used to sign distributions.
@@ -533,21 +540,28 @@ OK_LINE= '^'$(OK_CHAR)'*$$'
# Flags to give 'tar' when making a distribution.
# Try to use flags appropriate for GNU tar.
GNUTARFLAGS= --format=pax --pax-option='delete=atime,delete=ctime' \
GNUTARFLAGS= --format=pax --pax-option=delete=atime,delete=ctime \
--numeric-owner --owner=0 --group=0 \
--mode=go+u,go-w --sort=name
TARFLAGS= `if tar $(GNUTARFLAGS) --version >/dev/null 2>&1; \
then echo $(GNUTARFLAGS); \
else :; \
fi`
SETUP_TAR= \
export LC_ALL=C && \
if tar $(GNUTARFLAGS) --version >/dev/null 2>&1; then \
TAR='tar $(GNUTARFLAGS)'; \
else \
TAR=tar; \
fi
# Flags to give 'gzip' when making a distribution.
GZIPFLAGS= -9n
# When comparing .tzs files, use GNU diff's -F'^TZ=' option if supported.
# This makes it easier to see which Zone has been affected.
DIFF_TZS= diff -u$$(! diff -u -F'^TZ=' - - <>/dev/null >&0 2>&1 \
|| echo ' -F^TZ=')
SETUP_DIFF_TZS = \
if diff -u -F'^TZ=' - - <>/dev/null >&0 2>&1; then \
DIFF_TZS='diff -u -F^TZ='; \
else \
DIFF_TZS='diff -u'; \
fi
# ':' on typical hosts; 'ranlib' on the ancient hosts that still need ranlib.
RANLIB= :
@@ -561,8 +575,8 @@ RANLIB= :
TZCOBJS= zic.o
TZDOBJS= zdump.o localtime.o asctime.o strftime.o
DATEOBJS= date.o localtime.o strftime.o asctime.o
TZDOBJS= zdump.o localtime.o strftime.o
DATEOBJS= date.o localtime.o strftime.o
LIBSRCS= localtime.c asctime.c difftime.c strftime.c
LIBOBJS= localtime.o asctime.o difftime.o strftime.o
HEADERS= tzfile.h private.h
@@ -579,8 +593,7 @@ MANTXTS= newctime.3.txt newstrftime.3.txt newtzset.3.txt \
COMMON= calendars CONTRIBUTING LICENSE Makefile \
NEWS README SECURITY theory.html version
WEB_PAGES= tz-art.html tz-how-to.html tz-link.html
CHECK_WEB_PAGES=check_theory.html check_tz-art.html \
check_tz-how-to.html check_tz-link.html
CHECK_WEB_PAGES=theory.ck tz-art.ck tz-how-to.ck tz-link.ck
DOCS= $(MANS) date.1 $(MANTXTS) $(WEB_PAGES)
PRIMARY_YDATA= africa antarctica asia australasia \
europe northamerica southamerica
@@ -603,8 +616,8 @@ TZS_YEAR= 2050
TZS_CUTOFF_FLAG= -c $(TZS_YEAR)
TZS= to$(TZS_YEAR).tzs
TZS_NEW= to$(TZS_YEAR)new.tzs
TZS_DEPS= $(YDATA) asctime.c localtime.c \
private.h tzfile.h zdump.c zic.c
TZS_DEPS= $(YDATA) localtime.c private.h \
strftime.c tzfile.h zdump.c zic.c
TZDATA_DIST = $(COMMON) $(DATA) $(MISC)
# EIGHT_YARDS is just a yard short of the whole ENCHILADA.
EIGHT_YARDS = $(TZDATA_DIST) $(DOCS) $(SOURCES) tzdata.zi
@@ -641,8 +654,7 @@ install: all $(DATA) $(REDO) $(MANS)
'$(DESTDIR)$(MANDIR)/man3' '$(DESTDIR)$(MANDIR)/man5' \
'$(DESTDIR)$(MANDIR)/man8'
$(ZIC_INSTALL) -l $(LOCALTIME) \
`case '$(POSIXRULES)' in ?*) echo '-p';; esac \
` $(POSIXRULES) \
-p $(POSIXRULES) \
-t '$(DESTDIR)$(TZDEFAULT)'
cp -f $(TABDATA) '$(DESTDIR)$(TZDIR)/.'
cp tzselect '$(DESTDIR)$(BINDIR)/.'
@@ -665,10 +677,10 @@ INSTALL: ALL install date.1
# and append "-dirty" if the contents do not already end in "-dirty".
version: $(VERSION_DEPS)
{ (type git) >/dev/null 2>&1 && \
V=`git describe --match '[0-9][0-9][0-9][0-9][a-z]*' \
--abbrev=7 --dirty` || \
if test '$(VERSION)' = unknown && V=`cat $@`; then \
case $$V in *-dirty);; *) V=$$V-dirty;; esac; \
V=$$(git describe --match '[0-9][0-9][0-9][0-9][a-z]*' \
--abbrev=7 --dirty) || \
if test '$(VERSION)' = unknown && read -r V <$@; then \
V=$${V%-dirty}-dirty; \
else \
V='$(VERSION)'; \
fi; } && \
@@ -678,7 +690,7 @@ version: $(VERSION_DEPS)
# These files can be tailored by setting BACKWARD, PACKRATDATA, PACKRATLIST.
vanguard.zi main.zi rearguard.zi: $(DSTDATA_ZI_DEPS)
$(AWK) \
-v DATAFORM=`expr $@ : '\(.*\).zi'` \
-v DATAFORM=$(@:.zi=) \
-v PACKRATDATA='$(PACKRATDATA)' \
-v PACKRATLIST='$(PACKRATLIST)' \
-f ziguard.awk \
@@ -687,7 +699,7 @@ vanguard.zi main.zi rearguard.zi: $(DSTDATA_ZI_DEPS)
# This file has a version comment that attempts to capture any tailoring
# via BACKWARD, DATAFORM, PACKRATDATA, PACKRATLIST, and REDO.
tzdata.zi: $(DATAFORM).zi version zishrink.awk
version=`sed 1q version` && \
read -r version <version && \
LC_ALL=C $(AWK) \
-v dataform='$(DATAFORM)' \
-v deps='$(DSTDATA_ZI_DEPS) zishrink.awk' \
@@ -708,7 +720,7 @@ tzdir.h:
mv $@.out $@
version.h: version
VERSION=`cat version` && printf '%s\n' \
read -r VERSION <version && printf '%s\n' \
'static char const PKGVERSION[]="($(PACKAGE)) ";' \
"static char const TZVERSION[]=\"$$VERSION\";" \
'static char const REPORT_BUGS_TO[]="$(BUGEMAIL)";' \
@@ -748,12 +760,11 @@ commit-leap-seconds.list: fetch-leap-seconds.list
git commit --author="$$author" --date="$$date" -m'make $@' \
leap-seconds.list
# Arguments to pass to submakes of install_data.
# Arguments to pass to submakes.
# They can be overridden by later submake arguments.
INSTALLARGS = \
BACKWARD='$(BACKWARD)' \
DESTDIR='$(DESTDIR)' \
LEAPSECONDS='$(LEAPSECONDS)' \
PACKRATDATA='$(PACKRATDATA)' \
PACKRATLIST='$(PACKRATLIST)' \
TZDEFAULT='$(TZDEFAULT)' \
@@ -762,16 +773,11 @@ INSTALLARGS = \
INSTALL_DATA_DEPS = zic leapseconds tzdata.zi
# 'make install_data' installs one set of TZif files.
install_data: $(INSTALL_DATA_DEPS)
posix_only: $(INSTALL_DATA_DEPS)
$(ZIC_INSTALL) tzdata.zi
posix_only: $(INSTALL_DATA_DEPS)
$(MAKE) $(INSTALLARGS) LEAPSECONDS= install_data
right_only: $(INSTALL_DATA_DEPS)
$(MAKE) $(INSTALLARGS) LEAPSECONDS='-L leapseconds' \
install_data
$(ZIC_INSTALL) -L leapseconds tzdata.zi
# In earlier versions of this makefile, the other two directories were
# subdirectories of $(TZDIR). However, this led to configuration errors.
@@ -802,8 +808,7 @@ ZDS = dummy.zd
# Rule used only by submakes invoked by the $(TZS_NEW) rule.
# It is separate so that GNU 'make -j' can run instances in parallel.
$(ZDS): zdump
./zdump -i $(TZS_CUTOFF_FLAG) '$(wd)/'$$(expr $@ : '\(.*\).zd') \
>$@
./zdump -i $(TZS_CUTOFF_FLAG) "$$PWD/$(@:.zd=)" >$@
TZS_NEW_DEPS = tzdata.zi zdump zic
$(TZS_NEW): $(TZS_NEW_DEPS)
@@ -812,20 +817,19 @@ $(TZS_NEW): $(TZS_NEW_DEPS)
$(zic) -d tzs$(TZS_YEAR).dir tzdata.zi
$(AWK) '/^L/{print "Link\t" $$2 "\t" $$3}' \
tzdata.zi | LC_ALL=C sort >$@.out
wd=`pwd` && \
x=`$(AWK) '/^Z/{print "tzs$(TZS_YEAR).dir/" $$2 ".zd"}' \
x=$$($(AWK) '/^Z/{print "tzs$(TZS_YEAR).dir/" $$2 ".zd"}' \
tzdata.zi \
| LC_ALL=C sort -t . -k 2,2` && \
| LC_ALL=C sort -t . -k 2,2) && \
set x $$x && \
shift && \
ZDS=$$* && \
$(MAKE) wd="$$wd" TZS_CUTOFF_FLAG="$(TZS_CUTOFF_FLAG)" \
$(MAKE) TZS_CUTOFF_FLAG="$(TZS_CUTOFF_FLAG)" \
ZDS="$$ZDS" $$ZDS && \
sed 's,^TZ=".*\.dir/,TZ=",' $$ZDS >>$@.out
rm -fr tzs$(TZS_YEAR).dir
mv $@.out $@
# If $(TZS) exists but 'make check_tzs' fails, a maintainer should inspect the
# If $(TZS) exists but 'make tzs.ck' fails, a maintainer should inspect the
# failed output and fix the inconsistency, perhaps by running 'make force_tzs'.
$(TZS):
touch $@
@@ -842,7 +846,7 @@ date: $(DATEOBJS)
$(CC) -o $@ $(CFLAGS) $(LDFLAGS) $(DATEOBJS) $(LDLIBS)
tzselect: tzselect.ksh version
VERSION=`cat version` && sed \
read -r VERSION <version && sed \
-e "s'#!/bin/bash'#!"'$(KSHELL)'\' \
-e s\''\(AWK\)=[^}]*'\''\1=\'\''$(AWK)\'\'\' \
-e s\''\(PKGVERSION\)=.*'\''\1=\'\''($(PACKAGE)) \'\'\' \
@@ -853,11 +857,11 @@ tzselect: tzselect.ksh version
chmod +x $@.out
mv $@.out $@
check: check_back check_mild
check_mild: check_character_set check_white_space check_links \
check_name_lengths check_now \
check_slashed_abbrs check_sorted \
check_tables check_web check_ziguard check_zishrink check_tzs
check: check_mild back.ck now.ck
check_mild: check_web check_zishrink \
character-set.ck white-space.ck links.ck mainguard.ck \
name-lengths.ck slashed-abbrs.ck sorted.ck \
tables.ck ziguard.ck tzs.ck
# True if UTF8_LOCALE does not work;
# otherwise, false but with LC_ALL set to $(UTF8_LOCALE).
@@ -865,9 +869,9 @@ UTF8_LOCALE_MISSING = \
{ test ! '$(UTF8_LOCALE)' \
|| ! printf 'A\304\200B\n' \
| LC_ALL='$(UTF8_LOCALE)' grep -q '^A.B$$' >/dev/null 2>&1 \
|| { LC_ALL='$(UTF8_LOCALE)'; export LC_ALL; false; }; }
|| { export LC_ALL='$(UTF8_LOCALE)'; false; }; }
check_character_set: $(ENCHILADA)
character-set.ck: $(ENCHILADA)
$(UTF8_LOCALE_MISSING) || { \
sharp='#' && \
! grep -Env $(SAFE_LINE) $(MANS) date.1 $(MANTXTS) \
@@ -882,48 +886,55 @@ check_character_set: $(ENCHILADA)
}
touch $@
check_white_space: $(ENCHILADA)
white-space.ck: $(ENCHILADA)
$(UTF8_LOCALE_MISSING) || { \
patfmt=' \t|[\f\r\v]' && pat=`printf "$$patfmt\\n"` && \
enchilada='$(ENCHILADA)' && \
patfmt=' \t|[\f\r\v]' && pat=$$(printf "$$patfmt\\n") && \
! grep -En "$$pat|[$s]\$$" \
$$(ls $(ENCHILADA) | grep -Fvx leap-seconds.list); \
$${enchilada%leap-seconds.list*} \
$${enchilada#*leap-seconds.list}; \
}
touch $@
PRECEDES_FILE_NAME = ^(Zone|Link[$s]+[^$s]+)[$s]+
FILE_NAME_COMPONENT_TOO_LONG = $(PRECEDES_FILE_NAME)[^$s]*[^/$s]{15}
check_name_lengths: $(TDATA_TO_CHECK) backzone
! grep -En '$(FILE_NAME_COMPONENT_TOO_LONG)' \
name-lengths.ck: $(TDATA_TO_CHECK) backzone
:;! grep -En '$(FILE_NAME_COMPONENT_TOO_LONG)' \
$(TDATA_TO_CHECK) backzone
touch $@
mainguard.ck: main.zi
test '$(PACKRATLIST)' || \
cat $(TDATA) $(PACKRATDATA) | diff -u - main.zi
touch $@
PRECEDES_STDOFF = ^(Zone[$s]+[^$s]+)?[$s]+
STDOFF = [-+]?[0-9:.]+
RULELESS_SAVE = (-|$(STDOFF)[sd]?)
RULELESS_SLASHED_ABBRS = \
$(PRECEDES_STDOFF)$(STDOFF)[$s]+$(RULELESS_SAVE)[$s]+[^$s]*/
check_slashed_abbrs: $(TDATA_TO_CHECK)
! grep -En '$(RULELESS_SLASHED_ABBRS)' $(TDATA_TO_CHECK)
slashed-abbrs.ck: $(TDATA_TO_CHECK)
:;! grep -En '$(RULELESS_SLASHED_ABBRS)' $(TDATA_TO_CHECK)
touch $@
CHECK_CC_LIST = { n = split($$1,a,/,/); for (i=2; i<=n; i++) print a[1], a[i]; }
check_sorted: backward backzone
sorted.ck: backward backzone
$(AWK) '/^Link/ {printf "%.5d %s\n", g, $$3} !/./ {g++}' \
backward | LC_ALL=C sort -cu
$(AWK) '/^Zone/ {print $$2}' backzone | LC_ALL=C sort -cu
$(AWK) '/^Zone.*\// {print $$2}' backzone | LC_ALL=C sort -cu
touch $@
check_back: checklinks.awk $(TDATA_TO_CHECK)
back.ck: checklinks.awk $(TDATA_TO_CHECK)
$(AWK) \
-v DATAFORM=$(DATAFORM) \
-v backcheck=backward \
-f checklinks.awk $(TDATA_TO_CHECK)
touch $@
check_links: checklinks.awk tzdata.zi
links.ck: checklinks.awk tzdata.zi
$(AWK) \
-v DATAFORM=$(DATAFORM) \
-f checklinks.awk tzdata.zi
@@ -932,26 +943,36 @@ check_links: checklinks.awk tzdata.zi
# Check timestamps from now through 28 years from now, to make sure
# that zonenow.tab contains all sequences of planned timestamps,
# without any duplicate sequences. In theory this might require
# 2800 years but that would take a long time to check.
CHECK_NOW_TIMESTAMP = `./date +%s`
# 2800+ years but that would take a long time to check.
CHECK_NOW_TIMESTAMP = $$(./date +%s)
CHECK_NOW_FUTURE_YEARS = 28
CHECK_NOW_FUTURE_SECS = $(CHECK_NOW_FUTURE_YEARS) '*' 366 '*' 24 '*' 60 '*' 60
check_now: checknow.awk date tzdata.zi zdump zic zone1970.tab zonenow.tab
rm -fr $@.dir
mkdir $@.dir
./zic -d $@.dir tzdata.zi
CHECK_NOW_FUTURE_SECS = $(CHECK_NOW_FUTURE_YEARS) * 366 * 24 * 60 * 60
now.ck: checknow.awk date tzdata.zi zdump zic zone1970.tab zonenow.tab
rm -fr $@d
mkdir $@d
./zic -d $@d tzdata.zi
now=$(CHECK_NOW_TIMESTAMP) && \
future=`expr $(CHECK_NOW_FUTURE_SECS) + $$now` && \
future=$$(($(CHECK_NOW_FUTURE_SECS) + $$now)) && \
./zdump -i -t $$now,$$future \
$$(find $$PWD/$@.dir/????*/ -type f) \
>$@.dir/zdump.tab
$$(find "$$PWD/$@d"/????*/ -type f) \
>$@d/zdump-now.tab && \
./zdump -i -t 0,$$future \
$$(find "$$PWD/$@d" -name Etc -prune \
-o -type f ! -name '*.tab' -print) \
>$@d/zdump-1970.tab
$(AWK) \
-v zdump_table=$@.dir/zdump.tab \
-v zdump_table=$@d/zdump-now.tab \
-f checknow.awk zonenow.tab
rm -fr $@.dir
$(AWK) \
'BEGIN {print "-\t-\tUTC"} /^Zone/ {print "-\t-\t" $$2}' \
$(PRIMARY_YDATA) backward factory | \
$(AWK) \
-v zdump_table=$@d/zdump-1970.tab \
-f checknow.awk
rm -fr $@d
touch $@
check_tables: checktab.awk $(YDATA) backward zone.tab zone1970.tab
tables.ck: checktab.awk $(YDATA) backward zone.tab zone1970.tab
for tab in $(ZONETABLES); do \
test "$$tab" = zone.tab && links='$(BACKWARD)' || links=''; \
$(AWK) -f checktab.awk -v zone_table=$$tab $(YDATA) $$links \
@@ -959,26 +980,24 @@ check_tables: checktab.awk $(YDATA) backward zone.tab zone1970.tab
done
touch $@
check_tzs: $(TZS) $(TZS_NEW)
tzs.ck: $(TZS) $(TZS_NEW)
if test -s $(TZS); then \
$(DIFF_TZS) $(TZS) $(TZS_NEW); \
$(SETUP_DIFF_TZS) && $$DIFF_TZS $(TZS) $(TZS_NEW); \
else \
cp $(TZS_NEW) $(TZS); \
fi
touch $@
check_web: $(CHECK_WEB_PAGES)
check_theory.html: theory.html
check_tz-art.html: tz-art.html
check_tz-how-to.html: tz-how-to.html
check_tz-link.html: tz-link.html
check_theory.html check_tz-art.html check_tz-how-to.html check_tz-link.html:
$(CURL) -sS --url https://validator.w3.org/nu/ -F out=gnu \
-F file=@$$(expr $@ : 'check_\(.*\)') -o $@.out && \
.SUFFIXES: .ck .html
.html.ck:
{ ! ($(CURL) --version) >/dev/null 2>&1 || \
$(CURL) -sS --url https://validator.w3.org/nu/ -F out=gnu \
-F file=@$<; } >$@.out && \
test ! -s $@.out || { cat $@.out; exit 1; }
mv $@.out $@
check_ziguard: rearguard.zi vanguard.zi ziguard.awk
ziguard.ck: rearguard.zi vanguard.zi ziguard.awk
$(AWK) -v DATAFORM=rearguard -f ziguard.awk vanguard.zi | \
diff -u rearguard.zi -
$(AWK) -v DATAFORM=vanguard -f ziguard.awk rearguard.zi | \
@@ -987,36 +1006,35 @@ check_ziguard: rearguard.zi vanguard.zi ziguard.awk
# Check that zishrink.awk does not alter the data, and that ziguard.awk
# preserves main-format data.
check_zishrink: check_zishrink_posix check_zishrink_right
check_zishrink_posix check_zishrink_right: \
check_zishrink: zishrink-posix.ck zishrink-right.ck
zishrink-posix.ck zishrink-right.ck: \
zic leapseconds $(PACKRATDATA) $(PACKRATLIST) \
$(TDATA) $(DATAFORM).zi tzdata.zi
rm -fr $@.dir $@-t.dir $@-shrunk.dir
mkdir $@.dir $@-t.dir $@-shrunk.dir
rm -fr $@d t-$@d shrunk-$@d
mkdir $@d t-$@d shrunk-$@d
case $@ in \
*_right) leap='-L leapseconds';; \
*right*) leap='-L leapseconds';; \
*) leap=;; \
esac && \
$(ZIC) $$leap -d $@.dir $(DATAFORM).zi && \
$(ZIC) $$leap -d $@-shrunk.dir tzdata.zi && \
$(ZIC) $$leap -d $@d $(DATAFORM).zi && \
$(ZIC) $$leap -d shrunk-$@d tzdata.zi && \
case $(DATAFORM),$(PACKRATLIST) in \
main,) \
$(ZIC) $$leap -d $@-t.dir $(TDATA) && \
$(ZIC) $$leap -d t-$@d $(TDATA) && \
$(AWK) '/^Rule/' $(TDATA) | \
$(ZIC) $$leap -d $@-t.dir - $(PACKRATDATA) && \
diff -r $@.dir $@-t.dir;; \
$(ZIC) $$leap -d t-$@d - $(PACKRATDATA) && \
diff -r $@d t-$@d;; \
esac
diff -r $@.dir $@-shrunk.dir
rm -fr $@.dir $@-t.dir $@-shrunk.dir
diff -r $@d shrunk-$@d
rm -fr $@d t-$@d shrunk-$@d
touch $@
clean_misc:
rm -fr check_*.dir typecheck_*.dir
rm -f *.o *.out $(TIME_T_ALTERNATIVES) \
check_* core typecheck_* \
rm -fr *.ckd *.dir
rm -f *.ck *.core *.o *.out core core.* \
date tzdir.h tzselect version.h zdump zic libtz.a
clean: clean_misc
rm -fr *.dir tzdb-*/
rm -fr tzdb-*/
rm -f *.zi $(TZS_NEW)
maintainer-clean: clean
@@ -1027,7 +1045,7 @@ maintainer-clean: clean
names:
@echo $(ENCHILADA)
public: check check_public $(CHECK_TIME_T_ALTERNATIVES) \
public: check public.ck $(CHECK_TIME_T_ALTERNATIVES) \
tarballs signatures
date.1.txt: date.1
@@ -1041,7 +1059,7 @@ zdump.8.txt: zdump.8
zic.8.txt: zic.8
$(MANTXTS): workman.sh
LC_ALL=C sh workman.sh `expr $@ : '\(.*\)\.txt$$'` >$@.out
LC_ALL=C sh workman.sh $(@:.txt=) >$@.out
mv $@.out $@
# Set file timestamps deterministically if possible,
@@ -1054,13 +1072,13 @@ SET_TIMESTAMP_N = sh -c '\
n=$$0 dest=$$1; shift; \
<"$$dest" && \
if test $$n != 0 && \
lsout=`ls -nt --time-style="+%s" "$$@" 2>/dev/null`; then \
lsout=$$(ls -nt --time-style="+%s" "$$@" 2>/dev/null); then \
set x $$lsout && \
timestamp=`expr $$7 + $$n` && \
timestamp=$$(($$7 + $$n)) && \
echo "+ touch -md @$$timestamp $$dest" && \
touch -md @$$timestamp "$$dest"; \
else \
newest=`ls -t "$$@" | sed 1q` && \
newest=$$(ls -t "$$@" | sed 1q) && \
echo "+ touch -mr $$newest $$dest" && \
touch -mr "$$newest" "$$dest"; \
fi'
@@ -1083,15 +1101,15 @@ SET_TIMESTAMP_DEP = $(SET_TIMESTAMP_N) 1
set-timestamps.out: $(EIGHT_YARDS)
rm -f $@
if (type git) >/dev/null 2>&1 && \
files=`git ls-files $(EIGHT_YARDS)` && \
files=$$(git ls-files $(EIGHT_YARDS)) && \
touch -md @1 test.out; then \
rm -f test.out && \
for file in $$files; do \
if git diff --quiet $$file; then \
time=`TZ=UTC0 git log -1 \
if git diff --quiet HEAD $$file; then \
time=$$(TZ=UTC0 git log -1 \
--format='tformat:%cd' \
--date='format:%Y-%m-%dT%H:%M:%SZ' \
$$file` && \
$$file) && \
echo "+ touch -md $$time $$file" && \
touch -md $$time $$file; \
else \
@@ -1100,8 +1118,8 @@ set-timestamps.out: $(EIGHT_YARDS)
done; \
fi
$(SET_TIMESTAMP_DEP) leapseconds $(LEAP_DEPS)
for file in `ls $(MANTXTS) | sed 's/\.txt$$//'`; do \
$(SET_TIMESTAMP_DEP) $$file.txt $$file workman.sh || \
for file in $(MANTXTS); do \
$(SET_TIMESTAMP_DEP) $$file $${file%.txt} workman.sh || \
exit; \
done
$(SET_TIMESTAMP_DEP) version $(VERSION_DEPS)
@@ -1114,30 +1132,29 @@ set-tzs-timestamp.out: $(TZS)
# The zics below ensure that each data file can stand on its own.
# We also do an all-files run to catch links to links.
check_public: $(VERSION_DEPS)
rm -fr public.dir
mkdir public.dir
ln $(VERSION_DEPS) public.dir
cd public.dir \
public.ck: $(VERSION_DEPS)
rm -fr $@d
mkdir $@d
ln $(VERSION_DEPS) $@d
cd $@d \
&& $(MAKE) CFLAGS='$(GCC_DEBUG_FLAGS)' TZDIR='$(TZDIR)' ALL
for i in $(TDATA_TO_CHECK) public.dir/tzdata.zi \
public.dir/vanguard.zi public.dir/main.zi \
public.dir/rearguard.zi; \
for i in $(TDATA_TO_CHECK) \
tzdata.zi vanguard.zi main.zi rearguard.zi; \
do \
public.dir/zic -v -d public.dir/zoneinfo $$i 2>&1 || exit; \
$@d/zic -v -d $@d/zoneinfo $@d/$$i || exit; \
done
public.dir/zic -v -d public.dir/zoneinfo-all $(TDATA_TO_CHECK)
$@d/zic -v -d $@d/zoneinfo-all $(TDATA_TO_CHECK)
:
: Also check 'backzone' syntax.
rm public.dir/main.zi
cd public.dir && $(MAKE) PACKRATDATA=backzone main.zi
public.dir/zic -d public.dir/zoneinfo main.zi
rm public.dir/main.zi
cd public.dir && \
rm $@d/main.zi
cd $@d && $(MAKE) PACKRATDATA=backzone main.zi
$@d/zic -d $@d/zoneinfo main.zi
rm $@d/main.zi
cd $@d && \
$(MAKE) PACKRATDATA=backzone PACKRATLIST=zone.tab main.zi
public.dir/zic -d public.dir/zoneinfo main.zi
$@d/zic -d $@d/zoneinfo main.zi
:
rm -fr public.dir
rm -fr $@d
touch $@
# Check that the code works under various alternative
@@ -1145,46 +1162,47 @@ check_public: $(VERSION_DEPS)
check_time_t_alternatives: $(TIME_T_ALTERNATIVES)
$(TIME_T_ALTERNATIVES_TAIL): $(TIME_T_ALTERNATIVES_HEAD)
$(TIME_T_ALTERNATIVES): $(VERSION_DEPS)
rm -fr $@.dir
mkdir $@.dir
ln $(VERSION_DEPS) $@.dir
rm -fr $@d
mkdir $@d
ln $(VERSION_DEPS) $@d
case $@ in \
int*32_t) range=-2147483648,2147483648;; \
*32_t*) range=-2147483648,2147483648;; \
u*) range=0,4294967296;; \
*) range=-4294967296,4294967296;; \
esac && \
wd=`pwd` && \
zones=`$(AWK) '/^[^#]/ { print $$3 }' <zone1970.tab` && \
wd=$$PWD && \
zones=$$($(AWK) '/^[^#]/ { print $$3 }' <zone1970.tab) && \
if test $@ = $(TIME_T_ALTERNATIVES_HEAD); then \
range_target=; \
else \
range_target=to$$range.tzs; \
fi && \
(cd $@.dir && \
$(MAKE) TOPDIR="$$wd/$@.dir" \
CFLAGS='$(CFLAGS) -Dtime_tz='"'$@'" \
(cd $@d && \
$(MAKE) TOPDIR="$$wd/$@d" \
CFLAGS='$(CFLAGS) -Dtime_tz='"'$(@:.ck=)'" \
REDO='$(REDO)' \
D=$$wd/$@.dir \
D="$$wd/$@d" \
TZS_YEAR="$$range" TZS_CUTOFF_FLAG="-t $$range" \
install $$range_target) && \
test $@ = $(TIME_T_ALTERNATIVES_HEAD) || { \
(cd $(TIME_T_ALTERNATIVES_HEAD).dir && \
$(MAKE) TOPDIR="$$wd/$@.dir" \
(cd $(TIME_T_ALTERNATIVES_HEAD)d && \
$(MAKE) TOPDIR="$$wd/$@d" \
TZS_YEAR="$$range" TZS_CUTOFF_FLAG="-t $$range" \
D=$$wd/$@.dir \
D="$$wd/$@d" \
to$$range.tzs) && \
$(DIFF_TZS) $(TIME_T_ALTERNATIVES_HEAD).dir/to$$range.tzs \
$@.dir/to$$range.tzs && \
$(SETUP_DIFF_TZS) && \
$$DIFF_TZS $(TIME_T_ALTERNATIVES_HEAD)d/to$$range.tzs \
$@d/to$$range.tzs && \
if diff -q Makefile Makefile 2>/dev/null; then \
quiet_option='-q'; \
else \
quiet_option=''; \
fi && \
diff $$quiet_option -r $(TIME_T_ALTERNATIVES_HEAD).dir/etc \
$@.dir/etc && \
diff $$quiet_option -r $(TIME_T_ALTERNATIVES_HEAD)d/etc \
$@d/etc && \
diff $$quiet_option -r \
$(TIME_T_ALTERNATIVES_HEAD).dir/usr/share \
$@.dir/usr/share; \
$(TIME_T_ALTERNATIVES_HEAD)d/usr/share \
$@d/usr/share; \
}
touch $@
@@ -1199,7 +1217,7 @@ ALL_ASC = $(TRADITIONAL_ASC) $(REARGUARD_ASC) \
tarballs rearguard_tarballs tailored_tarballs traditional_tarballs \
signatures rearguard_signatures traditional_signatures: \
version set-timestamps.out rearguard.zi vanguard.zi
VERSION=`cat version` && \
read -r VERSION <version && \
$(MAKE) AWK='$(AWK)' VERSION="$$VERSION" $@_version
# These *_version rules are intended for use if VERSION is set by some
@@ -1218,15 +1236,15 @@ rearguard_signatures_version: $(REARGUARD_ASC)
traditional_signatures_version: $(TRADITIONAL_ASC)
tzcode$(VERSION).tar.gz: set-timestamps.out
LC_ALL=C && export LC_ALL && \
tar $(TARFLAGS) -cf - \
$(SETUP_TAR) && \
$$TAR -cf - \
$(COMMON) $(DOCS) $(SOURCES) | \
gzip $(GZIPFLAGS) >$@.out
mv $@.out $@
tzdata$(VERSION).tar.gz: set-timestamps.out
LC_ALL=C && export LC_ALL && \
tar $(TARFLAGS) -cf - $(TZDATA_DIST) | \
$(SETUP_TAR) && \
$$TAR -cf - $(TZDATA_DIST) | \
gzip $(GZIPFLAGS) >$@.out
mv $@.out $@
@@ -1251,9 +1269,9 @@ tzdata$(VERSION)-rearguard.tar.gz: rearguard.zi set-timestamps.out
: The dummy pacificnew pacifies TZUpdater 2.3.1 and earlier.
$(CREATE_EMPTY) $@.dir/pacificnew
touch -mr version $@.dir/version
LC_ALL=C && export LC_ALL && \
$(SETUP_TAR) && \
(cd $@.dir && \
tar $(TARFLAGS) -cf - \
$$TAR -cf - \
$(TZDATA_DIST) pacificnew | \
gzip $(GZIPFLAGS)) >$@.out
mv $@.out $@
@@ -1269,9 +1287,14 @@ tzdata$(VERSION)-tailored.tar.gz: set-timestamps.out
rm -fr $@.dir
mkdir $@.dir
: The dummy pacificnew pacifies TZUpdater 2.3.1 and earlier.
if test $(DATAFORM) = vanguard; then \
pacificnew=; \
else \
pacificnew=pacificnew; \
fi && \
cd $@.dir && \
$(CREATE_EMPTY) $(PRIMARY_YDATA) $(NDATA) backward \
`test $(DATAFORM) = vanguard || echo pacificnew`
$$pacificnew
(grep '^#' tzdata.zi && echo && cat $(DATAFORM).zi) \
>$@.dir/etcetera
touch -mr tzdata.zi $@.dir/etcetera
@@ -1291,9 +1314,9 @@ tzdata$(VERSION)-tailored.tar.gz: set-timestamps.out
test -f $@.dir/$$file || links="$$links $$file"; \
done && \
ln $$links $@.dir
LC_ALL=C && export LC_ALL && \
$(SETUP_TAR) && \
(cd $@.dir && \
tar $(TARFLAGS) -cf - * | gzip $(GZIPFLAGS)) >$@.out
$$TAR -cf - * | gzip $(GZIPFLAGS)) >$@.out
mv $@.out $@
tzdb-$(VERSION).tar.lz: set-timestamps.out set-tzs-timestamp.out
@@ -1301,8 +1324,8 @@ tzdb-$(VERSION).tar.lz: set-timestamps.out set-tzs-timestamp.out
mkdir tzdb-$(VERSION)
ln $(ENCHILADA) tzdb-$(VERSION)
$(SET_TIMESTAMP) tzdb-$(VERSION) tzdb-$(VERSION)/*
LC_ALL=C && export LC_ALL && \
tar $(TARFLAGS) -cf - tzdb-$(VERSION) | lzip -9 >$@.out
$(SETUP_TAR) && \
$$TAR -cf - tzdb-$(VERSION) | lzip -9 >$@.out
mv $@.out $@
tzcode$(VERSION).tar.gz.asc: tzcode$(VERSION).tar.gz
@@ -1313,41 +1336,40 @@ $(ALL_ASC):
$(GPG) --armor --detach-sign $?
TYPECHECK_CFLAGS = $(CFLAGS) -DTYPECHECK -D__time_t_defined -D_TIME_T
typecheck: typecheck_long_long typecheck_unsigned
typecheck_long_long typecheck_unsigned: $(VERSION_DEPS)
rm -fr $@.dir
mkdir $@.dir
ln $(VERSION_DEPS) $@.dir
cd $@.dir && \
typecheck: long-long.ck unsigned.ck
long-long.ck unsigned.ck: $(VERSION_DEPS)
rm -fr $@d
mkdir $@d
ln $(VERSION_DEPS) $@d
cd $@d && \
case $@ in \
*_long_long) i="long long";; \
*_unsigned ) i="unsigned" ;; \
long-long.*) i="long long";; \
unsigned.* ) i="unsigned" ;; \
esac && \
typecheck_cflags='' && \
$(MAKE) \
CFLAGS="$(TYPECHECK_CFLAGS) \"-Dtime_t=$$i\"" \
TOPDIR="`pwd`" \
TOPDIR="$$PWD" \
install
$@.dir/zdump -i -c 1970,1971 Europe/Rome
$@d/zdump -i -c 1970,1971 Europe/Rome
touch $@
zonenames: tzdata.zi
@$(AWK) '/^Z/ { print $$2 } /^L/ { print $$3 }' tzdata.zi
asctime.o: private.h tzfile.h
asctime.o: private.h
date.o: private.h
difftime.o: private.h
localtime.o: private.h tzfile.h tzdir.h
strftime.o: private.h tzfile.h
zdump.o: version.h
zic.o: private.h tzfile.h tzdir.h version.h
localtime.o: private.h tzdir.h tzfile.h
strftime.o: localtime.c private.h tzdir.h tzfile.h
zdump.o: private.h version.h
zic.o: private.h tzdir.h tzfile.h version.h
.PHONY: ALL INSTALL all
.PHONY: check check_mild check_time_t_alternatives
.PHONY: check_web check_zishrink
.PHONY: clean clean_misc commit-leap-seconds.list dummy.zd
.PHONY: fetch-leap-seconds.list force_tzs
.PHONY: install install_data maintainer-clean names
.PHONY: install maintainer-clean names
.PHONY: posix_only posix_right public
.PHONY: rearguard_signatures rearguard_signatures_version
.PHONY: rearguard_tarballs rearguard_tarballs_version
+202 -4
View File
@@ -1,5 +1,203 @@
News for the tz database
Release 2025a - 2025-01-15 10:47:24 -0800
Briefly:
Paraguay adopts permanent -03 starting spring 2024.
Improve pre-1991 data for the Philippines.
Etc/Unknown is now reserved.
Changes to future timestamps
Paraguay will stop changing its clocks after the spring-forward
transition on 2024-10-06, so it is now permanently at -03.
(Thanks to Heitor David Pinto and Even Scharning.)
This affects timestamps starting 2025-03-22, as well as the
obsolescent tm_isdst flags starting 2024-10-15.
Changes to past timestamps
Correct timestamps for the Philippines before 1900, and from 1937
through 1990. (Thanks to P Chan for the heads-up and citations.)
This includes adjusting local mean time before 1899; fixing
transitions in September 1899, January 1937, and June 1954; adding
transitions in December 1941, November 1945, March and September
1977, and May and July 1990; and removing incorrect transitions in
March and September 1978.
Changes to data
Add zone1970.tab lines for the Concordia and Eyre Bird Observatory
research stations. (Thanks to Derick Rethans and Jule Dabars.)
Changes to code
strftime %s now generates the correct numeric string even when the
represented number does not fit into time_t. This is better than
generating the numeric equivalent of (time_t) -1, as strftime did
in TZDB releases 96a (when %s was introduced) through 2020a and in
releases 2022b through 2024b. It is also better than failing and
returning 0, as strftime did in releases 2020b through 2022a.
strftime now outputs an invalid conversion specifier as-is,
instead of eliding the leading '%', which confused debugging.
An invalid TZ now generates the time zone abbreviation "-00", not
"UTC", to help the user see that an error has occurred. (Thanks
to Arthur David Olson for suggesting a "wrong result".)
mktime and timeoff no longer incorrectly fail merely because a
struct tm component near INT_MIN or INT_MAX overflows when a
lower-order component carries into it.
TZNAME_MAXIMUM, the maximum number of bytes in a proleptic TZ
string's time zone abbreviation, now defaults to 254 not 255.
This helps reduce the size of internal state from 25480 to 21384
on common platforms. This change should not be a problem, as
nobody uses such long "abbreviations" and the longstanding tzcode
maximum was 16 until release 2023a. For those who prefer no
arbitrary limits, you can now specify TZNAME_MAXIMUM values up to
PTRDIFF_MAX, a limit forced by C anyway; formerly tzcode silently
misbehaved unless TZNAME_MAXIMUM was less than INT_MAX.
tzset and related functions no longer leak a file descriptor if
another thread forks or execs at about the same time and if the
platform has O_CLOFORK and O_CLOEXEC respectively. Also, the
functions no longer let a TZif file become a controlling terminal.
'zdump -' now reads TZif data from /dev/stdin.
(From a question by Arthur David Olson.)
Changes to documentation
The name Etc/Unknown is now reserved: it will not be used by TZDB.
This is for compatibility with CLDR, which uses the string
"Etc/Unknown" for an unknown or invalid timezone. (Thanks to
Justin Grant, Mark Davis, and Guy Harris.)
Cite Internet RFC 9636, which obsoletes RFC 8536 for TZif format.
Release 2024b - 2024-09-04 12:27:47 -0700
Briefly:
Improve historical data for Mexico, Mongolia, and Portugal.
System V names are now obsolescent.
The main data form now uses %z.
The code now conforms to RFC 8536 for early timestamps.
Support POSIX.1-2024, which removes asctime_r and ctime_r.
Assume POSIX.2-1992 or later for shell scripts.
SUPPORT_C89 now defaults to 1.
Changes to past timestamps
Asia/Choibalsan is now an alias for Asia/Ulaanbaatar rather than
being a separate Zone with differing behavior before April 2008.
This seems better given our wildly conflicting information about
Mongolia's time zone history. (Thanks to Heitor David Pinto.)
Historical transitions for Mexico have been updated based on
official Mexican decrees. The affected timestamps occur during
the years 1921-1927, 1931, 1945, 1949-1970, and 1981-1997.
The affected zones are America/Bahia_Banderas, America/Cancun,
America/Chihuahua, America/Ciudad_Juarez, America/Hermosillo,
America/Mazatlan, America/Merida, America/Mexico_City,
America/Monterrey, America/Ojinaga, and America/Tijuana.
(Thanks to Heitor David Pinto.)
Historical transitions for Portugal, represented by Europe/Lisbon,
Atlantic/Azores, and Atlantic/Madeira, have been updated based on a
close reading of old Portuguese legislation, replacing previous data
mainly originating from Whitman and Shanks & Pottenger. These
changes affect a few transitions in 1917-1921, 1924, and 1940
throughout these regions by a few hours or days, and various
timestamps between 1977 and 1993 depending on the region. In
particular, the Azores and Madeira did not observe DST from 1977 to
1981. Additionally, the adoption of standard zonal time in former
Portuguese colonies have been adjusted: Africa/Maputo in 1909, and
Asia/Dili by 22 minutes at the start of 1912.
(Thanks to Tim Parenti.)
Changes to past tm_isdst flags
The period from 1966-04-03 through 1966-10-02 in Portugal is now
modeled as DST, to more closely reflect how contemporaneous changes
in law entered into force.
Changes to data
Names present only for compatibility with UNIX System V
(last released in the 1990s) have been moved to 'backward'.
These names, which for post-1970 timestamps mostly just duplicate
data of geographical names, were confusing downstream uses.
Names moved to 'backward' are now links to geographical names.
This affects behavior for TZ='EET' for some pre-1981 timestamps,
for TZ='CET' for some pre-1947 timestamps, and for TZ='WET' for
some pre-1996 timestamps. Also, TZ='MET' now behaves like
TZ='CET' and so uses the abbreviation "CET" rather than "MET".
Those needing the previous TZDB behavior, which does not match any
real-world clocks, can find the old entries in 'backzone'.
(Problem reported by Justin Grant.)
The main source files' time zone abbreviations now use %z,
supported by zic since release 2015f and used in vanguard form
since release 2022b. For example, America/Sao_Paulo now contains
the zone continuation line "-3:00 Brazil %z", which is less error
prone than the old "-3:00 Brazil -03/-02". This does not change
the represented data: the generated TZif files are unchanged.
Rearguard form still avoids %z, to support obsolescent parsers.
Asia/Almaty has been removed from zonenow.tab as it now agrees
with Asia/Tashkent for future timestamps, due to Kazakhstan's
2024-02-29 time zone change. Similarly, America/Scoresbysund
has been removed, as it now agrees with America/Nuuk due to
its 2024-03-31 time zone change.
Changes to code
localtime.c now always uses a TZif file's time type 0 to handle
timestamps before the file's first transition. Formerly,
localtime.c sometimes inferred a different time type, in order to
handle problematic data generated by zic 2018e or earlier. As it
is now safe to assume more recent versions of zic, there is no
longer a pressing need to fail to conform RFC 8536 section 3.2,
which requires using time type 0 in this situation. This change
does not affect behavior when reading TZif files generated by zic
2018f and later.
POSIX.1-2024 removes asctime_r and ctime_r and does not let
libraries define them, so remove them except when needed to
conform to earlier POSIX. These functions are dangerous as they
can overrun user buffers. If you still need them, add
-DSUPPORT_POSIX2008 to CFLAGS.
The SUPPORT_C89 option now defaults to 1 instead of 0, fixing a
POSIX-conformance bug introduced in 2023a.
tzselect now supports POSIX.1-2024 proleptic TZ strings. Also, it
assumes POSIX.2-1992 or later, as practical porting targets now
all support that, and it uses some features from POSIX.1-2024 if
available.
Changes to build procedure
'make check' no longer requires curl and Internet access.
The build procedure now assumes POSIX.2-1992 or later, to simplify
maintenance. To build on Solaris 10, the only extant system still
defaulting to pre-POSIX, prepend /usr/xpg4/bin to PATH.
Changes to documentation
The documentation now reflects POSIX.1-2024.
Changes to commentary
Commentary about historical transitions in Portugal and her former
colonies has been expanded with links to relevant legislation.
(Thanks to Tim Parenti.)
Release 2024a - 2024-02-01 09:28:56 -0800
Briefly:
@@ -84,10 +282,10 @@ Release 2023d - 2023-12-21 20:02:24 -0800
changing its time zone from -01/+00 to -02/-01 at the same moment
as the spring-forward transition. Its clocks will therefore not
spring forward as previously scheduled. The time zone change
reverts to its common practice before 1981.
reverts to its common practice before 1981. (Thanks to Jule Dabars.)
Fix predictions for DST transitions in Palestine in 2072-2075,
correcting a typo introduced in 2023a.
correcting a typo introduced in 2023a. (Thanks to Jule Dabars.)
Changes to past and future timestamps
@@ -161,7 +359,7 @@ Release 2023d - 2023-12-21 20:02:24 -0800
* It uses the special .POSIX target.
* It quotes special characters more carefully.
* It no longer mishandles builds in an ISO 8859 locale.
Due to the CC changes, TZDIR is now #defined in a file tzfile.h
Due to the CC changes, TZDIR is now #defined in a file tzdir.h
built by 'make', not in a $(CC) -D option. Also, TZDEFAULT is
now treated like TZDIR as they have similar roles.
@@ -283,7 +481,7 @@ Release 2023a - 2023-03-22 12:39:33 -0700
To improve tzselect diagnostics, zone1970.tab's comments column is
now limited to countries that have multiple timezones.
Note that leap seconds are planned to be discontinued by 2035.
Note that there are plans to discontinue leap seconds by 2035.
Release 2022g - 2022-11-29 08:58:31 -0800
+42 -31
View File
@@ -103,17 +103,16 @@ Zone Africa/Algiers 0:12:12 - LMT 1891 Mar 16
# 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
# Chad
# Zone NAME STDOFF RULES FORMAT [UNTIL]
@@ -345,14 +344,12 @@ Zone Africa/Cairo 2:05:09 - LMT 1900 Oct
# 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
# Comoros
@@ -417,10 +414,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
# Liberia
@@ -591,7 +588,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
@@ -1071,10 +1068,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
#
@@ -1088,9 +1085,9 @@ 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
# Botswana
# Burundi
@@ -1101,13 +1098,27 @@ Zone Africa/El_Aaiun -0:52:48 - LMT 1934 Jan # El Aaiún
# Zambia
# Zimbabwe
#
# 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
@@ -1172,7 +1183,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
@@ -1260,7 +1271,7 @@ Zone Africa/Windhoek 1:08:24 - LMT 1892 Feb 8
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
# São Tomé and Príncipe
+31 -29
View File
@@ -87,34 +87,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
@@ -174,6 +174,8 @@ Zone Antarctica/Mawson 0 - -00 1954 Feb 13
# France & Italy - year-round base
# Concordia, -750600+1232000, since 2005
# https://en.wikipedia.org/wiki/Concordia_Station
# Can use Asia/Singapore, which it has agreed with since inception.
# Germany - year-round base
# Neumayer III, -704080-0081602, since 2009
@@ -290,10 +292,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
@@ -326,7 +328,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
+316 -237
View File
@@ -83,8 +83,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):
@@ -116,12 +116,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
@@ -142,12 +142,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
# Bangladesh
# From Alexander Krivenyshev (2009-05-13):
@@ -228,17 +228,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
@@ -248,8 +248,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
# Cocos (Keeling) Islands
# Myanmar (Burma)
@@ -265,9 +265,9 @@ Zone Indian/Chagos 4:49:40 - LMT 1907
# 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
# China
@@ -656,7 +656,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
@@ -1114,7 +1114,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
@@ -1157,7 +1157,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
@@ -1198,18 +1198,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
@@ -1233,11 +1240,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
@@ -1303,9 +1310,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
@@ -1357,33 +1364,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
@@ -1619,9 +1626,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
@@ -1664,8 +1671,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
###############################################################################
@@ -2262,7 +2269,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
@@ -2473,88 +2480,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.
@@ -2575,11 +2582,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
###############################################################################
@@ -2786,16 +2793,16 @@ Rule NBorneo 1935 1941 - Dec 14 0:00 0 -
# 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
@@ -2897,9 +2904,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
@@ -2938,25 +2973,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
# Pakistan
@@ -3102,10 +3130,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
@@ -3637,30 +3665,79 @@ Zone Asia/Hebron 2:20:23 - LMT 1900 Oct
# be immediately followed by 1845-01-01; see R.H. van Gent's
# History of the International Date Line
# https://webspace.science.uu.nl/~gent0113/idl/idl_philippines.htm
# The rest of the data entries are from Shanks & Pottenger.
# From Jesper Nørgaard Welen (2006-04-26):
# ... claims that Philippines had DST last time in 1990:
# http://story.philippinetimes.com/p.x/ct/9/id/145be20cc6b121c0/cid/3e5bbccc730d258c/
# [a story dated 2006-04-25 by Cris Larano of Dow Jones Newswires,
# but no details]
# From P Chan (2021-05-10):
# Here's a fairly comprehensive article in Japanese:
# https://wiki.suikawiki.org/n/Philippine%20Time
# (2021-05-16):
# According to the references listed in the article,
# the periods that the Philippines (Manila) observed DST or used +9 are:
#
# 1936-10-31 24:00 to 1937-01-15 24:00
# (Proclamation No. 104, Proclamation No. 126)
# 1941-12-15 24:00 to 1945-11-30 24:00
# (Proclamation No. 789, Proclamation No. 20)
# 1954-04-11 24:00 to 1954-06-04 24:00
# (Proclamation No. 13, Proclamation No. 33)
# 1977-03-27 24:00 to 1977-09-21 24:00
# (Proclamation No. 1629, Proclamation No. 1641)
# 1990-05-21 00:00 to 1990-07-28 24:00
# (National Emergency Memorandum Order No. 17, Executive Order No. 415)
#
# Proclamation No. 104 ... October 30, 1936
# https://www.officialgazette.gov.ph/1936/10/30/proclamation-no-104-s-1936/
# Proclamation No. 126 ... January 15, 1937
# https://www.officialgazette.gov.ph/1937/01/15/proclamation-no-126-s-1937/
# Proclamation No. 789 ... December 13, 1941
# https://www.officialgazette.gov.ph/1941/12/13/proclamation-no-789-s-1941/
# Proclamation No. 20 ... November 11, 1945
# https://www.officialgazette.gov.ph/1945/11/11/proclamation-no-20-s-1945/
# Proclamation No. 13 ... April 6, 1954
# https://www.officialgazette.gov.ph/1954/04/06/proclamation-no-13-s-1954/
# Proclamation No. 33 ... June 3, 1954
# https://www.officialgazette.gov.ph/1954/06/03/proclamation-no-33-s-1954/
# Proclamation No. 1629 ... March 25, 1977
# https://www.officialgazette.gov.ph/1977/03/25/proclamation-no-1629-s-1977/
# Proclamation No. 1641 ...May 26, 1977
# https://www.officialgazette.gov.ph/1977/05/26/proclamation-no-1641-s-1977/
# National Emergency Memorandum Order No. 17 ... May 2, 1990
# https://www.officialgazette.gov.ph/1990/05/02/national-emergency-memorandum-order-no-17-s-1990/
# Executive Order No. 415 ... July 20, 1990
# https://www.officialgazette.gov.ph/1990/07/20/executive-order-no-415-s-1990/
#
# During WWII, Proclamation No. 789 fixed two periods of DST. The first period
# was set to continue only until January 31, 1942. But Manila was occupied by
# the Japanese earlier in the month....
#
# For the date of the adoption of standard time, Shank[s] gives 1899-05-11.
# The article is not able to state the basis of that. I guess it was based on
# a US War Department Circular issued on that date.
# https://books.google.com/books?id=JZ1PAAAAYAAJ&pg=RA3-PA8
#
# However, according to other sources, standard time was adopted on
# 1899-09-06. Also, the LMT was GMT+8:03:52
# https://books.google.com/books?id=MOYIAQAAIAAJ&pg=PA521
# https://books.google.com/books?id=lSnqqatpYikC&pg=PA21
#
# From Paul Eggert (2024-09-05):
# The penultimate URL in P Chan's email refers to page 521 of
# Selga M, The Time Service in the Philippines.
# Proc Pan-Pacific Science Congress. Vol. 1 (1923), 519-532.
# It says, "The change from the meridian 120° 58' 04" to the 120th implied a
# change of 3 min. 52s.26 in time; consequently on 6th September, 1899,
# Manila Observatory gave the noon signal 3 min. 52s.26 later than before".
#
# Wikipedia says the US declared Manila liberated on March 4, 1945;
# this doesn't affect clocks, just our time zone abbreviation and DST flag.
# From Paul Eggert (2014-08-14):
# The following source says DST may be instituted November-January and again
# March-June, but this is not definite. It also says DST was last proclaimed
# during the Ramos administration (1992-1998); but again, no details.
# Carcamo D. PNoy urged to declare use of daylight saving time.
# 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
@@ -3669,32 +3746,34 @@ Zone Asia/Hebron 2:20:23 - LMT 1900 Oct
# influence of the sources. There is no current abbreviation for DST,
# so use "PDT", the usual American style.
# From P Chan (2021-05-10):
# Here's a fairly comprehensive article in Japanese:
# https://wiki.suikawiki.org/n/Philippine%20Time
# From Paul Eggert (2021-05-10):
# The info in the Japanese table has not been absorbed (yet) below.
# Rule NAME FROM TO - IN ON AT SAVE LETTER/S
Rule Phil 1936 only - Nov 1 0:00 1:00 D
Rule Phil 1937 only - Feb 1 0:00 0 S
Rule Phil 1954 only - Apr 12 0:00 1:00 D
Rule Phil 1954 only - Jul 1 0:00 0 S
Rule Phil 1978 only - Mar 22 0:00 1:00 D
Rule Phil 1978 only - Sep 21 0:00 0 S
Rule Phil 1936 only - Oct 31 24:00 1:00 D
Rule Phil 1937 only - Jan 15 24:00 0 S
Rule Phil 1941 only - Dec 15 24:00 1:00 D
# The following three rules were canceled by Japan:
#Rule Phil 1942 only - Jan 31 24:00 0 S
#Rule Phil 1942 only - Mar 1 0:00 1:00 D
#Rule Phil 1942 only - Jun 30 24:00 0 S
Rule Phil 1945 only - Nov 30 24:00 0 S
Rule Phil 1954 only - Apr 11 24:00 1:00 D
Rule Phil 1954 only - Jun 4 24:00 0 S
Rule Phil 1977 only - Mar 27 24:00 1:00 D
Rule Phil 1977 only - Sep 21 24:00 0 S
Rule Phil 1990 only - May 21 0:00 1:00 D
Rule Phil 1990 only - Jul 28 24:00 0 S
# Zone NAME STDOFF RULES FORMAT [UNTIL]
Zone Asia/Manila -15:56:00 - LMT 1844 Dec 31
8:04:00 - LMT 1899 May 11
8:00 Phil P%sT 1942 May
9:00 - JST 1944 Nov
Zone Asia/Manila -15:56:08 - LMT 1844 Dec 31
8:03:52 - LMT 1899 Sep 6 4:00u
8:00 Phil P%sT 1942 Feb 11 24:00
9:00 - JST 1945 Mar 4
8:00 Phil P%sT
# Bahrain
# 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
# Kuwait
# Saudi Arabia
@@ -3744,7 +3823,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)
@@ -3752,13 +3831,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
@@ -3816,13 +3895,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
@@ -3993,16 +4072,16 @@ 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
# Cambodia
# Christmas I
@@ -4012,16 +4091,16 @@ Zone Asia/Dushanbe 4:35:12 - LMT 1924 May 2
# 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
# Oman
# Réunion
@@ -4031,25 +4110,25 @@ Zone Asia/Ashgabat 3:53:32 - LMT 1924 May 2 # or Ashkhabad
# 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)
@@ -4107,7 +4186,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.
#
@@ -4128,14 +4207,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):
#
+126 -117
View File
@@ -43,8 +43,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
#
@@ -209,8 +209,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
#
@@ -416,16 +416,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.
@@ -468,7 +468,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
@@ -480,30 +480,30 @@ Zone Pacific/Guam -14:21:00 - LMT 1844 Dec 31
# Wallis & Futuna
# 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)
# See Pacific/Tarawa for the 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
# Marshall Is
# See Pacific/Tarawa for most locations.
# 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
# For Chuuk and Yap see Pacific/Port_Moresby.
@@ -511,22 +511,22 @@ Zone Pacific/Kwajalein 11:09:20 - LMT 1901
# 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
@@ -537,7 +537,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
###############################################################################
@@ -581,8 +581,8 @@ Zone Pacific/Auckland 11:39:04 - LMT 1868 Nov 2
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,
@@ -635,8 +635,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
###############################################################################
@@ -653,30 +653,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
@@ -697,16 +697,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
# Midway
@@ -795,15 +795,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
#
@@ -826,8 +826,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
@@ -839,9 +839,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
# US minor outlying islands
@@ -930,7 +930,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
###############################################################################
@@ -1239,10 +1239,10 @@ Zone Pacific/Efate 11:13:16 - LMT 1912 Jan 13 # Vila
# The 1992 ending date used in the rules is a best guess;
# it matches what was used in the past.
# The Australian Bureau of Meteorology FAQ
# http://www.bom.gov.au/faq/faqgen.htm
# (1999-09-27) writes that Giles Meteorological Station uses
# South Australian time even though it's located in Western Australia.
# From Christopher Hunt (2006-11-21), after an advance warning
# from Jesper Nørgaard Welen (2006-11-01):
# WA are trialing DST for three years.
# http://www.parliament.wa.gov.au/parliament/bills.nsf/9A1B183144403DA54825721200088DF1/$File/Bill175-1B.pdf
# From Paul Eggert (2018-04-01):
# The Guardian Express of Perth, Australia reported today that the
@@ -1254,54 +1254,10 @@ Zone Pacific/Efate 11:13:16 - LMT 1912 Jan 13 # Vila
# https://www.communitynews.com.au/guardian-express/news/exclusive-daylight-savings-coming-wa-summer-2018/
# [The article ends with "Today's date is April 1."]
# Queensland
# From Paul Eggert (2018-02-26):
# I lack access to the following source for Queensland DST:
# Pearce C. History of daylight saving time in Queensland.
# Queensland Hist J. 2017 Aug;23(6):389-403
# https://search.informit.com.au/documentSummary;dn=994682348436426;res=IELHSS
# From George Shepherd via Simon Woodhead via Robert Elz (1991-03-06):
# # The state of QUEENSLAND.. [ Courtesy Qld. Dept Premier Econ&Trade Devel ]
# # [ Dec 1990 ]
# ...
# Zone Australia/Queensland 10:00 AQ %sST
# ...
# Rule AQ 1971 only - Oct lastSun 2:00 1:00 D
# Rule AQ 1972 only - Feb lastSun 3:00 0 E
# Rule AQ 1989 max - Oct lastSun 2:00 1:00 D
# Rule AQ 1990 max - Mar Sun>=1 3:00 0 E
# From Bradley White (1989-12-24):
# "Australia/Queensland" now observes daylight time (i.e. from
# October 1989).
# From Bradley White (1991-03-04):
# A recent excerpt from an Australian newspaper...
# ...Queensland...[has] agreed to end daylight saving
# at 3am tomorrow (March 3)...
# From John Mackin (1991-03-06):
# I can certainly confirm for my part that Daylight Saving in NSW did in fact
# end on Sunday, 3 March. I don't know at what hour, though. (It surprised
# me.)
# From Bradley White (1992-03-08):
# ...there was recently a referendum in Queensland which resulted
# in the experimental daylight saving system being abandoned. So, ...
# ...
# Rule QLD 1989 1991 - Oct lastSun 2:00 1:00 D
# Rule QLD 1990 1992 - Mar Sun>=1 3:00 0 S
# ...
# From Arthur David Olson (1992-03-08):
# The chosen rules the union of the 1971/1972 change and the 1989-1992 changes.
# From Christopher Hunt (2006-11-21), after an advance warning
# from Jesper Nørgaard Welen (2006-11-01):
# WA are trialing DST for three years.
# http://www.parliament.wa.gov.au/parliament/bills.nsf/9A1B183144403DA54825721200088DF1/$File/Bill175-1B.pdf
# The Australian Bureau of Meteorology FAQ
# http://www.bom.gov.au/faq/faqgen.htm
# (1999-09-27) writes that Giles Meteorological Station uses
# South Australian time even though it's located in Western Australia.
# From Rives McDow (2002-04-09):
# The most interesting region I have found consists of three towns on the
@@ -1359,6 +1315,59 @@ Zone Pacific/Efate 11:13:16 - LMT 1912 Jan 13 # Vila
# For lack of better info, assume the tradition dates back to the
# introduction of standard time in 1895.
# From Stuart Bishop (2024-11-12):
# An article discussing the in-use but technically unofficial timezones
# in the Western Australian portion of the Nullarbor Plain.
# https://www.abc.net.au/news/2024-11-22/outback-wa-properties-strange-time-zones/104542494
# From Paul Eggert (2024-11-12):
# As the article says, the Eyre Bird Observatory and nearby sheep stations
# can use Tokyo time. Other possibilities include Asia/Chita, Asia/Seoul,
# and Asia/Jayapura.
# Queensland
# From Paul Eggert (2018-02-26):
# I lack access to the following source for Queensland DST:
# Pearce C. History of daylight saving time in Queensland.
# Queensland Hist J. 2017 Aug;23(6):389-403
# https://search.informit.com.au/documentSummary;dn=994682348436426;res=IELHSS
# From George Shepherd via Simon Woodhead via Robert Elz (1991-03-06):
# # The state of QUEENSLAND.. [ Courtesy Qld. Dept Premier Econ&Trade Devel ]
# # [ Dec 1990 ]
# ...
# Zone Australia/Queensland 10:00 AQ %sST
# ...
# Rule AQ 1971 only - Oct lastSun 2:00 1:00 D
# Rule AQ 1972 only - Feb lastSun 3:00 0 E
# Rule AQ 1989 max - Oct lastSun 2:00 1:00 D
# Rule AQ 1990 max - Mar Sun>=1 3:00 0 E
# From Bradley White (1989-12-24):
# "Australia/Queensland" now observes daylight time (i.e. from
# October 1989).
# From Bradley White (1991-03-04):
# A recent excerpt from an Australian newspaper...
# ...Queensland...[has] agreed to end daylight saving
# at 3am tomorrow (March 3)...
# From John Mackin (1991-03-06):
# I can certainly confirm for my part that Daylight Saving in NSW did in fact
# end on Sunday, 3 March. I don't know at what hour, though. (It surprised
# me.)
# From Bradley White (1992-03-08):
# ...there was recently a referendum in Queensland which resulted
# in the experimental daylight saving system being abandoned. So, ...
# ...
# Rule QLD 1989 1991 - Oct lastSun 2:00 1:00 D
# Rule QLD 1990 1992 - Mar Sun>=1 3:00 0 S
# ...
# From Arthur David Olson (1992-03-08):
# The chosen rules the union of the 1971/1972 change and the 1989-1992 changes.
# southeast Australia
#
+14 -1
View File
@@ -1,9 +1,10 @@
# tzdb links for backward compatibility
# 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
@@ -44,6 +45,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
@@ -58,6 +61,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.
@@ -96,6 +102,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
@@ -275,6 +284,7 @@ Link America/Denver America/Shiprock
Link America/Toronto America/Thunder_Bay
Link America/Edmonton America/Yellowknife
Link Pacific/Auckland Antarctica/South_Pole
Link Asia/Ulaanbaatar Asia/Choibalsan
Link Asia/Shanghai Asia/Chongqing
Link Asia/Shanghai Asia/Harbin
Link Asia/Urumqi Asia/Kashgar
@@ -289,6 +299,7 @@ Link Europe/Kyiv Europe/Zaporozhye
Link Pacific/Kanton Pacific/Enderbury
Link Pacific/Honolulu Pacific/Johnston
Link Pacific/Port_Moresby Pacific/Yap
Link Europe/Lisbon WET
# Alternate names for the same location
@@ -314,5 +325,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/Guadalcanal Pacific/Ponape #= Pacific/Pohnpei
Link Pacific/Port_Moresby Pacific/Truk #= Pacific/Chuuk
+27 -8
View File
@@ -346,10 +346,8 @@ Zone Africa/Lome 0:04:52 - LMT 1893
# Angola
#
# 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 Africa/Luanda 0:52:56 - LMT 1892
0:52:04 - LMT 1911 Dec 31 23:00u # Luanda MT?
@@ -1086,10 +1084,10 @@ Zone Asia/Muscat 3:54:24 - LMT 1920
4:00 - +04
# India
# From Paul Eggert (2014-08-11), after a heads-up from Stephen Colebourne:
# According to a Portuguese decree (1911-05-26)
# https://dre.pt/pdf1sdip/1911/05/12500/23132313.pdf
# Portuguese India switched to UT +05 on 1912-01-01.
# From Tim Parenti (2024-07-01), per Paul Eggert (2014-08-11), after a
# heads-up from Stephen Colebourne:
# According to a Portuguese decree (1911-05-24), Portuguese India switched to
# UT +05 on 1912-01-01 (see Europe/Lisbon).
#Zone Asia/Panaji [not enough info to complete]
# Cambodia
@@ -1829,6 +1827,27 @@ Zone Pacific/Wake 11:06:28 - LMT 1901
Zone Pacific/Wallis 12:15:20 - LMT 1901
12:00 - +12
# From Paul Eggert (2024-05-22):
# The following zones pretend that standard time extends backward
# indefinitely into the past, and so are ahistorical.
# In current TZDB these entries are links to geographical locations
# that agree with the ahistorical zones since 1970.
# These are in numeric rather than alphabetic order.
# Zone NAME STDOFF RULES FORMAT [UNTIL]
Zone HST -10:00 - HST
Zone PST8PDT -8:00 US P%sT
Zone MST -7:00 - MST
Zone MST7MDT -7:00 US M%sT
Zone CST6CDT -6:00 US C%sT
Zone EST -5:00 - EST
Zone EST5EDT -5:00 US E%sT
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
# Local Variables:
# coding: utf-8
# End:
+3 -3
View File
@@ -14,7 +14,7 @@ BEGIN {
if ($0 ~ /^TZ/) {
record_zone(zone, data)
zone = $0
sub(/.*\.dir\//, "", zone)
sub(/.*\.ckd\//, "", zone)
sub(/\/\//, "/", zone)
sub(/"/, "", zone)
data = ""
@@ -44,8 +44,8 @@ BEGIN {
END {
for (zone in zone_data) {
data = zone_data[zone]
if (!zonenow[data]) {
printf "zonenow.tab should have one of:%s\n", zones[data]
if (data && !zonenow[data]) {
printf "Zone table should have one of:%s\n", zones[data]
zonenow[data] = zone # This suppresses duplicate diagnostics.
status = 1
}
+37 -2
View File
@@ -9,6 +9,19 @@ BEGIN {
if (!zone_table) zone_table = "zone1970.tab"
if (!want_warnings) want_warnings = -1
monthabbr["Jan"] = 1
monthabbr["Feb"] = 1
monthabbr["Mar"] = 1
monthabbr["Apr"] = 1
monthabbr["May"] = 1
monthabbr["Jun"] = 1
monthabbr["Jul"] = 1
monthabbr["Aug"] = 1
monthabbr["Sep"] = 1
monthabbr["Oct"] = 1
monthabbr["Nov"] = 1
monthabbr["Dec"] = 1
while (getline <iso_table) {
iso_NR++
if ($0 ~ /^#/) continue
@@ -65,6 +78,12 @@ BEGIN {
split(ccs, cca, /,/)
cc = cca[1]
if (tztab[tz]) {
printf "%s:%d: %s: duplicate Zone from line %d\n", \
zone_table, zone_NR, tz, tz2NR[tz]
status = 1
}
# Don't complain about a special case for Crimea in zone.tab.
# FIXME: zone.tab should be removed, since it is obsolete.
# Or at least put just "XX" in its country-code column.
@@ -128,12 +147,14 @@ BEGIN {
$1 ~ /^#/ { next }
{
tz = rules = ""
tz = rules = stdoff = ""
if ($1 == "Zone") {
tz = $2
stdoff = $3
ruleUsed[$4] = 1
if ($5 ~ /%/) rulePercentUsed[$4] = 1
} else if ($1 == "Link" && zone_table == "zone.tab") {
} else if ($1 == "Link") {
if (zone_table == "zone.tab") {
# Ignore Link commands if source and destination basenames
# are identical, e.g. Europe/Istanbul versus Asia/Istanbul.
src = $2
@@ -141,13 +162,27 @@ $1 ~ /^#/ { next }
while ((i = index(src, "/"))) src = substr(src, i+1)
while ((i = index(dst, "/"))) dst = substr(dst, i+1)
if (src != dst) tz = $3
}
} else if ($1 == "Rule") {
ruleDefined[$2] = 1
if ($10 != "-") ruleLetters[$2] = 1
if (!monthabbr[$6]) {
printf "%s:%d: tricky month: %s\n", FILENAME, FNR, $6 \
>>"/dev/stderr"
status = 1
}
} else {
stdoff = $1
ruleUsed[$2] = 1
if ($3 ~ /%/) rulePercentUsed[$2] = 1
}
if (stdoff && stdoff !~ /^\-?1?[0-9](:[0-5][0-9](:[0-5][0-9])?)?$/) {
printf "%s:%d: unlikely STDOFF: %s\n", FILENAME, FNR, stdoff \
>>"/dev/stderr"
status = 1
}
if (tz && tz ~ /\// && tz !~ /^Etc\//) {
if (!tztab[tz] && FILENAME != "backward" \
&& zone_table != "zonenow.tab") {
+31 -27
View File
@@ -5,7 +5,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.
@@ -51,29 +51,33 @@ 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
# There is no "Etc/Unknown" entry, as CLDR says that "Etc/Unknown"
# corresponds to an unknown or invalid time zone, and things would get
# confusing if Etc/Unknown were made valid here.
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
+451 -264
View File
@@ -730,14 +730,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.
@@ -871,7 +863,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
# Luxembourg
@@ -1155,7 +1147,7 @@ Zone Atlantic/Faroe -0:27:04 - LMT 1908 Jan 11 # Tórshavn
# However, Greenland will change to Daylight Saving Time again in 2024
# and onwards.
# From a contributor who wishes to remain anonymous for now (2023-10-29):
# From Jule Dabars (2023-10-29):
# https://www.dr.dk/nyheder/seneste/i-nat-skal-uret-stilles-en-time-tilbage-men-foerste-gang-sker-det-ikke-i-groenland
# with a link to that page:
# https://naalakkersuisut.gl/Nyheder/2023/10/2710_sommertid
@@ -1176,22 +1168,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
@@ -2063,10 +2055,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] ...:
@@ -2074,37 +2095,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
@@ -2116,6 +2162,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
@@ -2126,10 +2174,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
@@ -2139,66 +2196,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
@@ -2410,7 +2596,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
@@ -2660,14 +2846,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:
@@ -2697,15 +2883,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):
@@ -2720,14 +2906,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:
@@ -2735,10 +2921,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
@@ -2753,15 +2939,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:
@@ -2777,14 +2963,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...
@@ -2809,12 +2995,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):
@@ -2824,12 +3010,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:
@@ -2862,14 +3048,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:
@@ -2883,14 +3069,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:
@@ -2935,14 +3121,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):
@@ -2973,12 +3159,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...
@@ -2992,12 +3178,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):
@@ -3014,12 +3200,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):
@@ -3036,13 +3222,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):
@@ -3082,12 +3268,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):
@@ -3105,12 +3291,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):
@@ -3128,14 +3314,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):
@@ -3151,14 +3337,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):
@@ -3181,13 +3367,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):
@@ -3232,12 +3418,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):
@@ -3255,14 +3441,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):
@@ -3275,12 +3461,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):
@@ -3288,13 +3474,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
# Bosnia & Herzegovina
# Croatia
@@ -3413,7 +3599,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
@@ -3494,8 +3680,8 @@ Zone Atlantic/Canary -1:01:36 - LMT 1922 Mar # Las Palmas de Gran C.
# 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:
@@ -3534,6 +3720,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
@@ -3731,7 +3918,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
@@ -3740,7 +3927,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
#
+10
View File
@@ -8,5 +8,15 @@
# time zone abbreviation "-00", indicating that the actual time zone
# is unknown.
# TZ="Factory" was added to TZDB in 1989, and in 2016 its abbreviation
# was changed to "-00" from a longish English-language error message.
# Around 2010, CLDR added "Etc/Unknown" for use with TZDB, to stand
# for an unknown or invalid time zone. These two notions differ:
# TZ="Factory" is a valid timezone, so tzalloc("Factory") succeeds, whereas
# TZ="Etc/Unknown" is invalid and tzalloc("Etc/Unknown") fails.
# Also, a downstream distributor could modify Factory to be a
# default timezone suitable for the devices it manufactures,
# whereas that cannot happen for Etc/Unknown.
# Zone NAME STDOFF RULES FORMAT
Zone Factory 0 - "Local time zone must be set--use tzsetup"
+15 -15
View File
@@ -1,5 +1,5 @@
# ATOMIC TIME.
# The Coordinated Universal Time (UTC) is the reference time scale derived
# 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
@@ -8,34 +8,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.
#
@@ -60,15 +60,15 @@
#
# The following line shows the last update of this file in NTP timestamp:
#
#$ 3913697179
#$ 3945196800
#
# 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 December 2025
#
# Expire date in NTP timestamp:
#
#@ 3944332800
#@ 3975868800
#
#
# LIST OF LEAP SECONDS
@@ -117,4 +117,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 848434d5 570f7ea8 d79ba227 a00fc821 f608e2d4
+4 -4
View File
@@ -69,11 +69,11 @@ Leap 2016 Dec 31 23:59:60 + S
# Any additional leap seconds will come after this.
# This Expires line is commented out for now,
# so that pre-2020a zic implementations do not reject this file.
#Expires 2024 Dec 28 00:00:00
#Expires 2025 Dec 28 00:00:00
# POSIX timestamps for the data in this file:
#updated 1704708379 (2024-01-08 10:06:19 UTC)
#expires 1735344000 (2024-12-28 00:00:00 UTC)
#updated 1736208000 (2025-01-07 00:00:00 UTC)
#expires 1766880000 (2025-12-28 00:00:00 UTC)
# Updated through IERS Bulletin C (https://hpiers.obspm.fr/iers/bul/bulc/bulletinc.dat)
# File expires on 28 December 2024
# File expires on 28 December 2025
+109 -43
View File
@@ -27,9 +27,12 @@
# in New York City (1869-10). His 1870 proposal was based on Washington, DC,
# but in 1872-05 he moved the proposed origin to Greenwich.
# From Paul Eggert (2018-03-20):
# From Paul Eggert (2024-11-18):
# Dowd's proposal left many details unresolved, such as where to draw
# lines between time zones. The key individual who made time zones
# lines between time zones. Sandford Fleming of the Canadian Pacific Railway
# argued for Dowd's proposal in 1876, and Cleveland Abbe of the American
# Meteorology Society published a report in 1879 recommending four US time
# zones based on GMT. However, the key individual who made time zones
# work in the US was William Frederick Allen - railway engineer,
# managing editor of the Travelers' Guide, and secretary of the
# General Time Convention, a railway standardization group. Allen
@@ -185,26 +188,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
@@ -2373,6 +2356,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.
@@ -2576,7 +2634,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
@@ -2595,14 +2653,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:
@@ -2619,12 +2679,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
@@ -2635,7 +2698,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
@@ -2650,7 +2713,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
@@ -2662,7 +2725,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
@@ -2672,23 +2735,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
@@ -2721,27 +2782,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
@@ -3550,8 +3616,8 @@ Zone America/Puerto_Rico -4:24:25 - LMT 1899 Mar 28 12:00 # San Juan
# 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
# Turks and Caicos
#
+266 -245
View File
@@ -402,11 +402,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)
@@ -421,120 +421,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)
@@ -544,53 +544,53 @@ 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
# Bolivia
# Zone NAME STDOFF RULES FORMAT [UNTIL]
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
@@ -961,12 +961,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).
@@ -979,119 +979,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
@@ -1359,36 +1359,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,
@@ -1408,10 +1408,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
@@ -1430,7 +1430,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
@@ -1461,10 +1461,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
@@ -1564,10 +1564,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:
@@ -1575,8 +1575,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
@@ -1610,10 +1610,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
#
@@ -1687,7 +1687,7 @@ Rule Para 2005 2009 - Mar Sun>=8 0:00 0 -
# and that on the first Sunday of the month of October, it is to be set
# forward 60 minutes, in all the territory of the Paraguayan Republic.
# ...
Rule Para 2010 max - Oct Sun>=1 0:00 1:00 -
Rule Para 2010 2024 - Oct Sun>=1 0:00 1:00 -
Rule Para 2010 2012 - Apr Sun>=8 0:00 0 -
#
# From Steffen Thorsen (2013-03-07):
@@ -1706,14 +1706,35 @@ Rule Para 2010 2012 - Apr Sun>=8 0:00 0 -
# https://www.abc.com.py/politica/2023/07/12/promulgacion-el-cambio-de-hora-sera-por-ley/
# From Carlos Raúl Perasso (2023-07-27):
# http://silpy.congreso.gov.py/descarga/ley-144138
Rule Para 2013 max - Mar Sun>=22 0:00 0 -
Rule Para 2013 2024 - Mar Sun>=22 0:00 0 -
#
# From Heitor David Pinto (2024-09-24):
# Today the Congress of Paraguay passed a bill to observe UTC-3 permanently....
# The text of the bill says that it would enter into force on the first
# Sunday in October 2024, the same date currently scheduled to start DST....
# https://silpy.congreso.gov.py/web/expediente/132531
# (2024-10-14):
# The president approved the law on 11 October 2024,
# and it was officially published on 14 October 2024.
# https://www.gacetaoficial.gov.py/index/detalle_publicacion/89723
# The text of the law says that it enters into force on the first
# Sunday in October 2024 (6 October 2024). But the constitution
# prohibits retroactive effect, and the civil code says that laws
# enter into force on the day after their publication or on the day
# that they specify, and it also says that they don't have retroactive
# effect. So I think that the time change on 6 October 2024 should
# still be considered as DST according to the previous law, and
# permanently UTC-3 from 15 October 2024 according to the new law....
# https://www.constituteproject.org/constitution/Paraguay_2011
# https://www.oas.org/dil/esp/codigo_civil_paraguay.pdf
# 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 2024 Oct 15
-3:00 - %z
# Peru
#
@@ -1740,12 +1761,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
@@ -1755,8 +1776,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
# Uruguay
# From Paul Eggert (1993-11-18):
@@ -1971,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
#
@@ -2013,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
+169 -83
View File
@@ -89,13 +89,15 @@ The <code><abbr>tz</abbr></code> code is upwards compatible with <a
href="https://en.wikipedia.org/wiki/POSIX">POSIX</a>, an international
standard for <a
href="https://en.wikipedia.org/wiki/Unix">UNIX</a>-like systems.
As of this writing, the current edition of POSIX is: <a
As of this writing, the current edition of POSIX is POSIX.1-2024,
which has been published but not yet in HTML form.
Unlike its predecessor POSIX.1-2017 (<a
href="https://pubs.opengroup.org/onlinepubs/9699919799/"> The Open
Group Base Specifications Issue 7</a>, IEEE Std 1003.1-2017, 2018
Edition.
Because the database's scope encompasses real-world changes to civil
timekeeping, its model for describing time is more complex than the
standard and daylight saving times supported by POSIX.1-2017.
Edition), POSIX.1-2024 requires support for the
<code><abbr>tz</abbr></code> database, which has a
model for describing civil time that is more complex than the
standard and daylight saving times required by POSIX.1-2017.
A <code><abbr>tz</abbr></code> timezone corresponds to a ruleset that can
have more than two changes per year, these changes need not merely
flip back and forth between two alternatives, and the rules themselves
@@ -121,8 +123,9 @@ If geolocation information is available, a selection interface can
locate the user on a timezone map or prioritize names that are
geographically close. For an example selection interface, see the
<code>tzselect</code> program in the <code><abbr>tz</abbr></code> code.
The <a href="https://cldr.unicode.org">Unicode Common Locale Data
Repository</a> contains data that may be useful for other selection
Unicode's <a href="https://cldr.unicode.org">Common Locale Data
Repository (<abbr>CLDR</abbr>)</a>
contains data that may be useful for other selection
interfaces; it maps timezone names like <code>Europe/Prague</code> to
locale-dependent strings like "Prague", "Praha", "Прага", and "布拉格".
</p>
@@ -159,7 +162,7 @@ among the following goals:
</ul>
<p>
Names normally have the form
Names normally have the format
<var>AREA</var><code>/</code><var>LOCATION</var>, where
<var>AREA</var> is a continent or ocean, and
<var>LOCATION</var> is a specific location within the area.
@@ -187,7 +190,7 @@ in decreasing order of importance:
href="https://en.wikipedia.org/wiki/ASCII">ASCII</a> letters,
'<code>.</code>', '<code>-</code>' and '<code>_</code>'.
Do not use digits, as that might create an ambiguity with <a
href="https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap08.html#tag_08_03">POSIX.1-2017
href="https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap08.html#tag_08_03">POSIX's proleptic
<code>TZ</code> strings</a>.
A file name component must not exceed 14 characters or start with
'<code>-</code>'.
@@ -198,6 +201,8 @@ in decreasing order of importance:
<li>
A name must not be empty, or contain '<code>//</code>', or
start or end with '<code>/</code>'.
Also, a name must not be '<code>Etc/Unknown</code>', as
<abbr>CLDR</abbr> uses that string for an unknown or invalid timezone.
</li>
<li>
Do not use names that differ only in case.
@@ -218,10 +223,18 @@ in decreasing order of importance:
do not need locations, since local time is not defined there.
</li>
<li>
If all the clocks in a timezone have agreed since 1970,
do not bother to include more than one timezone
even if some of the clocks disagreed before 1970.
If all clocks in a region have agreed since 1970,
give them just one name even if some of the clocks disagreed before 1970,
or reside in different countries or in notable or faraway locations.
Otherwise these tables would become annoyingly large.
For example, do not create a name <code>Indian/Crozet</code>
as a near-duplicate or alias of <code>Asia/Dubai</code>
merely because they are different countries or territories,
or their clocks disagreed before 1970, or the
<a href="https://en.wikipedia.org/wiki/Crozet_Islands">Crozet Islands</a>
are notable in their own right,
or the Crozet Islands are not adjacent to other locations
that use <code>Asia/Dubai</code>.
</li>
<li>
If boundaries between regions are fluid, such as during a war or
@@ -378,7 +391,8 @@ nowadays distributions typically use it
and no great weight should be attached to whether a link
is defined in <code>backward</code> or in some other file.
The source file <code>etcetera</code> defines names that may be useful
on platforms that do not support POSIX.1-2017-style <code>TZ</code> strings;
on platforms that do not support proleptic <code>TZ</code> strings
like <code>&lt;+08&gt;-8</code>;
no other source file other than <code>backward</code>
contains links to its zones.
One of <code>etcetera</code>'s names is <code>Etc/UTC</code>,
@@ -425,8 +439,8 @@ in decreasing order of importance:
In other words, in the C locale the POSIX extended regular
expression <code>[-+[:alnum:]]{3,6}</code> should match the
abbreviation.
This guarantees that all abbreviations could have been specified by a
POSIX.1-2017 <code>TZ</code> string.
This guarantees that all abbreviations could have been specified
explicitly by a POSIX proleptic <code>TZ</code> string.
</p>
</li>
<li>
@@ -576,8 +590,13 @@ in decreasing order of importance:
locations while uninhabited.
The leading '<code>-</code>' is a flag that the <abbr>UT</abbr> offset is in
some sense undefined; this notation is derived
from <a href="https://datatracker.ietf.org/doc/html/rfc3339">Internet
from <a href="https://www.rfc-editor.org/rfc/rfc3339">Internet
<abbr title="Request For Comments">RFC</abbr> 3339</a>.
(The abbreviation 'Z' that
<a href="https://www.rfc-editor.org/rfc/rfc9557">Internet
<abbr>RFC</abbr> 9557</a> uses for this concept
would violate the POSIX requirement
of at least three characters in an abbreviation.)
</li>
</ul>
@@ -775,7 +794,7 @@ href="https://www.dissentmagazine.org/blog/booked-a-global-history-of-time-vanes
the Western 06:00 to be 12:00. These practices are largely outside
the scope of the <code><abbr>tz</abbr></code> code and data, which
provide only limited support for date and time localization
such as that required by POSIX.1-2017.
such as that required by POSIX.
If <abbr>DST</abbr> is not used a different time zone
can often do the trick; for example, in Kenya a <code>TZ</code> setting
like <code>&lt;-03&gt;3</code> or <code>America/Cayenne</code> starts
@@ -866,29 +885,62 @@ Code compatible with this package is already
<a href="tz-link.html#tzdb">part of many platforms</a>, where the
primary use of this package is to update obsolete time-related files.
To do this, you may need to compile the time zone compiler
'<code>zic</code>' supplied with this package instead of using the
system '<code>zic</code>', since the format of <code>zic</code>'s
<code>zic</code> supplied with this package instead of using the
system <code>zic</code>, since the format of <code>zic</code>'s
input is occasionally extended, and a platform may still be shipping
an older <code>zic</code>.
</p>
<h3 id="POSIX">POSIX.1-2017 properties and limitations</h3>
<p>
In POSIX, time display in a process is controlled by the
environment variable <code>TZ</code>, which can have two forms:
</p>
<ul>
<li>
A <dfn>proleptic <code>TZ</code></dfn> value
like <code>CET-1CEST,M3.5.0,M10.5.0/3</code> uses a complex
notation that specifies a single standard time along with daylight
saving rules that apply to all years past, present, and future.
</li>
<li>
A <dfn>geographical <code>TZ</code></dfn> value
like <code>Europe/Berlin</code> names a location that stands for
civil time near that location, which can have more than
one standard time and more than one set of daylight saving rules,
to record timekeeping practice more accurately.
These names are defined by the <code><abbr>tz</abbr></code> database.
</li>
</ul>
<h3 id="POSIX.1-2017">POSIX.1-2017 properties and limitations</h3>
<p>
Some platforms support only the features required by POSIX.1-2017,
and have not yet upgraded to POSIX.1-2024.
Code intended to be portable to these platforms must deal
with problems that were fixed in later POSIX editions.
</p>
<ul>
<li>
POSIX.1-2017 does not require support for geographical <code>TZ</code>,
and there is no convenient and efficient way to determine
the <abbr>UT</abbr> offset and time zone abbreviation of arbitrary
timestamps, particularly for timezones
that do not fit into the POSIX model.
</li>
<li>
<p>
In POSIX.1-2017, time display in a process is controlled by the
environment variable <code>TZ</code>.
Unfortunately, the POSIX.1-2017
<code>TZ</code> string takes a form that is hard to describe and
is error-prone in practice.
Also, POSIX.1-2017 <code>TZ</code> strings cannot deal with daylight
The proleptic <code>TZ</code> string,
which is all that POSIX.1-2017 requires,
has a format that is hard to describe and is error-prone in practice.
Also, proleptic <code>TZ</code> strings cannot deal with daylight
saving time rules not based on the Gregorian calendar (as in
Morocco), or with situations where more than two time zone
abbreviations or <abbr>UT</abbr> offsets are used in an area.
</p>
<p>
The POSIX.1-2017 <code>TZ</code> string takes the following form:
A proleptic <code>TZ</code> string has the following format:
</p>
<p>
@@ -955,7 +1007,7 @@ an older <code>zic</code>.
</dl>
<p>
Here is an example POSIX.1-2017 <code>TZ</code> string for New
Here is an example proleptic <code>TZ</code> string for New
Zealand after 2007.
It says that standard time (<abbr>NZST</abbr>) is 12 hours ahead
of <abbr>UT</abbr>, and that daylight saving time
@@ -966,26 +1018,46 @@ an older <code>zic</code>.
<pre><code>TZ='NZST-12NZDT,M9.5.0,M4.1.0/3'</code></pre>
<p>
This POSIX.1-2017 <code>TZ</code> string is hard to remember, and
This proleptic <code>TZ</code> string is hard to remember, and
mishandles some timestamps before 2008.
With this package you can use this instead:
With this package you can use a geographical <code>TZ</code> instead:
</p>
<pre><code>TZ='Pacific/Auckland'</code></pre>
</li>
</ul>
<p>
POSIX.1-2017 also has the limitations of POSIX.1-2024,
discussed in the next section.
</p>
<h3 id="POSIX.1-2024">POSIX.1-2024 properties and limitations</h3>
<p>
POSIX.1-2024 extends POSIX.1-2017 in the following significant ways:
</p>
<ul>
<li>
POSIX does not define the <abbr>DST</abbr> transitions
for <code>TZ</code> values like
"<code>EST5EDT</code>".
Traditionally the current <abbr>US</abbr> <abbr>DST</abbr> rules
were used to interpret such values, but this meant that the
<abbr>US</abbr> <abbr>DST</abbr> rules were compiled into each
time conversion package, and when
<abbr>US</abbr> time conversion rules changed (as in the United
States in 1987 and again in 2007), all packages that
interpreted <code>TZ</code> values had to be updated
to ensure proper results.
POSIX.1-2024 requires support for geographical <code>TZ</code>.
Earlier POSIX editions require support only for proleptic <code>TZ</code>.
</li>
<li>
POSIX.1-2024 requires <code>struct tm</code>
to have a <abbr>UT</abbr> offset member <code>tm_gmtoff</code>
and a time zone abbreviation member <code>tm_zone</code>.
Earlier POSIX editions lack this requirement.
</li>
<li>
DST transition times can range from &minus;167:59:59
to 167:59:59 instead of merely from 00:00:00 to 24:59:59.
This allows for proleptic TZ strings
like <code>"&lt;-02&gt;2&lt;-01&gt;,M3.5.0/-1,M10.5.0/0"</code>
where the transition time &minus;1:00 means 23:00 the previous day.
</li>
</ul>
<p>
However POSIX.1-2024, like earlier POSIX editions, has some limitations:
<ul>
<li>
The <code>TZ</code> environment variable is process-global, which
makes it hard to write efficient, thread-safe applications that
@@ -1003,16 +1075,34 @@ an older <code>zic</code>.
handling daylight saving time shifts &ndash; as might be required to
limit phone calls to off-peak hours.
</li>
<li>
POSIX.1-2017 provides no convenient and efficient way to determine
the <abbr>UT</abbr> offset and time zone abbreviation of arbitrary
timestamps, particularly for timezones
that do not fit into the POSIX model.
</li>
<li>
POSIX requires that <code>time_t</code> clock counts exclude leap
seconds.
</li>
<li>
POSIX does not define the <abbr>DST</abbr> transitions
for <code>TZ</code> values like
"<code>EST5EDT</code>".
Traditionally the current <abbr>US</abbr> <abbr>DST</abbr> rules
were used to interpret such values, but this meant that the
<abbr>US</abbr> <abbr>DST</abbr> rules were compiled into each
time conversion package, and when
<abbr>US</abbr> time conversion rules changed (as in the United
States in 1987 and again in 2007), all packages that
interpreted <code>TZ</code> values had to be updated
to ensure proper results.
</li>
</ul>
<h3 id="POSIX-extensions">Extensions to POSIX in the
<code><abbr>tz</abbr></code> code</h3>
<p>
The <code><abbr>tz</abbr></code> code defines some properties
left unspecified by POSIX, and attempts to support some
extensions to POSIX.
</p>
<ul>
<li>
The <code><abbr>tz</abbr></code> code attempts to support all the
<code>time_t</code> implementations allowed by POSIX.
@@ -1026,25 +1116,18 @@ an older <code>zic</code>.
and 40-bit integers are also used occasionally.
Although earlier POSIX versions allowed <code>time_t</code> to be a
floating-point type, this was not supported by any practical system,
and POSIX.1-2013 and the <code><abbr>tz</abbr></code> code both
and POSIX.1-2013+ and the <code><abbr>tz</abbr></code> code both
require <code>time_t</code> to be an integer type.
</li>
</ul>
<h3 id="POSIX-extensions">Extensions to POSIX.1-2017 in the
<code><abbr>tz</abbr></code> code</h3>
<ul>
<li>
<p>
The <code>TZ</code> environment variable is used in generating
the name of a file from which time-related information is read
(or is interpreted à la POSIX.1-2017); <code>TZ</code> is no longer
constrained to be a string containing abbreviations
and numeric data as described <a href="#POSIX">above</a>.
If the <code>TZ</code> environment variable uses the geographical format,
it is used in generating
the name of a file from which time-related information is read.
The file's format is <dfn><abbr>TZif</abbr></dfn>,
a timezone information format that contains binary data; see
<a href="https://datatracker.ietf.org/doc/html/8536">Internet
<abbr>RFC</abbr> 8536</a>.
<a href="https://www.rfc-editor.org/rfc/9636">Internet
<abbr>RFC</abbr> 9636</a>.
The daylight saving time rules to be used for a
particular timezone are encoded in the
<abbr>TZif</abbr> file; the format of the file allows <abbr>US</abbr>,
@@ -1053,10 +1136,11 @@ an older <code>zic</code>.
abbreviations are used.
</p>
<p>
It was recognized that allowing the <code>TZ</code> environment
When the <code><abbr>tz</abbr></code> code was developed in the 1980s,
it was recognized that allowing the <code>TZ</code> environment
variable to take on values such as '<code>America/New_York</code>'
might cause "old" programs (that expect <code>TZ</code> to have a
certain form) to operate incorrectly; consideration was given to using
certain format) to operate incorrectly; consideration was given to using
some other environment variable (for example, <code>TIMEZONE</code>)
to hold the string used to generate the <abbr>TZif</abbr> file's name.
In the end, however, it was decided to continue using
@@ -1069,15 +1153,6 @@ an older <code>zic</code>.
assume pre-POSIX <code>TZ</code> values.
</p>
</li>
<li>
The code supports platforms with a <abbr>UT</abbr> offset member
in <code>struct tm</code>, e.g., <code>tm_gmtoff</code>,
or with a time zone abbreviation member in
<code>struct tm</code>, e.g., <code>tm_zone</code>. As noted
in <a href="https://austingroupbugs.net/view.php?id=1533">Austin
Group defect 1533</a>, a future version of POSIX is planned to
require <code>tm_gmtoff</code> and <code>tm_zone</code>.
</li>
<li>
Functions <code>tzalloc</code>, <code>tzfree</code>,
<code>localtime_rz</code>, and <code>mktime_z</code> for
@@ -1088,7 +1163,7 @@ an older <code>zic</code>.
and <code>localtime_rz</code> and <code>mktime_z</code> are
like <code>localtime_r</code> and <code>mktime</code> with an
extra <code>timezone_t</code> argument.
The functions were inspired by <a href="https://netbsd.org/">NetBSD</a>.
The functions were inspired by <a href="https://netbsd.org">NetBSD</a>.
</li>
<li>
Negative <code>time_t</code> values are supported, on systems
@@ -1116,6 +1191,7 @@ The vestigial <abbr>API</abbr>s are:
<li>
The POSIX <code>tzname</code> variable does not suffice and is no
longer needed.
It is planned to be removed in a future edition of POSIX.
To get a timestamp's time zone abbreviation, consult
the <code>tm_zone</code> member if available; otherwise,
use <code>strftime</code>'s <code>"%Z"</code> conversion
@@ -1124,6 +1200,7 @@ The vestigial <abbr>API</abbr>s are:
<li>
The POSIX <code>daylight</code> and <code>timezone</code>
variables do not suffice and are no longer needed.
They are planned to be removed in a future edition of POSIX.
To get a timestamp's <abbr>UT</abbr> offset, consult
the <code>tm_gmtoff</code> member if available; otherwise,
subtract values returned by <code>localtime</code>
@@ -1135,12 +1212,15 @@ The vestigial <abbr>API</abbr>s are:
The <code>tm_isdst</code> member is almost never needed and most of
its uses should be discouraged in favor of the abovementioned
<abbr>API</abbr>s.
It was intended as an index into the <code>tzname</code> variable,
but as mentioned previously that usage is obsolete.
Although it can still be used in arguments to
<code>mktime</code> to disambiguate timestamps near
a <abbr>DST</abbr> transition when the clock jumps back on
platforms lacking <code>tm_gmtoff</code>, this
disambiguation does not work when standard time itself jumps back,
which can occur when a location changes to a time zone with a
disambiguation works only for proleptic <code>TZ</code> strings;
it does not work in general for geographical timezones,
such as when a location changes to a time zone with a
lesser <abbr>UT</abbr> offset.
</li>
</ul>
@@ -1157,8 +1237,8 @@ The vestigial <abbr>API</abbr>s are:
Programs that in the past used the <code>timezone</code> function
may now examine <code>localtime(&amp;clock)-&gt;tm_zone</code>
(if <code>TM_ZONE</code> is defined) or
<code>tzname[localtime(&amp;clock)-&gt;tm_isdst]</code>
(if <code>HAVE_TZNAME</code> is nonzero) to learn the correct time
use <code>strftime</code> with a <code>%Z</code> conversion specification
to learn the correct time
zone abbreviation to use.
</li>
<li>
@@ -1278,13 +1358,13 @@ between now and the future time.
<p>
Leap seconds were introduced in 1972 to accommodate the
difference between atomic time and the less regular rotation of the earth.
Unfortunately they caused so many problems with civil
timekeeping that they
are <a href="https://www.bipm.org/en/cgpm-2022/resolution-4">planned
to be discontinued by 2035</a>, with some as-yet-undetermined
mechanism replacing them, perhaps after the year 2135.
Despite their impending obsolescence, a record of leap seconds is still
needed to resolve timestamps from 1972 through 2035.
Unfortunately they have caused so many problems with civil
timekeeping that there are
<a href="https://www.bipm.org/en/cgpm-2022/resolution-4">plans
to discontinue them by 2035</a>.
Even if these plans come to fruition, a record of leap seconds will still be
needed to resolve timestamps from 1972 through 2035,
and there may also be a need to record whatever mechanism replaces them.
</p>
<p>
@@ -1374,6 +1454,12 @@ href='https://www.esa.int/Applications/Navigation/Telling_time_on_the_Moon'>cons
the establishment of a reference timescale for the Moon, which has
days roughly equivalent to 29.5 Earth days, and where relativistic
effects cause clocks to tick slightly faster than on Earth.
Also, <abbr title="National Aeronautics and Space Administration">NASA</abbr>
has been <a
href='https://www.whitehouse.gov/wp-content/uploads/2024/04/Celestial-Time-Standardization-Policy.pdf'>ordered</a>
to consider the establishment of Coordinated Lunar Time (<abbr>LTC</abbr>).
It is not yet known whether the US and European efforts will result in
multiple timescales on the Moon.
</p>
<p>
+1 -1
View File
@@ -1 +1 @@
2024a
2025a
+14 -18
View File
@@ -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
+2 -3
View File
@@ -264,8 +264,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
@@ -311,7 +310,7 @@ PF -0900-13930 Pacific/Marquesas Marquesas Islands
PF -2308-13457 Pacific/Gambier Gambier Islands
PG -0930+14710 Pacific/Port_Moresby most of Papua New Guinea
PG -0613+15534 Pacific/Bougainville Bougainville
PH +1435+12100 Asia/Manila
PH +143512+1205804 Asia/Manila
PK +2452+06703 Asia/Karachi
PL +5215+02100 Europe/Warsaw
PM +4703-05620 America/Miquelon
+4 -5
View File
@@ -184,7 +184,7 @@ IR +3540+05126 Asia/Tehran
IT,SM,VA +4154+01229 Europe/Rome
JM +175805-0764736 America/Jamaica
JO +3157+03556 Asia/Amman
JP +353916+1394441 Asia/Tokyo
JP,AU +353916+1394441 Asia/Tokyo Eyre Bird Observatory
KE,DJ,ER,ET,KM,MG,SO,TZ,UG,YT -0117+03649 Africa/Nairobi
KG +4254+07436 Asia/Bishkek
KI,MH,TV,UM,WF +0125+17300 Pacific/Tarawa Gilberts, Marshalls, Wake
@@ -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
@@ -248,7 +247,7 @@ PF -0900-13930 Pacific/Marquesas Marquesas Islands
PF -2308-13457 Pacific/Gambier Gambier Islands
PG,AQ,FM -0930+14710 Pacific/Port_Moresby Papua New Guinea (most areas), Chuuk, Yap, Dumont d'Urville
PG -0613+15534 Pacific/Bougainville Bougainville
PH +1435+12100 Asia/Manila
PH +143512+1205804 Asia/Manila
PK +2452+06703 Asia/Karachi
PL +5215+02100 Europe/Warsaw
PM +4703-05620 America/Miquelon
@@ -295,7 +294,7 @@ RU +6445+17729 Asia/Anadyr MSK+09 - Bering Sea
SA,AQ,KW,YE +2438+04643 Asia/Riyadh Syowa
SB,FM -0932+16012 Pacific/Guadalcanal Pohnpei
SD +1536+03232 Africa/Khartoum
SG,MY +0117+10351 Asia/Singapore peninsular Malaysia
SG,AQ,MY +0117+10351 Asia/Singapore peninsular Malaysia, Concordia
SR +0550-05510 America/Paramaribo
SS +0451+03137 Africa/Juba
ST +0020+00644 Africa/Sao_Tome
+5 -12
View File
@@ -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
@@ -97,9 +97,6 @@ XX +1828-06954 America/Santo_Domingo Atlantic Standard ("AST") - eastern Caribbe
# -04/-03 (Chile DST)
XX -3327-07040 America/Santiago most of Chile
#
# -04/-03 (Paraguay DST)
XX -2516-05740 America/Asuncion Paraguay
#
# -04/-03 - AST/ADT (North America DST)
XX +4439-06336 America/Halifax Atlantic ("AST/ADT") - Canada; Bermuda
#
@@ -123,8 +120,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 +194,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 +210,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
@@ -228,7 +221,7 @@ XX +1345+10031 Asia/Bangkok Russia; Indochina; Christmas Island
XX -0610+10648 Asia/Jakarta Indonesia ("WIB")
#
# +08
XX +0117+10351 Asia/Singapore Russia; Brunei; Malaysia; Singapore
XX +0117+10351 Asia/Singapore Russia; Brunei; Malaysia; Singapore; Concordia
#
# +08 - AWST
XX -3157+11551 Australia/Perth Western Australia ("AWST")
@@ -240,7 +233,7 @@ XX +3114+12128 Asia/Shanghai China ("CST")
XX +2217+11409 Asia/Hong_Kong Hong Kong ("HKT")
#
# +08 - PHT
XX +1435+12100 Asia/Manila Philippines ("PHT")
XX +143512+1205804 Asia/Manila Philippines ("PHT")
#
# +08 - WITA
XX -0507+11924 Asia/Makassar Indonesia ("WITA")
@@ -252,7 +245,7 @@ XX -3143+12852 Australia/Eucla Eucla
XX +5203+11328 Asia/Chita Russia; Palau; East Timor
#
# +09 - JST
XX +353916+1394441 Asia/Tokyo Japan ("JST")
XX +353916+1394441 Asia/Tokyo Japan ("JST"); Eyre Bird Observatory
#
# +09 - KST
XX +3733+12658 Asia/Seoul Korea ("KST")
+9 -7
View File
@@ -1278,7 +1278,8 @@ daemon.lo daemon.o: $(srcdir)/daemon/daemon.c config.h $(srcdir)/daemon/daemon.h
$(srcdir)/util/edns.h $(srcdir)/services/listen_dnsport.h $(srcdir)/services/cache/rrset.h \
$(srcdir)/services/cache/infra.h $(srcdir)/util/rtt.h $(srcdir)/services/localzone.h \
$(srcdir)/services/authzone.h $(srcdir)/services/mesh.h $(srcdir)/services/rpz.h $(srcdir)/respip/respip.h \
$(srcdir)/util/random.h $(srcdir)/util/tube.h $(srcdir)/util/net_help.h $(srcdir)/sldns/keyraw.h
$(srcdir)/util/random.h $(srcdir)/util/tube.h $(srcdir)/util/net_help.h $(srcdir)/sldns/keyraw.h \
$(srcdir)/iterator/iter_fwd.h $(srcdir)/iterator/iter_hints.h
remote.lo remote.o: $(srcdir)/daemon/remote.c config.h $(srcdir)/daemon/remote.h $(srcdir)/daemon/worker.h \
$(srcdir)/libunbound/worker.h $(srcdir)/sldns/sbuffer.h $(srcdir)/util/data/packed_rrset.h \
$(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h $(srcdir)/util/log.h $(srcdir)/util/netevent.h \
@@ -1355,7 +1356,7 @@ testbound.lo testbound.o: $(srcdir)/testcode/testbound.c config.h $(srcdir)/test
$(srcdir)/util/data/msgparse.h $(srcdir)/sldns/pkthdr.h $(srcdir)/sldns/rrdef.h $(srcdir)/util/tube.h \
$(srcdir)/services/mesh.h $(srcdir)/services/rpz.h $(srcdir)/services/localzone.h $(srcdir)/services/view.h \
$(srcdir)/services/authzone.h $(srcdir)/daemon/stats.h $(srcdir)/util/timehist.h $(srcdir)/libunbound/unbound.h \
$(srcdir)/respip/respip.h $(srcdir)/util/net_help.h $(srcdir)/util/ub_event.h
$(srcdir)/respip/respip.h $(srcdir)/util/net_help.h $(srcdir)/util/ub_event.h $(srcdir)/daemon/worker.h
testpkts.lo testpkts.o: $(srcdir)/testcode/testpkts.c config.h $(srcdir)/testcode/testpkts.h \
$(srcdir)/util/net_help.h $(srcdir)/util/log.h $(srcdir)/sldns/sbuffer.h $(srcdir)/sldns/rrdef.h $(srcdir)/sldns/pkthdr.h \
$(srcdir)/sldns/str2wire.h $(srcdir)/sldns/wire2str.h
@@ -1428,7 +1429,7 @@ fake_event.lo fake_event.o: $(srcdir)/testcode/fake_event.c config.h $(srcdir)/t
$(srcdir)/util/tube.h $(srcdir)/services/mesh.h $(srcdir)/services/modstack.h $(srcdir)/services/rpz.h \
$(srcdir)/services/localzone.h $(srcdir)/services/view.h $(srcdir)/sldns/sbuffer.h $(srcdir)/services/authzone.h \
$(srcdir)/daemon/stats.h $(srcdir)/util/timehist.h $(srcdir)/libunbound/unbound.h $(srcdir)/respip/respip.h \
$(srcdir)/sldns/wire2str.h $(srcdir)/sldns/str2wire.h $(srcdir)/daemon/remote.h
$(srcdir)/sldns/wire2str.h $(srcdir)/sldns/str2wire.h $(srcdir)/daemon/remote.h $(srcdir)/util/storage/slabhash.h $(srcdir)/daemon/daemon.h
lock_verify.lo lock_verify.o: $(srcdir)/testcode/lock_verify.c config.h $(srcdir)/util/log.h $(srcdir)/util/rbtree.h \
$(srcdir)/util/locks.h $(srcdir)/util/fptr_wlist.h $(srcdir)/util/netevent.h $(srcdir)/dnscrypt/dnscrypt.h \
$(srcdir)/util/storage/lruhash.h $(srcdir)/util/module.h \
@@ -1484,7 +1485,8 @@ context.lo context.o: $(srcdir)/libunbound/context.c config.h $(srcdir)/libunbou
$(srcdir)/util/storage/slabhash.h $(srcdir)/services/cache/infra.h $(srcdir)/util/rtt.h \
$(srcdir)/util/netevent.h $(srcdir)/dnscrypt/dnscrypt.h \
$(srcdir)/services/authzone.h $(srcdir)/services/mesh.h $(srcdir)/services/rpz.h $(srcdir)/daemon/stats.h \
$(srcdir)/util/timehist.h $(srcdir)/respip/respip.h $(srcdir)/util/edns.h
$(srcdir)/util/timehist.h $(srcdir)/respip/respip.h $(srcdir)/util/edns.h \
$(srcdir)/iterator/iter_fwd.h $(srcdir)/iterator/iter_hints.h
libunbound.lo libunbound.o: $(srcdir)/libunbound/libunbound.c $(srcdir)/libunbound/unbound.h \
$(srcdir)/libunbound/unbound-event.h config.h $(srcdir)/libunbound/context.h $(srcdir)/util/locks.h \
$(srcdir)/util/log.h $(srcdir)/util/alloc.h $(srcdir)/util/rbtree.h $(srcdir)/services/modstack.h \
@@ -1496,7 +1498,8 @@ libunbound.lo libunbound.o: $(srcdir)/libunbound/libunbound.c $(srcdir)/libunbou
$(srcdir)/sldns/sbuffer.h $(srcdir)/services/cache/infra.h $(srcdir)/util/rtt.h $(srcdir)/util/netevent.h \
$(srcdir)/dnscrypt/dnscrypt.h $(srcdir)/services/cache/rrset.h \
$(srcdir)/util/storage/slabhash.h $(srcdir)/services/authzone.h $(srcdir)/services/mesh.h \
$(srcdir)/services/rpz.h $(srcdir)/daemon/stats.h $(srcdir)/util/timehist.h $(srcdir)/respip/respip.h
$(srcdir)/services/rpz.h $(srcdir)/daemon/stats.h $(srcdir)/util/timehist.h $(srcdir)/respip/respip.h \
$(srcdir)/iterator/iter_fwd.h $(srcdir)/iterator/iter_hints.h
libworker.lo libworker.o: $(srcdir)/libunbound/libworker.c config.h $(srcdir)/libunbound/libworker.h \
$(srcdir)/util/data/packed_rrset.h $(srcdir)/util/storage/lruhash.h $(srcdir)/util/locks.h $(srcdir)/util/log.h \
$(srcdir)/libunbound/context.h $(srcdir)/util/alloc.h $(srcdir)/util/rbtree.h $(srcdir)/services/modstack.h \
@@ -1510,8 +1513,7 @@ libworker.lo libworker.o: $(srcdir)/libunbound/libworker.c config.h $(srcdir)/li
$(srcdir)/services/cache/rrset.h $(srcdir)/util/storage/slabhash.h $(srcdir)/services/outbound_list.h \
$(srcdir)/util/fptr_wlist.h $(srcdir)/util/tube.h $(srcdir)/util/regional.h $(srcdir)/util/random.h \
$(srcdir)/util/storage/lookup3.h $(srcdir)/util/net_help.h $(srcdir)/util/data/dname.h \
$(srcdir)/util/data/msgencode.h $(srcdir)/iterator/iter_fwd.h $(srcdir)/iterator/iter_hints.h \
$(srcdir)/sldns/str2wire.h
$(srcdir)/util/data/msgencode.h $(srcdir)/sldns/str2wire.h
unbound-host.lo unbound-host.o: $(srcdir)/smallapp/unbound-host.c config.h $(srcdir)/libunbound/unbound.h \
$(srcdir)/sldns/rrdef.h $(srcdir)/sldns/wire2str.h
asynclook.lo asynclook.o: $(srcdir)/testcode/asynclook.c config.h $(srcdir)/libunbound/unbound.h \
@@ -1,39 +1,43 @@
# ===========================================================================
# http://autoconf-archive.cryp.to/ac_pkg_swig.html
# https://www.gnu.org/software/autoconf-archive/ax_pkg_swig.html
# ===========================================================================
#
# SYNOPSIS
#
# AC_PROG_SWIG([major.minor.micro])
# AX_PKG_SWIG([major.minor.micro], [action-if-found], [action-if-not-found])
#
# DESCRIPTION
#
# This macro searches for a SWIG installation on your system. If found you
# should call SWIG via $(SWIG). You can use the optional first argument to
# check if the version of the available SWIG is greater than or equal to
# the value of the argument. It should have the format: N[.N[.N]] (N is a
# number between 0 and 999. Only the first N is mandatory.)
# This macro searches for a SWIG installation on your system. If found,
# then SWIG is AC_SUBST'd; if not found, then $SWIG is empty. If SWIG is
# found, then SWIG_LIB is set to the SWIG library path, and AC_SUBST'd.
#
# If the version argument is given (e.g. 1.3.17), AC_PROG_SWIG checks that
# the swig package is this version number or higher.
# You can use the optional first argument to check if the version of the
# available SWIG is greater than or equal to the value of the argument. It
# should have the format: N[.N[.N]] (N is a number between 0 and 999. Only
# the first N is mandatory.) If the version argument is given (e.g.
# 1.3.17), AX_PKG_SWIG checks that the swig package is this version number
# or higher.
#
# As usual, action-if-found is executed if SWIG is found, otherwise
# action-if-not-found is executed.
#
# In configure.in, use as:
#
# AC_PROG_SWIG(1.3.17)
# SWIG_ENABLE_CXX
# SWIG_MULTI_MODULE_SUPPORT
# SWIG_PYTHON
# AX_PKG_SWIG(1.3.17, [], [ AC_MSG_ERROR([SWIG is required to build..]) ])
# AX_SWIG_ENABLE_CXX
# AX_SWIG_MULTI_MODULE_SUPPORT
# AX_SWIG_PYTHON
#
# LAST MODIFICATION
#
# 2008-04-12
#
# COPYLEFT
# LICENSE
#
# Copyright (c) 2008 Sebastian Huber <[email protected]>
# Copyright (c) 2008 Alan W. Irwin <[email protected]>
# Copyright (c) 2008 Alan W. Irwin
# Copyright (c) 2008 Rafael Laboissiere <[email protected]>
# Copyright (c) 2008 Andrew Collier <[email protected]>
# Copyright (c) 2008 Andrew Collier
# Copyright (c) 2011 Murray Cumming <[email protected]>
# Copyright (c) 2018 Reini Urban <[email protected]>
# Copyright (c) 2021 Vincent Danjean <[email protected]>
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
@@ -46,7 +50,7 @@
# Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
# with this program. If not, see <https://www.gnu.org/licenses/>.
#
# As a special exception, the respective Autoconf Macro's copyright owner
# gives unlimited permission to copy, distribute and modify the configure
@@ -57,17 +61,21 @@
# all other use of the material that constitutes the Autoconf Macro.
#
# This special exception to the GPL applies to versions of the Autoconf
# Macro released by the Autoconf Macro Archive. When you make and
# distribute a modified version of the Autoconf Macro, you may extend this
# special exception to the GPL to apply to your modified version as well.
# Macro released by the Autoconf Archive. When you make and distribute a
# modified version of the Autoconf Macro, you may extend this special
# exception to the GPL to apply to your modified version as well.
AC_DEFUN([AC_PROG_SWIG],[
AC_PATH_PROG([SWIG],[swig])
#serial 15
AC_DEFUN([AX_PKG_SWIG],[
# Find path to the "swig" executable.
AC_PATH_PROGS([SWIG],[swig swig3.0 swig2.0])
if test -z "$SWIG" ; then
AC_MSG_WARN([cannot find 'swig' program. You should look at http://www.swig.org])
SWIG='echo "Error: SWIG is not installed. You should look at http://www.swig.org" ; false'
elif test -n "$1" ; then
AC_MSG_CHECKING([for SWIG version])
m4_ifval([$3],[$3],[:])
elif test -z "$1" ; then
m4_ifval([$2],[$2],[:])
else
AC_MSG_CHECKING([SWIG version])
[swig_version=`$SWIG -version 2>&1 | grep 'SWIG Version' | sed 's/.*\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*/\1/g'`]
AC_MSG_RESULT([$swig_version])
if test -n "$swig_version" ; then
@@ -77,12 +85,12 @@ AC_DEFUN([AC_PROG_SWIG],[
if test -z "$required_major" ; then
[required_major=0]
fi
[required=`echo $required | sed 's/[0-9]*[^0-9]//'`]
[required=`echo $required. | sed 's/[0-9]*[^0-9]//'`]
[required_minor=`echo $required | sed 's/[^0-9].*//'`]
if test -z "$required_minor" ; then
[required_minor=0]
fi
[required=`echo $required | sed 's/[0-9]*[^0-9]//'`]
[required=`echo $required. | sed 's/[0-9]*[^0-9]//'`]
[required_patch=`echo $required | sed 's/[^0-9].*//'`]
if test -z "$required_patch" ; then
[required_patch=0]
@@ -103,30 +111,28 @@ AC_DEFUN([AC_PROG_SWIG],[
if test -z "$available_patch" ; then
[available_patch=0]
fi
[badversion=0]
if test $available_major -lt $required_major ; then
[badversion=1]
fi
if test $available_major -eq $required_major \
-a $available_minor -lt $required_minor ; then
[badversion=1]
fi
if test $available_major -eq $required_major \
-a $available_minor -eq $required_minor \
-a $available_patch -lt $required_patch ; then
[badversion=1]
fi
if test $badversion -eq 1 ; then
AC_MSG_WARN([SWIG version >= $1 is required. You have $swig_version. You should look at http://www.swig.org])
SWIG='echo "Error: SWIG version >= $1 is required. You have '"$swig_version"'. You should look at http://www.swig.org" ; false'
# Convert the version tuple into a single number for easier comparison.
# Using base 100 should be safe since SWIG internally uses BCD values
# to encode its version number.
required_swig_vernum=`expr $required_major \* 10000 \
\+ $required_minor \* 100 \+ $required_patch`
available_swig_vernum=`expr $available_major \* 10000 \
\+ $available_minor \* 100 \+ $available_patch`
if test $available_swig_vernum -lt $required_swig_vernum; then
AC_MSG_WARN([SWIG version >= $1 is required. You have $swig_version.])
SWIG=''
m4_ifval([$3],[$3],[])
else
AC_MSG_NOTICE([SWIG executable is '$SWIG'])
SWIG_LIB=`$SWIG -swiglib`
AC_MSG_NOTICE([SWIG library directory is '$SWIG_LIB'])
AC_MSG_CHECKING([for SWIG library])
SWIG_LIB=`$SWIG -swiglib | tr '\r\n' ' '`
AC_MSG_RESULT([$SWIG_LIB])
m4_ifval([$2],[$2],[])
fi
else
AC_MSG_WARN([cannot determine SWIG version])
SWIG='echo "Error: Cannot determine SWIG version. You should look at http://www.swig.org" ; false'
SWIG=''
m4_ifval([$3],[$3],[])
fi
fi
AC_SUBST([SWIG_LIB])
+317 -127
View File
@@ -1,5 +1,5 @@
# ===========================================================================
# http://www.gnu.org/software/autoconf-archive/ax_pthread.html
# https://www.gnu.org/software/autoconf-archive/ax_pthread.html
# ===========================================================================
#
# SYNOPSIS
@@ -14,24 +14,28 @@
# flags that are needed. (The user can also force certain compiler
# flags/libs to be tested by setting these environment variables.)
#
# Also sets PTHREAD_CC to any special C compiler that is needed for
# multi-threaded programs (defaults to the value of CC otherwise). (This
# is necessary on AIX to use the special cc_r compiler alias.)
# Also sets PTHREAD_CC and PTHREAD_CXX to any special C compiler that is
# needed for multi-threaded programs (defaults to the value of CC
# respectively CXX otherwise). (This is necessary on e.g. AIX to use the
# special cc_r/CC_r compiler alias.)
#
# NOTE: You are assumed to not only compile your program with these flags,
# but also link it with them as well. e.g. you should link with
# but also to link with them as well. For example, you might link with
# $PTHREAD_CC $CFLAGS $PTHREAD_CFLAGS $LDFLAGS ... $PTHREAD_LIBS $LIBS
# $PTHREAD_CXX $CXXFLAGS $PTHREAD_CFLAGS $LDFLAGS ... $PTHREAD_LIBS $LIBS
#
# If you are only building threads programs, you may wish to use these
# If you are only building threaded programs, you may wish to use these
# variables in your default LIBS, CFLAGS, and CC:
#
# LIBS="$PTHREAD_LIBS $LIBS"
# CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
# CXXFLAGS="$CXXFLAGS $PTHREAD_CFLAGS"
# CC="$PTHREAD_CC"
# CXX="$PTHREAD_CXX"
#
# In addition, if the PTHREAD_CREATE_JOINABLE thread-attribute constant
# has a nonstandard name, defines PTHREAD_CREATE_JOINABLE to that name
# (e.g. PTHREAD_CREATE_UNDETACHED on AIX).
# has a nonstandard name, this macro defines PTHREAD_CREATE_JOINABLE to
# that name (e.g. PTHREAD_CREATE_UNDETACHED on AIX).
#
# Also HAVE_PTHREAD_PRIO_INHERIT is defined if pthread is found and the
# PTHREAD_PRIO_INHERIT symbol is defined when compiling with
@@ -55,6 +59,7 @@
#
# Copyright (c) 2008 Steven G. Johnson <[email protected]>
# Copyright (c) 2011 Daniel Richard G. <[email protected]>
# Copyright (c) 2019 Marc Stevens <[email protected]>
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
@@ -67,7 +72,7 @@
# Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
# with this program. If not, see <https://www.gnu.org/licenses/>.
#
# As a special exception, the respective Autoconf Macro's copyright owner
# gives unlimited permission to copy, distribute and modify the configure
@@ -82,35 +87,41 @@
# modified version of the Autoconf Macro, you may extend this special
# exception to the GPL to apply to your modified version as well.
#serial 21
#serial 31
AU_ALIAS([ACX_PTHREAD], [AX_PTHREAD])
AC_DEFUN([AX_PTHREAD], [
AC_REQUIRE([AC_CANONICAL_HOST])
AC_REQUIRE([AC_PROG_CC])
AC_REQUIRE([AC_PROG_SED])
AC_LANG_PUSH([C])
ax_pthread_ok=no
# We used to check for pthread.h first, but this fails if pthread.h
# requires special compiler flags (e.g. on True64 or Sequent).
# requires special compiler flags (e.g. on Tru64 or Sequent).
# It gets checked for in the link test anyway.
# First of all, check if the user has set any of the PTHREAD_LIBS,
# etcetera environment variables, and if threads linking works using
# them:
if test x"$PTHREAD_LIBS$PTHREAD_CFLAGS" != x; then
save_CFLAGS="$CFLAGS"
if test "x$PTHREAD_CFLAGS$PTHREAD_LIBS" != "x"; then
ax_pthread_save_CC="$CC"
ax_pthread_save_CFLAGS="$CFLAGS"
ax_pthread_save_LIBS="$LIBS"
AS_IF([test "x$PTHREAD_CC" != "x"], [CC="$PTHREAD_CC"])
AS_IF([test "x$PTHREAD_CXX" != "x"], [CXX="$PTHREAD_CXX"])
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
save_LIBS="$LIBS"
LIBS="$PTHREAD_LIBS $LIBS"
AC_MSG_CHECKING([for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS])
AC_TRY_LINK_FUNC([pthread_join], [ax_pthread_ok=yes])
AC_MSG_CHECKING([for pthread_join using $CC $PTHREAD_CFLAGS $PTHREAD_LIBS])
AC_LINK_IFELSE([AC_LANG_CALL([], [pthread_join])], [ax_pthread_ok=yes])
AC_MSG_RESULT([$ax_pthread_ok])
if test x"$ax_pthread_ok" = xno; then
if test "x$ax_pthread_ok" = "xno"; then
PTHREAD_LIBS=""
PTHREAD_CFLAGS=""
fi
LIBS="$save_LIBS"
CFLAGS="$save_CFLAGS"
CC="$ax_pthread_save_CC"
CFLAGS="$ax_pthread_save_CFLAGS"
LIBS="$ax_pthread_save_LIBS"
fi
# We must check for the threads library under a number of different
@@ -118,12 +129,14 @@ fi
# (e.g. DEC) have both -lpthread and -lpthreads, where one of the
# libraries is broken (non-POSIX).
# Create a list of thread flags to try. Items starting with a "-" are
# C compiler flags, and other items are library names, except for "none"
# which indicates that we try without any flags at all, and "pthread-config"
# which is a program returning the flags for the Pth emulation library.
# Create a list of thread flags to try. Items with a "," contain both
# C compiler flags (before ",") and linker flags (after ","). Other items
# starting with a "-" are C compiler flags, and remaining items are
# library names, except for "none" which indicates that we try without
# any flags at all, and "pthread-config" which is a program returning
# the flags for the Pth emulation library.
ax_pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config"
ax_pthread_flags="pthreads none -Kthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config"
# The ordering *is* (sometimes) important. Some notes on the
# individual items follow:
@@ -132,82 +145,163 @@ ax_pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads -mt
# none: in case threads are in libc; should be tried before -Kthread and
# other compiler flags to prevent continual compiler warnings
# -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h)
# -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able)
# lthread: LinuxThreads port on FreeBSD (also preferred to -pthread)
# -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads)
# -pthreads: Solaris/gcc
# -mthreads: Mingw32/gcc, Lynx/gcc
# -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads), Tru64
# (Note: HP C rejects this with "bad form for `-t' option")
# -pthreads: Solaris/gcc (Note: HP C also rejects)
# -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it
# doesn't hurt to check since this sometimes defines pthreads too;
# also defines -D_REENTRANT)
# ... -mt is also the pthreads flag for HP/aCC
# doesn't hurt to check since this sometimes defines pthreads and
# -D_REENTRANT too), HP C (must be checked before -lpthread, which
# is present but should not be used directly; and before -mthreads,
# because the compiler interprets this as "-mt" + "-hreads")
# -mthreads: Mingw32/gcc, Lynx/gcc
# pthread: Linux, etcetera
# --thread-safe: KAI C++
# pthread-config: use pthread-config program (for GNU Pth library)
case ${host_os} in
case $host_os in
freebsd*)
# -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able)
# lthread: LinuxThreads port on FreeBSD (also preferred to -pthread)
ax_pthread_flags="-kthread lthread $ax_pthread_flags"
;;
hpux*)
# From the cc(1) man page: "[-mt] Sets various -D flags to enable
# multi-threading and also sets -lpthread."
ax_pthread_flags="-mt -pthread pthread $ax_pthread_flags"
;;
openedition*)
# IBM z/OS requires a feature-test macro to be defined in order to
# enable POSIX threads at all, so give the user a hint if this is
# not set. (We don't define these ourselves, as they can affect
# other portions of the system API in unpredictable ways.)
AC_EGREP_CPP([AX_PTHREAD_ZOS_MISSING],
[
# if !defined(_OPEN_THREADS) && !defined(_UNIX03_THREADS)
AX_PTHREAD_ZOS_MISSING
# endif
],
[AC_MSG_WARN([IBM z/OS requires -D_OPEN_THREADS or -D_UNIX03_THREADS to enable pthreads support.])])
;;
solaris*)
# On Solaris (at least, for some versions), libc contains stubbed
# (non-functional) versions of the pthreads routines, so link-based
# tests will erroneously succeed. (We need to link with -pthreads/-mt/
# -lpthread.) (The stubs are missing pthread_cleanup_push, or rather
# a function called by this macro, so we could check for that, but
# who knows whether they'll stub that too in a future libc.) So,
# we'll just look for -pthreads and -lpthread first:
# tests will erroneously succeed. (N.B.: The stubs are missing
# pthread_cleanup_push, or rather a function called by this macro,
# so we could check for that, but who knows whether they'll stub
# that too in a future libc.) So we'll check first for the
# standard Solaris way of linking pthreads (-mt -lpthread).
ax_pthread_flags="-pthreads pthread -mt -pthread $ax_pthread_flags"
;;
darwin*)
ax_pthread_flags="-pthread $ax_pthread_flags"
ax_pthread_flags="-mt,-lpthread pthread $ax_pthread_flags"
;;
esac
# Clang doesn't consider unrecognized options an error unless we specify
# -Werror. We throw in some extra Clang-specific options to ensure that
# this doesn't happen for GCC, which also accepts -Werror.
# Are we compiling with Clang?
AC_MSG_CHECKING([if compiler needs -Werror to reject unknown flags])
save_CFLAGS="$CFLAGS"
ax_pthread_extra_flags="-Werror"
CFLAGS="$CFLAGS $ax_pthread_extra_flags -Wunknown-warning-option -Wsizeof-array-argument"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([int foo(void);],[foo()])],
[AC_MSG_RESULT([yes])],
[ax_pthread_extra_flags=
AC_MSG_RESULT([no])])
CFLAGS="$save_CFLAGS"
AC_CACHE_CHECK([whether $CC is Clang],
[ax_cv_PTHREAD_CLANG],
[ax_cv_PTHREAD_CLANG=no
# Note that Autoconf sets GCC=yes for Clang as well as GCC
if test "x$GCC" = "xyes"; then
AC_EGREP_CPP([AX_PTHREAD_CC_IS_CLANG],
[/* Note: Clang 2.7 lacks __clang_[a-z]+__ */
# if defined(__clang__) && defined(__llvm__)
AX_PTHREAD_CC_IS_CLANG
# endif
],
[ax_cv_PTHREAD_CLANG=yes])
fi
])
ax_pthread_clang="$ax_cv_PTHREAD_CLANG"
if test x"$ax_pthread_ok" = xno; then
for flag in $ax_pthread_flags; do
case $flag in
# GCC generally uses -pthread, or -pthreads on some platforms (e.g. SPARC)
# Note that for GCC and Clang -pthread generally implies -lpthread,
# except when -nostdlib is passed.
# This is problematic using libtool to build C++ shared libraries with pthread:
# [1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=25460
# [2] https://bugzilla.redhat.com/show_bug.cgi?id=661333
# [3] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=468555
# To solve this, first try -pthread together with -lpthread for GCC
AS_IF([test "x$GCC" = "xyes"],
[ax_pthread_flags="-pthread,-lpthread -pthread -pthreads $ax_pthread_flags"])
# Clang takes -pthread (never supported any other flag), but we'll try with -lpthread first
AS_IF([test "x$ax_pthread_clang" = "xyes"],
[ax_pthread_flags="-pthread,-lpthread -pthread"])
# The presence of a feature test macro requesting re-entrant function
# definitions is, on some systems, a strong hint that pthreads support is
# correctly enabled
case $host_os in
darwin* | hpux* | linux* | osf* | solaris*)
ax_pthread_check_macro="_REENTRANT"
;;
aix*)
ax_pthread_check_macro="_THREAD_SAFE"
;;
*)
ax_pthread_check_macro="--"
;;
esac
AS_IF([test "x$ax_pthread_check_macro" = "x--"],
[ax_pthread_check_cond=0],
[ax_pthread_check_cond="!defined($ax_pthread_check_macro)"])
if test "x$ax_pthread_ok" = "xno"; then
for ax_pthread_try_flag in $ax_pthread_flags; do
case $ax_pthread_try_flag in
none)
AC_MSG_CHECKING([whether pthreads work without any flags])
;;
*,*)
PTHREAD_CFLAGS=`echo $ax_pthread_try_flag | sed "s/^\(.*\),\(.*\)$/\1/"`
PTHREAD_LIBS=`echo $ax_pthread_try_flag | sed "s/^\(.*\),\(.*\)$/\2/"`
AC_MSG_CHECKING([whether pthreads work with "$PTHREAD_CFLAGS" and "$PTHREAD_LIBS"])
;;
-*)
AC_MSG_CHECKING([whether pthreads work with $flag])
PTHREAD_CFLAGS="$flag"
AC_MSG_CHECKING([whether pthreads work with $ax_pthread_try_flag])
PTHREAD_CFLAGS="$ax_pthread_try_flag"
;;
pthread-config)
AC_CHECK_PROG([ax_pthread_config], [pthread-config], [yes], [no])
if test x"$ax_pthread_config" = xno; then continue; fi
AS_IF([test "x$ax_pthread_config" = "xno"], [continue])
PTHREAD_CFLAGS="`pthread-config --cflags`"
PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`"
;;
*)
AC_MSG_CHECKING([for the pthreads library -l$flag])
PTHREAD_LIBS="-l$flag"
AC_MSG_CHECKING([for the pthreads library -l$ax_pthread_try_flag])
PTHREAD_LIBS="-l$ax_pthread_try_flag"
;;
esac
save_LIBS="$LIBS"
save_CFLAGS="$CFLAGS"
ax_pthread_save_CFLAGS="$CFLAGS"
ax_pthread_save_LIBS="$LIBS"
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
LIBS="$PTHREAD_LIBS $LIBS"
CFLAGS="$CFLAGS $PTHREAD_CFLAGS $ax_pthread_extra_flags"
# Check for various functions. We must include pthread.h,
# since some functions may be macros. (On the Sequent, we
@@ -218,8 +312,18 @@ for flag in $ax_pthread_flags; do
# pthread_cleanup_push because it is one of the few pthread
# functions on Solaris that doesn't have a non-functional libc stub.
# We try pthread_create on general principles.
AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <pthread.h>
static void routine(void *a) { *((int*)a) = 0; }
# if $ax_pthread_check_cond
# error "$ax_pthread_check_macro must be defined"
# endif
static void *some_global = NULL;
static void routine(void *a)
{
/* To avoid any unused-parameter or
unused-but-set-parameter warning. */
some_global = a;
}
static void *start_routine(void *a) { return a; }],
[pthread_t th; pthread_attr_t attr;
pthread_create(&th, 0, start_routine, 0);
@@ -227,101 +331,187 @@ for flag in $ax_pthread_flags; do
pthread_attr_init(&attr);
pthread_cleanup_push(routine, 0);
pthread_cleanup_pop(0) /* ; */])],
[ax_pthread_ok=yes],
[])
[ax_pthread_ok=yes],
[])
LIBS="$save_LIBS"
CFLAGS="$save_CFLAGS"
CFLAGS="$ax_pthread_save_CFLAGS"
LIBS="$ax_pthread_save_LIBS"
AC_MSG_RESULT([$ax_pthread_ok])
if test "x$ax_pthread_ok" = xyes; then
break;
fi
AS_IF([test "x$ax_pthread_ok" = "xyes"], [break])
PTHREAD_LIBS=""
PTHREAD_CFLAGS=""
done
fi
# Clang needs special handling, because older versions handle the -pthread
# option in a rather... idiosyncratic way
if test "x$ax_pthread_clang" = "xyes"; then
# Clang takes -pthread; it has never supported any other flag
# (Note 1: This will need to be revisited if a system that Clang
# supports has POSIX threads in a separate library. This tends not
# to be the way of modern systems, but it's conceivable.)
# (Note 2: On some systems, notably Darwin, -pthread is not needed
# to get POSIX threads support; the API is always present and
# active. We could reasonably leave PTHREAD_CFLAGS empty. But
# -pthread does define _REENTRANT, and while the Darwin headers
# ignore this macro, third-party headers might not.)
# However, older versions of Clang make a point of warning the user
# that, in an invocation where only linking and no compilation is
# taking place, the -pthread option has no effect ("argument unused
# during compilation"). They expect -pthread to be passed in only
# when source code is being compiled.
#
# Problem is, this is at odds with the way Automake and most other
# C build frameworks function, which is that the same flags used in
# compilation (CFLAGS) are also used in linking. Many systems
# supported by AX_PTHREAD require exactly this for POSIX threads
# support, and in fact it is often not straightforward to specify a
# flag that is used only in the compilation phase and not in
# linking. Such a scenario is extremely rare in practice.
#
# Even though use of the -pthread flag in linking would only print
# a warning, this can be a nuisance for well-run software projects
# that build with -Werror. So if the active version of Clang has
# this misfeature, we search for an option to squash it.
AC_CACHE_CHECK([whether Clang needs flag to prevent "argument unused" warning when linking with -pthread],
[ax_cv_PTHREAD_CLANG_NO_WARN_FLAG],
[ax_cv_PTHREAD_CLANG_NO_WARN_FLAG=unknown
# Create an alternate version of $ac_link that compiles and
# links in two steps (.c -> .o, .o -> exe) instead of one
# (.c -> exe), because the warning occurs only in the second
# step
ax_pthread_save_ac_link="$ac_link"
ax_pthread_sed='s/conftest\.\$ac_ext/conftest.$ac_objext/g'
ax_pthread_link_step=`AS_ECHO(["$ac_link"]) | sed "$ax_pthread_sed"`
ax_pthread_2step_ac_link="($ac_compile) && (echo ==== >&5) && ($ax_pthread_link_step)"
ax_pthread_save_CFLAGS="$CFLAGS"
for ax_pthread_try in '' -Qunused-arguments -Wno-unused-command-line-argument unknown; do
AS_IF([test "x$ax_pthread_try" = "xunknown"], [break])
CFLAGS="-Werror -Wunknown-warning-option $ax_pthread_try -pthread $ax_pthread_save_CFLAGS"
ac_link="$ax_pthread_save_ac_link"
AC_LINK_IFELSE([AC_LANG_SOURCE([[int main(void){return 0;}]])],
[ac_link="$ax_pthread_2step_ac_link"
AC_LINK_IFELSE([AC_LANG_SOURCE([[int main(void){return 0;}]])],
[break])
])
done
ac_link="$ax_pthread_save_ac_link"
CFLAGS="$ax_pthread_save_CFLAGS"
AS_IF([test "x$ax_pthread_try" = "x"], [ax_pthread_try=no])
ax_cv_PTHREAD_CLANG_NO_WARN_FLAG="$ax_pthread_try"
])
case "$ax_cv_PTHREAD_CLANG_NO_WARN_FLAG" in
no | unknown) ;;
*) PTHREAD_CFLAGS="$ax_cv_PTHREAD_CLANG_NO_WARN_FLAG $PTHREAD_CFLAGS" ;;
esac
fi # $ax_pthread_clang = yes
# Various other checks:
if test "x$ax_pthread_ok" = xyes; then
save_LIBS="$LIBS"
LIBS="$PTHREAD_LIBS $LIBS"
save_CFLAGS="$CFLAGS"
if test "x$ax_pthread_ok" = "xyes"; then
ax_pthread_save_CFLAGS="$CFLAGS"
ax_pthread_save_LIBS="$LIBS"
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
LIBS="$PTHREAD_LIBS $LIBS"
# Detect AIX lossage: JOINABLE attribute is called UNDETACHED.
AC_MSG_CHECKING([for joinable pthread attribute])
attr_name=unknown
for attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do
AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <pthread.h>],
[int attr = $attr; return attr /* ; */])],
[attr_name=$attr; break],
[])
done
AC_MSG_RESULT([$attr_name])
if test "$attr_name" != PTHREAD_CREATE_JOINABLE; then
AC_DEFINE_UNQUOTED([PTHREAD_CREATE_JOINABLE], [$attr_name],
[Define to necessary symbol if this constant
uses a non-standard name on your system.])
fi
AC_CACHE_CHECK([for joinable pthread attribute],
[ax_cv_PTHREAD_JOINABLE_ATTR],
[ax_cv_PTHREAD_JOINABLE_ATTR=unknown
for ax_pthread_attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do
AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <pthread.h>],
[int attr = $ax_pthread_attr; return attr /* ; */])],
[ax_cv_PTHREAD_JOINABLE_ATTR=$ax_pthread_attr; break],
[])
done
])
AS_IF([test "x$ax_cv_PTHREAD_JOINABLE_ATTR" != "xunknown" && \
test "x$ax_cv_PTHREAD_JOINABLE_ATTR" != "xPTHREAD_CREATE_JOINABLE" && \
test "x$ax_pthread_joinable_attr_defined" != "xyes"],
[AC_DEFINE_UNQUOTED([PTHREAD_CREATE_JOINABLE],
[$ax_cv_PTHREAD_JOINABLE_ATTR],
[Define to necessary symbol if this constant
uses a non-standard name on your system.])
ax_pthread_joinable_attr_defined=yes
])
AC_MSG_CHECKING([if more special flags are required for pthreads])
flag=no
case ${host_os} in
aix* | freebsd* | darwin*) flag="-D_THREAD_SAFE";;
osf* | hpux*) flag="-D_REENTRANT";;
solaris*)
if test "$GCC" = "yes"; then
flag="-D_REENTRANT"
else
# TODO: What about Clang on Solaris?
flag="-mt -D_REENTRANT"
fi
;;
esac
AC_MSG_RESULT([$flag])
if test "x$flag" != xno; then
PTHREAD_CFLAGS="$flag $PTHREAD_CFLAGS"
fi
AC_CACHE_CHECK([whether more special flags are required for pthreads],
[ax_cv_PTHREAD_SPECIAL_FLAGS],
[ax_cv_PTHREAD_SPECIAL_FLAGS=no
case $host_os in
solaris*)
ax_cv_PTHREAD_SPECIAL_FLAGS="-D_POSIX_PTHREAD_SEMANTICS"
;;
esac
])
AS_IF([test "x$ax_cv_PTHREAD_SPECIAL_FLAGS" != "xno" && \
test "x$ax_pthread_special_flags_added" != "xyes"],
[PTHREAD_CFLAGS="$ax_cv_PTHREAD_SPECIAL_FLAGS $PTHREAD_CFLAGS"
ax_pthread_special_flags_added=yes])
AC_CACHE_CHECK([for PTHREAD_PRIO_INHERIT],
[ax_cv_PTHREAD_PRIO_INHERIT], [
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <pthread.h>]],
[[int i = PTHREAD_PRIO_INHERIT;]])],
[ax_cv_PTHREAD_PRIO_INHERIT=yes],
[ax_cv_PTHREAD_PRIO_INHERIT=no])
[ax_cv_PTHREAD_PRIO_INHERIT],
[AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <pthread.h>]],
[[int i = PTHREAD_PRIO_INHERIT;
return i;]])],
[ax_cv_PTHREAD_PRIO_INHERIT=yes],
[ax_cv_PTHREAD_PRIO_INHERIT=no])
])
AS_IF([test "x$ax_cv_PTHREAD_PRIO_INHERIT" = "xyes"],
[AC_DEFINE([HAVE_PTHREAD_PRIO_INHERIT], [1], [Have PTHREAD_PRIO_INHERIT.])])
AS_IF([test "x$ax_cv_PTHREAD_PRIO_INHERIT" = "xyes" && \
test "x$ax_pthread_prio_inherit_defined" != "xyes"],
[AC_DEFINE([HAVE_PTHREAD_PRIO_INHERIT], [1], [Have PTHREAD_PRIO_INHERIT.])
ax_pthread_prio_inherit_defined=yes
])
LIBS="$save_LIBS"
CFLAGS="$save_CFLAGS"
CFLAGS="$ax_pthread_save_CFLAGS"
LIBS="$ax_pthread_save_LIBS"
# More AIX lossage: compile with *_r variant
if test "x$GCC" != xyes; then
if test "x$GCC" != "xyes"; then
case $host_os in
aix*)
AS_CASE(["x/$CC"],
[x*/c89|x*/c89_128|x*/c99|x*/c99_128|x*/cc|x*/cc128|x*/xlc|x*/xlc_v6|x*/xlc128|x*/xlc128_v6],
[#handle absolute path differently from PATH based program lookup
AS_CASE(["x$CC"],
[x/*],
[AS_IF([AS_EXECUTABLE_P([${CC}_r])],[PTHREAD_CC="${CC}_r"])],
[AC_CHECK_PROGS([PTHREAD_CC],[${CC}_r],[$CC])])])
[x*/c89|x*/c89_128|x*/c99|x*/c99_128|x*/cc|x*/cc128|x*/xlc|x*/xlc_v6|x*/xlc128|x*/xlc128_v6],
[#handle absolute path differently from PATH based program lookup
AS_CASE(["x$CC"],
[x/*],
[
AS_IF([AS_EXECUTABLE_P([${CC}_r])],[PTHREAD_CC="${CC}_r"])
AS_IF([test "x${CXX}" != "x"], [AS_IF([AS_EXECUTABLE_P([${CXX}_r])],[PTHREAD_CXX="${CXX}_r"])])
],
[
AC_CHECK_PROGS([PTHREAD_CC],[${CC}_r],[$CC])
AS_IF([test "x${CXX}" != "x"], [AC_CHECK_PROGS([PTHREAD_CXX],[${CXX}_r],[$CXX])])
]
)
])
;;
esac
fi
fi
test -n "$PTHREAD_CC" || PTHREAD_CC="$CC"
test -n "$PTHREAD_CXX" || PTHREAD_CXX="$CXX"
AC_SUBST([PTHREAD_LIBS])
AC_SUBST([PTHREAD_CFLAGS])
AC_SUBST([PTHREAD_CC])
AC_SUBST([PTHREAD_CXX])
# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND:
if test x"$ax_pthread_ok" = xyes; then
if test "x$ax_pthread_ok" = "xyes"; then
ifelse([$1],,[AC_DEFINE([HAVE_PTHREAD],[1],[Define if you have POSIX threads libraries and header files.])],[$1])
:
else
+115 -18
View File
@@ -50,6 +50,8 @@
#include "util/data/msgreply.h"
#include "util/data/msgencode.h"
#include "services/cache/dns.h"
#include "services/mesh.h"
#include "services/modstack.h"
#include "validator/val_neg.h"
#include "validator/val_secalgo.h"
#include "iterator/iter_utils.h"
@@ -265,15 +267,6 @@ cachedb_init(struct module_env* env, int id)
return 0;
}
cachedb_env->enabled = 1;
if(env->cfg->serve_expired && env->cfg->serve_expired_reply_ttl)
log_warn(
"cachedb: serve-expired-reply-ttl is set but not working for data "
"originating from the external cache; 0 TTL is used for those.");
if(env->cfg->serve_expired && env->cfg->serve_expired_client_timeout)
log_warn(
"cachedb: serve-expired-client-timeout is set but not working for "
"data originating from the external cache; expired data are used "
"in the reply without first trying to refresh the data.");
return 1;
}
@@ -511,9 +504,38 @@ adjust_msg_ttl(struct dns_msg* msg, time_t adjust)
}
}
/* Set the TTL of the given RRset to fixed value. */
static void
packed_rrset_ttl_set(struct packed_rrset_data* data, time_t ttl)
{
size_t i;
size_t total = data->count + data->rrsig_count;
data->ttl = ttl;
for(i=0; i<total; i++) {
data->rr_ttl[i] = ttl;
}
data->ttl_add = 0;
}
/* Set the TTL of a DNS message and its RRs by to a fixed value. */
static void
set_msg_ttl(struct dns_msg* msg, time_t ttl)
{
size_t i;
msg->rep->ttl = ttl;
msg->rep->prefetch_ttl = PREFETCH_TTL_CALC(msg->rep->ttl);
msg->rep->serve_expired_ttl = msg->rep->ttl + SERVE_EXPIRED_TTL;
for(i=0; i<msg->rep->rrset_count; i++) {
packed_rrset_ttl_set((struct packed_rrset_data*)msg->
rep->rrsets[i]->entry.data, ttl);
}
}
/** convert dns message in buffer to return_msg */
static int
parse_data(struct module_qstate* qstate, struct sldns_buffer* buf)
parse_data(struct module_qstate* qstate, struct sldns_buffer* buf,
int* msg_expired)
{
struct msg_parse* prs;
struct edns_data edns;
@@ -583,6 +605,7 @@ parse_data(struct module_qstate* qstate, struct sldns_buffer* buf)
adjust = *qstate->env->now - (time_t)timestamp;
if(qstate->return_msg->rep->ttl < adjust) {
verbose(VERB_ALGO, "cachedb msg expired");
*msg_expired = 1;
/* If serve-expired is enabled, we still use an expired message
* setting the TTL to 0. */
if(!qstate->env->cfg->serve_expired ||
@@ -605,6 +628,7 @@ parse_data(struct module_qstate* qstate, struct sldns_buffer* buf)
* 'now' should be redundant given how these values were calculated,
* but we check it just in case as does good_expiry_and_qinfo(). */
if(qstate->env->cfg->serve_expired &&
!qstate->env->cfg->serve_expired_client_timeout &&
(adjust == -1 || (time_t)expiry < *qstate->env->now)) {
qstate->need_refetch = 1;
}
@@ -617,7 +641,8 @@ parse_data(struct module_qstate* qstate, struct sldns_buffer* buf)
* return true if lookup was successful.
*/
static int
cachedb_extcache_lookup(struct module_qstate* qstate, struct cachedb_env* ie)
cachedb_extcache_lookup(struct module_qstate* qstate, struct cachedb_env* ie,
int* msg_expired)
{
char key[(CACHEDB_HASHSIZE/8)*2+1];
calc_hash(qstate, key, sizeof(key));
@@ -634,7 +659,7 @@ cachedb_extcache_lookup(struct module_qstate* qstate, struct cachedb_env* ie)
}
/* parse dns message into return_msg */
if( !parse_data(qstate, qstate->env->scratch_buffer) ) {
if( !parse_data(qstate, qstate->env->scratch_buffer, msg_expired) ) {
return 0;
}
return 1;
@@ -666,6 +691,7 @@ cachedb_extcache_store(struct module_qstate* qstate, struct cachedb_env* ie)
static int
cachedb_intcache_lookup(struct module_qstate* qstate, struct cachedb_env* cde)
{
uint8_t dpname_storage[LDNS_MAX_DOMAINLEN+1];
uint8_t* dpname=NULL;
size_t dpnamelen=0;
struct dns_msg* msg;
@@ -674,7 +700,7 @@ cachedb_intcache_lookup(struct module_qstate* qstate, struct cachedb_env* cde)
return 0;
}
if(iter_stub_fwd_no_cache(qstate, &qstate->qinfo,
&dpname, &dpnamelen))
&dpname, &dpnamelen, dpname_storage, sizeof(dpname_storage)))
return 0; /* no cache for these queries */
msg = dns_cache_lookup(qstate->env, qstate->qinfo.qname,
qstate->qinfo.qname_len, qstate->qinfo.qtype,
@@ -705,17 +731,39 @@ cachedb_intcache_lookup(struct module_qstate* qstate, struct cachedb_env* cde)
* Store query into the internal cache of unbound.
*/
static void
cachedb_intcache_store(struct module_qstate* qstate)
cachedb_intcache_store(struct module_qstate* qstate, int msg_expired)
{
uint32_t store_flags = qstate->query_flags;
int serve_expired = qstate->env->cfg->serve_expired;
if(qstate->env->cfg->serve_expired)
store_flags |= DNSCACHE_STORE_ZEROTTL;
if(!qstate->return_msg)
return;
if(serve_expired && msg_expired) {
/* Set TTLs to a value such that value + *env->now is
* going to be now-3 seconds. Making it expired
* in the cache. */
set_msg_ttl(qstate->return_msg, (time_t)-3);
}
(void)dns_cache_store(qstate->env, &qstate->qinfo,
qstate->return_msg->rep, 0, qstate->prefetch_leeway, 0,
qstate->region, store_flags, qstate->qstarttime);
if(serve_expired && msg_expired) {
if(qstate->env->cfg->serve_expired_client_timeout) {
/* No expired response from the query state, the
* query resolution needs to continue and it can
* pick up the expired result after the timer out
* of cache. */
return;
}
/* set TTLs to zero again */
adjust_msg_ttl(qstate->return_msg, -1);
/* Send serve expired responses based on the cachedb
* returned message, that was just stored in the cache.
* It can then continue to work on this query. */
mesh_respond_serve_expired(qstate->mesh_info);
}
}
/**
@@ -731,6 +779,7 @@ cachedb_handle_query(struct module_qstate* qstate,
struct cachedb_qstate* ATTR_UNUSED(iq),
struct cachedb_env* ie, int id)
{
int msg_expired = 0;
qstate->is_cachedb_answer = 0;
/* check if we are enabled, and skip if so */
if(!ie->enabled) {
@@ -765,20 +814,28 @@ cachedb_handle_query(struct module_qstate* qstate,
}
/* ask backend cache to see if we have data */
if(cachedb_extcache_lookup(qstate, ie)) {
if(cachedb_extcache_lookup(qstate, ie, &msg_expired)) {
if(verbosity >= VERB_ALGO)
log_dns_msg(ie->backend->name,
&qstate->return_msg->qinfo,
qstate->return_msg->rep);
/* store this result in internal cache */
cachedb_intcache_store(qstate);
cachedb_intcache_store(qstate, msg_expired);
/* In case we have expired data but there is a client timer for expired
* answers, pass execution to next module in order to try updating the
* data first.
* TODO: this needs revisit. The expired data stored from cachedb has
* 0 TTL which is picked up by iterator later when looking in the cache.
* Document that ext cachedb does not work properly with
* serve_stale_reply_ttl yet. */
*/
if(qstate->env->cfg->serve_expired && msg_expired) {
qstate->return_msg = NULL;
qstate->ext_state[id] = module_wait_module;
/* The expired reply is sent with
* mesh_respond_serve_expired, and so
* the need_refetch is not used. */
qstate->need_refetch = 0;
return;
}
if(qstate->need_refetch && qstate->serve_expired_data &&
qstate->serve_expired_data->timer) {
qstate->return_msg = NULL;
@@ -791,6 +848,14 @@ cachedb_handle_query(struct module_qstate* qstate,
return;
}
if(qstate->serve_expired_data &&
qstate->env->cfg->cachedb_check_when_serve_expired &&
!qstate->env->cfg->serve_expired_client_timeout) {
/* Reply with expired data if any to client, because cachedb
* also has no useful, current data */
mesh_respond_serve_expired(qstate->mesh_info);
}
/* no cache fetches */
/* pass request to next module */
qstate->ext_state[id] = module_wait_module;
@@ -923,4 +988,36 @@ cachedb_get_funcblock(void)
{
return &cachedb_block;
}
int
cachedb_is_enabled(struct module_stack* mods, struct module_env* env)
{
struct cachedb_env* ie;
int id = modstack_find(mods, "cachedb");
if(id == -1)
return 0;
ie = (struct cachedb_env*)env->modinfo[id];
if(ie && ie->enabled)
return 1;
return 0;
}
void cachedb_msg_remove(struct module_qstate* qstate)
{
char key[(CACHEDB_HASHSIZE/8)*2+1];
int id = modstack_find(qstate->env->modstack, "cachedb");
struct cachedb_env* ie = (struct cachedb_env*)qstate->env->modinfo[id];
log_query_info(VERB_ALGO, "cachedb msg remove", &qstate->qinfo);
calc_hash(qstate, key, sizeof(key));
sldns_buffer_clear(qstate->env->scratch_buffer);
sldns_buffer_write_u32(qstate->env->scratch_buffer, 0);
sldns_buffer_flip(qstate->env->scratch_buffer);
/* call backend */
(*ie->backend->store)(qstate->env, ie, key,
sldns_buffer_begin(qstate->env->scratch_buffer),
sldns_buffer_limit(qstate->env->scratch_buffer),
0);
}
#endif /* USE_CACHEDB */
+16
View File
@@ -41,6 +41,7 @@
*/
#include "util/module.h"
struct cachedb_backend;
struct module_stack;
/**
* The global variable environment contents for the cachedb
@@ -110,3 +111,18 @@ size_t cachedb_get_mem(struct module_env* env, int id);
*/
struct module_func_block* cachedb_get_funcblock(void);
/**
* See if the cachedb is enabled.
* @param mods: module stack. It finds the cachedb module environment.
* @param env: module environment.
* @return true if exists and enabled.
*/
int cachedb_is_enabled(struct module_stack* mods, struct module_env* env);
/**
* Remove a message from the global cache. Because edns subnet has a more
* specific entry, and if not removed when everything expires, the global
* entry is used, instead of a fresh lookup of the edns subnet entry.
* @param qstate: query state.
*/
void cachedb_msg_remove(struct module_qstate* qstate);
+82 -23
View File
@@ -379,8 +379,8 @@
/* Define to 1 if you have the `memmove' function. */
#undef HAVE_MEMMOVE
/* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H
/* Define to 1 if you have the <minix/config.h> header file. */
#undef HAVE_MINIX_CONFIG_H
/* Define to 1 if you have the <netdb.h> header file. */
#undef HAVE_NETDB_H
@@ -587,6 +587,9 @@
/* Define to 1 if you have the <stdint.h> header file. */
#undef HAVE_STDINT_H
/* Define to 1 if you have the <stdio.h> header file. */
#undef HAVE_STDIO_H
/* Define to 1 if you have the <stdlib.h> header file. */
#undef HAVE_STDLIB_H
@@ -689,6 +692,9 @@
/* Define to 1 if you have the <vfork.h> header file. */
#undef HAVE_VFORK_H
/* Define to 1 if you have the <wchar.h> header file. */
#undef HAVE_WCHAR_H
/* Define to 1 if you have the <windows.h> header file. */
#undef HAVE_WINDOWS_H
@@ -830,7 +836,9 @@
/* Define to 1 if libsodium supports sodium_set_misuse_handler */
#undef SODIUM_MISUSE_HANDLER
/* Define to 1 if you have the ANSI C header files. */
/* Define to 1 if all of the C90 standard headers exist (not just the ones
required in a freestanding environment). This macro is provided for
backward compatibility; new code need not use it. */
#undef STDC_HEADERS
/* use default strptime. */
@@ -926,21 +934,87 @@
#ifndef _ALL_SOURCE
# undef _ALL_SOURCE
#endif
/* Enable general extensions on macOS. */
#ifndef _DARWIN_C_SOURCE
# undef _DARWIN_C_SOURCE
#endif
/* Enable general extensions on Solaris. */
#ifndef __EXTENSIONS__
# undef __EXTENSIONS__
#endif
/* Enable GNU extensions on systems that have them. */
#ifndef _GNU_SOURCE
# undef _GNU_SOURCE
#endif
/* Enable threading extensions on Solaris. */
/* Enable X/Open compliant socket functions that do not require linking
with -lxnet on HP-UX 11.11. */
#ifndef _HPUX_ALT_XOPEN_SOCKET_API
# undef _HPUX_ALT_XOPEN_SOCKET_API
#endif
/* Identify the host operating system as Minix.
This macro does not affect the system headers' behavior.
A future release of Autoconf may stop defining this macro. */
#ifndef _MINIX
# undef _MINIX
#endif
/* Enable general extensions on NetBSD.
Enable NetBSD compatibility extensions on Minix. */
#ifndef _NETBSD_SOURCE
# undef _NETBSD_SOURCE
#endif
/* Enable OpenBSD compatibility extensions on NetBSD.
Oddly enough, this does nothing on OpenBSD. */
#ifndef _OPENBSD_SOURCE
# undef _OPENBSD_SOURCE
#endif
/* Define to 1 if needed for POSIX-compatible behavior. */
#ifndef _POSIX_SOURCE
# undef _POSIX_SOURCE
#endif
/* Define to 2 if needed for POSIX-compatible behavior. */
#ifndef _POSIX_1_SOURCE
# undef _POSIX_1_SOURCE
#endif
/* Enable POSIX-compatible threading on Solaris. */
#ifndef _POSIX_PTHREAD_SEMANTICS
# undef _POSIX_PTHREAD_SEMANTICS
#endif
/* Enable extensions specified by ISO/IEC TS 18661-5:2014. */
#ifndef __STDC_WANT_IEC_60559_ATTRIBS_EXT__
# undef __STDC_WANT_IEC_60559_ATTRIBS_EXT__
#endif
/* Enable extensions specified by ISO/IEC TS 18661-1:2014. */
#ifndef __STDC_WANT_IEC_60559_BFP_EXT__
# undef __STDC_WANT_IEC_60559_BFP_EXT__
#endif
/* Enable extensions specified by ISO/IEC TS 18661-2:2015. */
#ifndef __STDC_WANT_IEC_60559_DFP_EXT__
# undef __STDC_WANT_IEC_60559_DFP_EXT__
#endif
/* Enable extensions specified by ISO/IEC TS 18661-4:2015. */
#ifndef __STDC_WANT_IEC_60559_FUNCS_EXT__
# undef __STDC_WANT_IEC_60559_FUNCS_EXT__
#endif
/* Enable extensions specified by ISO/IEC TS 18661-3:2015. */
#ifndef __STDC_WANT_IEC_60559_TYPES_EXT__
# undef __STDC_WANT_IEC_60559_TYPES_EXT__
#endif
/* Enable extensions specified by ISO/IEC TR 24731-2:2010. */
#ifndef __STDC_WANT_LIB_EXT2__
# undef __STDC_WANT_LIB_EXT2__
#endif
/* Enable extensions specified by ISO/IEC 24747:2009. */
#ifndef __STDC_WANT_MATH_SPEC_FUNCS__
# undef __STDC_WANT_MATH_SPEC_FUNCS__
#endif
/* Enable extensions on HP NonStop. */
#ifndef _TANDEM_SOURCE
# undef _TANDEM_SOURCE
#endif
/* Enable general extensions on Solaris. */
#ifndef __EXTENSIONS__
# undef __EXTENSIONS__
/* Enable X/Open extensions. Define to 500 only if necessary
to make mbstate_t available. */
#ifndef _XOPEN_SOURCE
# undef _XOPEN_SOURCE
#endif
@@ -966,11 +1040,6 @@
`char[]'. */
#undef YYTEXT_POINTER
/* Enable large inode numbers on Mac OS X 10.5. */
#ifndef _DARWIN_USE_64_BIT_INODE
# define _DARWIN_USE_64_BIT_INODE 1
#endif
/* Number of bits in a file offset, on hosts where this is settable. */
#undef _FILE_OFFSET_BITS
@@ -980,19 +1049,9 @@
/* Define for large files, on AIX-style hosts. */
#undef _LARGE_FILES
/* Define to 1 if on MINIX. */
#undef _MINIX
/* Enable for compile on Minix */
#undef _NETBSD_SOURCE
/* Define to 2 if the system does not provide POSIX.1 features except with
this defined. */
#undef _POSIX_1_SOURCE
/* Define to 1 if you need to in order for `stat' and other things to work. */
#undef _POSIX_SOURCE
/* defined to use gcc ansi snprintf and sscanf that understands %lld when
compiled for windows. */
#undef __USE_MINGW_ANSI_STDIO
@@ -1033,7 +1092,7 @@
/* Define to `long int' if <sys/types.h> does not define. */
#undef off_t
/* Define to `int' if <sys/types.h> does not define. */
/* Define as a signed integer type capable of holding a process identifier. */
#undef pid_t
/* Define to 'int' if not defined */
+7476 -5132
View File
File diff suppressed because it is too large. Load diff
+10 -6
View File
@@ -4,21 +4,21 @@ AC_PREREQ([2.56])
sinclude(acx_nlnetlabs.m4)
sinclude(ax_pthread.m4)
sinclude(acx_python.m4)
sinclude(ac_pkg_swig.m4)
sinclude(ax_pkg_swig.m4)
sinclude(dnstap/dnstap.m4)
sinclude(dnscrypt/dnscrypt.m4)
# must be numbers. ac_defun because of later processing
m4_define([VERSION_MAJOR],[1])
m4_define([VERSION_MINOR],[19])
m4_define([VERSION_MICRO],[3])
m4_define([VERSION_MINOR],[20])
m4_define([VERSION_MICRO],[0])
AC_INIT([unbound],m4_defn([VERSION_MAJOR]).m4_defn([VERSION_MINOR]).m4_defn([VERSION_MICRO]),[[email protected] or https://github.com/NLnetLabs/unbound/issues],[unbound])
AC_SUBST(UNBOUND_VERSION_MAJOR, [VERSION_MAJOR])
AC_SUBST(UNBOUND_VERSION_MINOR, [VERSION_MINOR])
AC_SUBST(UNBOUND_VERSION_MICRO, [VERSION_MICRO])
LIBUNBOUND_CURRENT=9
LIBUNBOUND_REVISION=26
LIBUNBOUND_REVISION=27
LIBUNBOUND_AGE=1
# 1.0.0 had 0:12:0
# 1.0.1 had 0:13:0
@@ -112,6 +112,7 @@ LIBUNBOUND_AGE=1
# 1.19.1 had 9:24:1
# 1.19.2 had 9:25:1
# 1.19.3 had 9:26:1
# 1.20.0 had 9:27:1
# Current -- the number of the binary API that we're implementing
# Revision -- which iteration of the implementation of the binary
@@ -273,6 +274,9 @@ AC_DEFINE(WINVER, 0x0502, [the version of the windows API enabled])
ACX_RSRC_VERSION(wnvs)
AC_DEFINE_UNQUOTED(RSRC_PACKAGE_VERSION, [$wnvs], [version number for resource files])
# Check for 'grep -e' program, here, since ACX_CHECK_FLTO needs that.
AC_PROG_GREP
# Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_LANG([C])
@@ -795,9 +799,9 @@ if test x_$ub_test_python != x_no; then
ub_have_swig=no
AC_ARG_ENABLE(swig-version-check, AS_HELP_STRING([--disable-swig-version-check],[Disable swig version check to build python modules with older swig even though that is unreliable]))
if test "$enable_swig_version_check" = "yes"; then
AC_PROG_SWIG(2.0.1)
AX_PKG_SWIG(2.0.1)
else
AC_PROG_SWIG
AX_PKG_SWIG
fi
AC_MSG_CHECKING(SWIG)
if test ! -x "$SWIG"; then
+26616
View File
File diff suppressed because it is too large. Load diff
+9
View File
@@ -22,4 +22,13 @@ pidfile=${unbound_pidfile:-"/usr/local/etc/unbound/unbound.pid"}
command_args=${unbound_flags:-"-c /usr/local/etc/unbound/unbound.conf"}
extra_commands="reload"
if test "$1" = "stop" ; then
run_rc_command "$1"
ret=$?
if test $ret -eq 0; then
rm -f "$pidfile"
fi
exit $ret
fi
run_rc_command "$1"
+1
View File
@@ -75,6 +75,7 @@ stop() {
retval=$?
echo
[ $retval -eq 0 ] && rm -f $lockfile
[ $retval -eq 0 ] && rm -f $pidfile
if egrep -q '^/[^[:space:]]+[[:space:]]+'${rootdir}'/dev/log' /proc/mounts; then
umount ${rootdir}/dev/log >/dev/null 2>&1
fi;
@@ -58,6 +58,7 @@ stop() {
killproc -p $pidfile unbound
retval=$?
[ $retval -eq 0 ] && rm -f $lockfile
[ $retval -eq 0 ] && rm -f $pidfile
for mountfile in /dev/log /dev/urandom /etc/localtime /etc/resolv.conf /var/run/unbound
do
if egrep -q '^/[^[:space:]]+[[:space:]]+'${rootdir}''${mountfile}'' /proc/mounts; then
@@ -75,6 +75,7 @@ stop() {
retval=$?
echo
[ $retval -eq 0 ] && rm -f $lockfile
[ $retval -eq 0 ] && rm -f $pidfile
if egrep -q '^/[^[:space:]]+[[:space:]]+'${rootdir}'/dev/log' /proc/mounts; then
umount ${rootdir}/dev/log >/dev/null 2>&1
fi;
+16 -7
View File
@@ -839,6 +839,7 @@ int print_deleg_lookup(RES* ssl, struct worker* worker, uint8_t* nm,
char b[260];
struct query_info qinfo;
struct iter_hints_stub* stub;
int nolock = 0;
regional_free_all(region);
qinfo.qname = nm;
qinfo.qname_len = nmlen;
@@ -850,13 +851,16 @@ int print_deleg_lookup(RES* ssl, struct worker* worker, uint8_t* nm,
if(!ssl_printf(ssl, "The following name servers are used for lookup "
"of %s\n", b))
return 0;
dp = forwards_lookup(worker->env.fwds, nm, qinfo.qclass);
dp = forwards_lookup(worker->env.fwds, nm, qinfo.qclass, nolock);
if(dp) {
if(!ssl_printf(ssl, "forwarding request:\n"))
if(!ssl_printf(ssl, "forwarding request:\n")) {
lock_rw_unlock(&worker->env.fwds->lock);
return 0;
}
print_dp_main(ssl, dp, NULL);
print_dp_details(ssl, worker, dp);
lock_rw_unlock(&worker->env.fwds->lock);
return 1;
}
@@ -892,21 +896,26 @@ int print_deleg_lookup(RES* ssl, struct worker* worker, uint8_t* nm,
return 0;
continue;
}
}
}
stub = hints_lookup_stub(worker->env.hints, nm, qinfo.qclass,
dp);
dp, nolock);
if(stub) {
if(stub->noprime) {
if(!ssl_printf(ssl, "The noprime stub servers "
"are used:\n"))
"are used:\n")) {
lock_rw_unlock(&worker->env.hints->lock);
return 0;
}
} else {
if(!ssl_printf(ssl, "The stub is primed "
"with servers:\n"))
"with servers:\n")) {
lock_rw_unlock(&worker->env.hints->lock);
return 0;
}
}
print_dp_main(ssl, stub->dp, NULL);
print_dp_details(ssl, worker, stub->dp);
lock_rw_unlock(&worker->env.hints->lock);
} else {
print_dp_main(ssl, dp, msg);
print_dp_details(ssl, worker, dp);
+22 -4
View File
@@ -91,6 +91,8 @@
#include "util/net_help.h"
#include "sldns/keyraw.h"
#include "respip/respip.h"
#include "iterator/iter_fwd.h"
#include "iterator/iter_hints.h"
#include <signal.h>
#ifdef HAVE_SYSTEMD
@@ -99,6 +101,9 @@
#ifdef HAVE_NETDB_H
#include <netdb.h>
#endif
#ifdef USE_CACHEDB
#include "cachedb/cachedb.h"
#endif
/** How many quit requests happened. */
static int sig_record_quit = 0;
@@ -260,6 +265,7 @@ daemon_init(void)
free(daemon);
return NULL;
}
daemon->env->modstack = &daemon->mods;
/* init edns_known_options */
if(!edns_known_options_init(daemon->env)) {
free(daemon->env);
@@ -321,17 +327,15 @@ static int setup_acl_for_ports(struct acl_list* list,
struct listen_port* port_list)
{
struct acl_addr* acl_node;
struct addrinfo* addr;
for(; port_list; port_list=port_list->next) {
if(!port_list->socket) {
/* This is mainly for testbound where port_list is
* empty. */
continue;
}
addr = port_list->socket->addr;
if(!(acl_node = acl_interface_insert(list,
(struct sockaddr_storage*)addr->ai_addr,
(socklen_t)addr->ai_addrlen,
(struct sockaddr_storage*)port_list->socket->addr,
port_list->socket->addrlen,
acl_refuse))) {
return 0;
}
@@ -716,6 +720,12 @@ daemon_fork(struct daemon* daemon)
fatal_exit("Could not create local zones: out of memory");
if(!local_zones_apply_cfg(daemon->local_zones, daemon->cfg))
fatal_exit("Could not set up local zones");
if(!(daemon->env->fwds = forwards_create()) ||
!forwards_apply_cfg(daemon->env->fwds, daemon->cfg))
fatal_exit("Could not set forward zones");
if(!(daemon->env->hints = hints_create()) ||
!hints_apply_cfg(daemon->env->hints, daemon->cfg))
fatal_exit("Could not set root or stub hints");
/* process raw response-ip configuration data */
if(!(daemon->respip_set = respip_set_create()))
@@ -740,6 +750,10 @@ daemon_fork(struct daemon* daemon)
if(!edns_strings_apply_cfg(daemon->env->edns_strings, daemon->cfg))
fatal_exit("Could not set up EDNS strings");
#ifdef USE_CACHEDB
daemon->env->cachedb_enabled = cachedb_is_enabled(&daemon->mods,
daemon->env);
#endif
/* response-ip-xxx options don't work as expected without the respip
* module. To avoid run-time operational surprise we reject such
* configuration. */
@@ -832,6 +846,10 @@ daemon_cleanup(struct daemon* daemon)
slabhash_clear(daemon->env->msg_cache);
}
daemon->old_num = daemon->num; /* save the current num */
forwards_delete(daemon->env->fwds);
daemon->env->fwds = NULL;
hints_delete(daemon->env->hints);
daemon->env->hints = NULL;
local_zones_delete(daemon->local_zones);
daemon->local_zones = NULL;
respip_set_delete(daemon->respip_set);
+82 -46
View File
@@ -1992,12 +1992,19 @@ static int
print_root_fwds(RES* ssl, struct iter_forwards* fwds, uint8_t* root)
{
struct delegpt* dp;
dp = forwards_lookup(fwds, root, LDNS_RR_CLASS_IN);
if(!dp)
int nolock = 0;
dp = forwards_lookup(fwds, root, LDNS_RR_CLASS_IN, nolock);
if(!dp) {
return ssl_printf(ssl, "off (using root hints)\n");
}
/* if dp is returned it must be the root */
log_assert(query_dname_compare(dp->name, root)==0);
return ssl_print_name_dp(ssl, NULL, root, LDNS_RR_CLASS_IN, dp);
if(!ssl_print_name_dp(ssl, NULL, root, LDNS_RR_CLASS_IN, dp)) {
lock_rw_unlock(&fwds->lock);
return 0;
}
lock_rw_unlock(&fwds->lock);
return 1;
}
/** parse args into delegpt */
@@ -2069,6 +2076,7 @@ do_forward(RES* ssl, struct worker* worker, char* args)
{
struct iter_forwards* fwd = worker->env.fwds;
uint8_t* root = (uint8_t*)"\000";
int nolock = 0;
if(!fwd) {
(void)ssl_printf(ssl, "error: structure not allocated\n");
return;
@@ -2082,12 +2090,12 @@ do_forward(RES* ssl, struct worker* worker, char* args)
/* delete all the existing queries first */
mesh_delete_all(worker->env.mesh);
if(strcmp(args, "off") == 0) {
forwards_delete_zone(fwd, LDNS_RR_CLASS_IN, root);
forwards_delete_zone(fwd, LDNS_RR_CLASS_IN, root, nolock);
} else {
struct delegpt* dp;
if(!(dp = parse_delegpt(ssl, args, root)))
return;
if(!forwards_add_zone(fwd, LDNS_RR_CLASS_IN, dp)) {
if(!forwards_add_zone(fwd, LDNS_RR_CLASS_IN, dp, nolock)) {
(void)ssl_printf(ssl, "error out of memory\n");
return;
}
@@ -2097,7 +2105,7 @@ do_forward(RES* ssl, struct worker* worker, char* args)
static int
parse_fs_args(RES* ssl, char* args, uint8_t** nm, struct delegpt** dp,
int* insecure, int* prime)
int* insecure, int* prime, int* tls)
{
char* zonename;
char* rest;
@@ -2112,6 +2120,8 @@ parse_fs_args(RES* ssl, char* args, uint8_t** nm, struct delegpt** dp,
*insecure = 1;
else if(*args == 'p' && prime)
*prime = 1;
else if(*args == 't' && tls)
*tls = 1;
else {
(void)ssl_printf(ssl, "error: unknown option %s\n", args);
return 0;
@@ -2144,25 +2154,33 @@ static void
do_forward_add(RES* ssl, struct worker* worker, char* args)
{
struct iter_forwards* fwd = worker->env.fwds;
int insecure = 0;
int insecure = 0, tls = 0;
uint8_t* nm = NULL;
struct delegpt* dp = NULL;
if(!parse_fs_args(ssl, args, &nm, &dp, &insecure, NULL))
int nolock = 1;
if(!parse_fs_args(ssl, args, &nm, &dp, &insecure, NULL, &tls))
return;
if(tls)
dp->ssl_upstream = 1;
/* prelock forwarders for atomic operation with anchors */
lock_rw_wrlock(&fwd->lock);
if(insecure && worker->env.anchors) {
if(!anchors_add_insecure(worker->env.anchors, LDNS_RR_CLASS_IN,
nm)) {
lock_rw_unlock(&fwd->lock);
(void)ssl_printf(ssl, "error out of memory\n");
delegpt_free_mlc(dp);
free(nm);
return;
}
}
if(!forwards_add_zone(fwd, LDNS_RR_CLASS_IN, dp)) {
if(!forwards_add_zone(fwd, LDNS_RR_CLASS_IN, dp, nolock)) {
lock_rw_unlock(&fwd->lock);
(void)ssl_printf(ssl, "error out of memory\n");
free(nm);
return;
}
lock_rw_unlock(&fwd->lock);
free(nm);
send_ok(ssl);
}
@@ -2174,12 +2192,16 @@ do_forward_remove(RES* ssl, struct worker* worker, char* args)
struct iter_forwards* fwd = worker->env.fwds;
int insecure = 0;
uint8_t* nm = NULL;
if(!parse_fs_args(ssl, args, &nm, NULL, &insecure, NULL))
int nolock = 1;
if(!parse_fs_args(ssl, args, &nm, NULL, &insecure, NULL, NULL))
return;
/* prelock forwarders for atomic operation with anchors */
lock_rw_wrlock(&fwd->lock);
if(insecure && worker->env.anchors)
anchors_delete_insecure(worker->env.anchors, LDNS_RR_CLASS_IN,
nm);
forwards_delete_zone(fwd, LDNS_RR_CLASS_IN, nm);
forwards_delete_zone(fwd, LDNS_RR_CLASS_IN, nm, nolock);
lock_rw_unlock(&fwd->lock);
free(nm);
send_ok(ssl);
}
@@ -2189,38 +2211,53 @@ static void
do_stub_add(RES* ssl, struct worker* worker, char* args)
{
struct iter_forwards* fwd = worker->env.fwds;
int insecure = 0, prime = 0;
int insecure = 0, prime = 0, tls = 0;
uint8_t* nm = NULL;
struct delegpt* dp = NULL;
if(!parse_fs_args(ssl, args, &nm, &dp, &insecure, &prime))
int nolock = 1;
if(!parse_fs_args(ssl, args, &nm, &dp, &insecure, &prime, &tls))
return;
if(tls)
dp->ssl_upstream = 1;
/* prelock forwarders and hints for atomic operation with anchors */
lock_rw_wrlock(&fwd->lock);
lock_rw_wrlock(&worker->env.hints->lock);
if(insecure && worker->env.anchors) {
if(!anchors_add_insecure(worker->env.anchors, LDNS_RR_CLASS_IN,
nm)) {
lock_rw_unlock(&fwd->lock);
lock_rw_unlock(&worker->env.hints->lock);
(void)ssl_printf(ssl, "error out of memory\n");
delegpt_free_mlc(dp);
free(nm);
return;
}
}
if(!forwards_add_stub_hole(fwd, LDNS_RR_CLASS_IN, nm)) {
if(!forwards_add_stub_hole(fwd, LDNS_RR_CLASS_IN, nm, nolock)) {
if(insecure && worker->env.anchors)
anchors_delete_insecure(worker->env.anchors,
LDNS_RR_CLASS_IN, nm);
lock_rw_unlock(&fwd->lock);
lock_rw_unlock(&worker->env.hints->lock);
(void)ssl_printf(ssl, "error out of memory\n");
delegpt_free_mlc(dp);
free(nm);
return;
}
if(!hints_add_stub(worker->env.hints, LDNS_RR_CLASS_IN, dp, !prime)) {
if(!hints_add_stub(worker->env.hints, LDNS_RR_CLASS_IN, dp, !prime,
nolock)) {
(void)ssl_printf(ssl, "error out of memory\n");
forwards_delete_stub_hole(fwd, LDNS_RR_CLASS_IN, nm);
forwards_delete_stub_hole(fwd, LDNS_RR_CLASS_IN, nm, nolock);
if(insecure && worker->env.anchors)
anchors_delete_insecure(worker->env.anchors,
LDNS_RR_CLASS_IN, nm);
lock_rw_unlock(&fwd->lock);
lock_rw_unlock(&worker->env.hints->lock);
free(nm);
return;
}
lock_rw_unlock(&fwd->lock);
lock_rw_unlock(&worker->env.hints->lock);
free(nm);
send_ok(ssl);
}
@@ -2232,13 +2269,19 @@ do_stub_remove(RES* ssl, struct worker* worker, char* args)
struct iter_forwards* fwd = worker->env.fwds;
int insecure = 0;
uint8_t* nm = NULL;
if(!parse_fs_args(ssl, args, &nm, NULL, &insecure, NULL))
int nolock = 1;
if(!parse_fs_args(ssl, args, &nm, NULL, &insecure, NULL, NULL))
return;
/* prelock forwarders and hints for atomic operation with anchors */
lock_rw_wrlock(&fwd->lock);
lock_rw_wrlock(&worker->env.hints->lock);
if(insecure && worker->env.anchors)
anchors_delete_insecure(worker->env.anchors, LDNS_RR_CLASS_IN,
nm);
forwards_delete_stub_hole(fwd, LDNS_RR_CLASS_IN, nm);
hints_delete_stub(worker->env.hints, LDNS_RR_CLASS_IN, nm);
forwards_delete_stub_hole(fwd, LDNS_RR_CLASS_IN, nm, nolock);
hints_delete_stub(worker->env.hints, LDNS_RR_CLASS_IN, nm, nolock);
lock_rw_unlock(&fwd->lock);
lock_rw_unlock(&worker->env.hints->lock);
free(nm);
send_ok(ssl);
}
@@ -2667,6 +2710,7 @@ do_list_forwards(RES* ssl, struct worker* worker)
struct iter_forward_zone* z;
struct trust_anchor* a;
int insecure;
lock_rw_rdlock(&fwds->lock);
RBTREE_FOR(z, struct iter_forward_zone*, fwds->tree) {
if(!z->dp) continue; /* skip empty marker for stub */
@@ -2681,9 +2725,12 @@ do_list_forwards(RES* ssl, struct worker* worker)
}
if(!ssl_print_name_dp(ssl, (insecure?"forward +i":"forward"),
z->name, z->dclass, z->dp))
z->name, z->dclass, z->dp)) {
lock_rw_unlock(&fwds->lock);
return;
}
}
lock_rw_unlock(&fwds->lock);
}
/** do the list_stubs command */
@@ -2694,6 +2741,7 @@ do_list_stubs(RES* ssl, struct worker* worker)
struct trust_anchor* a;
int insecure;
char str[32];
lock_rw_rdlock(&worker->env.hints->lock);
RBTREE_FOR(z, struct iter_hints_stub*, &worker->env.hints->tree) {
/* see if it is insecure */
@@ -2709,9 +2757,12 @@ do_list_stubs(RES* ssl, struct worker* worker)
snprintf(str, sizeof(str), "stub %sprime%s",
(z->noprime?"no":""), (insecure?" +i":""));
if(!ssl_print_name_dp(ssl, str, z->node.name,
z->node.dclass, z->dp))
z->node.dclass, z->dp)) {
lock_rw_unlock(&worker->env.hints->lock);
return;
}
}
lock_rw_unlock(&worker->env.hints->lock);
}
/** do the list_auth_zones command */
@@ -3071,26 +3122,6 @@ execute_cmd(struct daemon_remote* rc, RES* ssl, char* cmd,
} else if(cmdcmp(p, "auth_zone_transfer", 18)) {
do_auth_zone_transfer(ssl, worker, skipwhite(p+18));
return;
} else if(cmdcmp(p, "stub_add", 8)) {
/* must always distribute this cmd */
if(rc) distribute_cmd(rc, ssl, cmd);
do_stub_add(ssl, worker, skipwhite(p+8));
return;
} else if(cmdcmp(p, "stub_remove", 11)) {
/* must always distribute this cmd */
if(rc) distribute_cmd(rc, ssl, cmd);
do_stub_remove(ssl, worker, skipwhite(p+11));
return;
} else if(cmdcmp(p, "forward_add", 11)) {
/* must always distribute this cmd */
if(rc) distribute_cmd(rc, ssl, cmd);
do_forward_add(ssl, worker, skipwhite(p+11));
return;
} else if(cmdcmp(p, "forward_remove", 14)) {
/* must always distribute this cmd */
if(rc) distribute_cmd(rc, ssl, cmd);
do_forward_remove(ssl, worker, skipwhite(p+14));
return;
} else if(cmdcmp(p, "insecure_add", 12)) {
/* must always distribute this cmd */
if(rc) distribute_cmd(rc, ssl, cmd);
@@ -3101,11 +3132,6 @@ execute_cmd(struct daemon_remote* rc, RES* ssl, char* cmd,
if(rc) distribute_cmd(rc, ssl, cmd);
do_insecure_remove(ssl, worker, skipwhite(p+15));
return;
} else if(cmdcmp(p, "forward", 7)) {
/* must always distribute this cmd */
if(rc) distribute_cmd(rc, ssl, cmd);
do_forward(ssl, worker, skipwhite(p+7));
return;
} else if(cmdcmp(p, "flush_stats", 11)) {
/* must always distribute this cmd */
if(rc) distribute_cmd(rc, ssl, cmd);
@@ -3147,6 +3173,16 @@ execute_cmd(struct daemon_remote* rc, RES* ssl, char* cmd,
do_data_add(ssl, worker->daemon->local_zones, skipwhite(p+10));
} else if(cmdcmp(p, "local_datas", 11)) {
do_datas_add(ssl, worker->daemon->local_zones);
} else if(cmdcmp(p, "forward_add", 11)) {
do_forward_add(ssl, worker, skipwhite(p+11));
} else if(cmdcmp(p, "forward_remove", 14)) {
do_forward_remove(ssl, worker, skipwhite(p+14));
} else if(cmdcmp(p, "forward", 7)) {
do_forward(ssl, worker, skipwhite(p+7));
} else if(cmdcmp(p, "stub_add", 8)) {
do_stub_add(ssl, worker, skipwhite(p+8));
} else if(cmdcmp(p, "stub_remove", 11)) {
do_stub_remove(ssl, worker, skipwhite(p+11));
} else if(cmdcmp(p, "view_local_zone_remove", 22)) {
do_view_zone_remove(ssl, worker, skipwhite(p+22));
} else if(cmdcmp(p, "view_local_zone", 15)) {
+19 -20
View File
@@ -366,9 +366,8 @@ readpid (const char* file)
/** write pid to file.
* @param pidfile: file name of pid file.
* @param pid: pid to write to file.
* @return false on failure
*/
static int
static void
writepid (const char* pidfile, pid_t pid)
{
int fd;
@@ -383,7 +382,7 @@ writepid (const char* pidfile, pid_t pid)
, 0644)) == -1) {
log_err("cannot open pidfile %s: %s",
pidfile, strerror(errno));
return 0;
return;
}
while(count < strlen(pidbuf)) {
ssize_t r = write(fd, pidbuf+count, strlen(pidbuf)-count);
@@ -393,17 +392,16 @@ writepid (const char* pidfile, pid_t pid)
log_err("cannot write to pidfile %s: %s",
pidfile, strerror(errno));
close(fd);
return 0;
return;
} else if(r == 0) {
log_err("cannot write any bytes to pidfile %s: "
"write returns 0 bytes written", pidfile);
close(fd);
return 0;
return;
}
count += r;
}
close(fd);
return 1;
}
/**
@@ -545,7 +543,15 @@ perform_setup(struct daemon* daemon, struct config_file* cfg, int debug_mode,
cfg, 1);
if(!daemon->pidfile)
fatal_exit("pidfile alloc: out of memory");
checkoldpid(daemon->pidfile, pidinchroot);
/* Check old pid if there is no username configured.
* With a username, the assumption is that the privilege
* drop makes a pidfile not removed when the server stopped
* last time. The server does not chown the pidfile for it,
* because that creates privilege escape problems, with the
* pidfile writable by unprivileged users, but used by
* privileged users. */
if(cfg->username && cfg->username[0])
checkoldpid(daemon->pidfile, pidinchroot);
}
#endif
@@ -557,18 +563,7 @@ perform_setup(struct daemon* daemon, struct config_file* cfg, int debug_mode,
/* write new pidfile (while still root, so can be outside chroot) */
#ifdef HAVE_KILL
if(cfg->pidfile && cfg->pidfile[0] && need_pidfile) {
if(writepid(daemon->pidfile, getpid())) {
if(cfg->username && cfg->username[0] && cfg_uid != (uid_t)-1 &&
pidinchroot) {
# ifdef HAVE_CHOWN
if(chown(daemon->pidfile, cfg_uid, cfg_gid) == -1) {
verbose(VERB_QUERY, "cannot chown %u.%u %s: %s",
(unsigned)cfg_uid, (unsigned)cfg_gid,
daemon->pidfile, strerror(errno));
}
# endif /* HAVE_CHOWN */
}
}
writepid(daemon->pidfile, getpid());
}
#else
(void)daemon;
@@ -746,7 +741,11 @@ run_daemon(const char* cfgfile, int cmdline_verbose, int debug_mode, int need_pi
if(daemon->pidfile) {
int fd;
/* truncate pidfile */
fd = open(daemon->pidfile, O_WRONLY | O_TRUNC, 0644);
fd = open(daemon->pidfile, O_WRONLY | O_TRUNC
#ifdef O_NOFOLLOW
| O_NOFOLLOW
#endif
, 0644);
if(fd != -1)
close(fd);
/* delete pidfile */
+13 -22
View File
@@ -659,7 +659,12 @@ answer_from_cache(struct worker* worker, struct query_info* qinfo,
if(rep->ttl < timenow) {
/* Check if we need to serve expired now */
if(worker->env.cfg->serve_expired &&
!worker->env.cfg->serve_expired_client_timeout) {
!worker->env.cfg->serve_expired_client_timeout
#ifdef USE_CACHEDB
&& !(worker->env.cachedb_enabled &&
worker->env.cfg->cachedb_check_when_serve_expired)
#endif
) {
if(worker->env.cfg->serve_expired_ttl &&
rep->serve_expired_ttl < timenow)
return 0;
@@ -1454,8 +1459,8 @@ worker_handle_request(struct comm_point* c, void* arg, int error,
*/
if(worker->dtenv.log_client_query_messages) {
log_addr(VERB_ALGO, "request from client", &repinfo->client_addr, repinfo->client_addrlen);
log_addr(VERB_ALGO, "to local addr", (void*)repinfo->c->socket->addr->ai_addr, repinfo->c->socket->addr->ai_addrlen);
dt_msg_send_client_query(&worker->dtenv, &repinfo->client_addr, (void*)repinfo->c->socket->addr->ai_addr, c->type, c->ssl, c->buffer,
log_addr(VERB_ALGO, "to local addr", (void*)repinfo->c->socket->addr, repinfo->c->socket->addrlen);
dt_msg_send_client_query(&worker->dtenv, &repinfo->client_addr, (void*)repinfo->c->socket->addr, c->type, c->ssl, c->buffer,
((worker->env.cfg->sock_queue_timeout && timeval_isset(&c->recv_tv))?&c->recv_tv:NULL));
}
#endif
@@ -1943,10 +1948,10 @@ send_reply_rc:
/*
* sending src (client)/dst (local service) addresses over DNSTAP from send_reply code label (when we serviced local zone for ex.)
*/
if(worker->dtenv.log_client_response_messages) {
log_addr(VERB_ALGO, "from local addr", (void*)repinfo->c->socket->addr->ai_addr, repinfo->c->socket->addr->ai_addrlen);
if(worker->dtenv.log_client_response_messages && rc !=0) {
log_addr(VERB_ALGO, "from local addr", (void*)repinfo->c->socket->addr, repinfo->c->socket->addrlen);
log_addr(VERB_ALGO, "response to client", &repinfo->client_addr, repinfo->client_addrlen);
dt_msg_send_client_response(&worker->dtenv, &repinfo->client_addr, (void*)repinfo->c->socket->addr->ai_addr, c->type, c->ssl, c->buffer);
dt_msg_send_client_response(&worker->dtenv, &repinfo->client_addr, (void*)repinfo->c->socket->addr, c->type, c->ssl, c->buffer);
}
#endif
if(worker->env.cfg->log_replies)
@@ -1961,13 +1966,13 @@ send_reply_rc:
log_reply_info(NO_VERBOSE, &qinfo,
&repinfo->client_addr, repinfo->client_addrlen,
tv, 1, c->buffer,
(worker->env.cfg->log_destaddr?(void*)repinfo->c->socket->addr->ai_addr:NULL),
(worker->env.cfg->log_destaddr?(void*)repinfo->c->socket->addr:NULL),
c->type);
} else {
log_reply_info(NO_VERBOSE, &qinfo,
&repinfo->client_addr, repinfo->client_addrlen,
tv, 1, c->buffer,
(worker->env.cfg->log_destaddr?(void*)repinfo->c->socket->addr->ai_addr:NULL),
(worker->env.cfg->log_destaddr?(void*)repinfo->c->socket->addr:NULL),
c->type);
}
}
@@ -2261,18 +2266,6 @@ worker_init(struct worker* worker, struct config_file *cfg,
worker_delete(worker);
return 0;
}
if(!(worker->env.fwds = forwards_create()) ||
!forwards_apply_cfg(worker->env.fwds, cfg)) {
log_err("Could not set forward zones");
worker_delete(worker);
return 0;
}
if(!(worker->env.hints = hints_create()) ||
!hints_apply_cfg(worker->env.hints, cfg)) {
log_err("Could not set root or stub hints");
worker_delete(worker);
return 0;
}
/* one probe timer per process -- if we have 5011 anchors */
if(autr_get_num_anchors(worker->env.anchors) > 0
#ifndef THREADS_DISABLED
@@ -2345,8 +2338,6 @@ worker_delete(struct worker* worker)
outside_network_quit_prepare(worker->back);
mesh_delete(worker->env.mesh);
sldns_buffer_free(worker->env.scratch_buffer);
forwards_delete(worker->env.fwds);
hints_delete(worker->env.hints);
listen_delete(worker->front);
outside_network_delete(worker->back);
comm_signal_delete(worker->comsig);
+183 -4
View File
@@ -1,15 +1,194 @@
1 May 2024: Wouter
- Fix for the DNSBomb vulnerability CVE-2024-33655. Thanks to Xiang Li
from the Network and Information Security Lab of Tsinghua University
for reporting it.
- Set version number to 1.20.0 for release.
29 April 2024: Yorgos
- Cleanup unnecessary strdup calls for EDE strings.
29 April 2024: Wouter
- Fix doxygen comment for errinf_to_str_bogus.
26 April 2024: Wouter
- Fix cachedb with serve-expired-client-timeout disabled. The edns
subnet module deletes global cache and cachedb cache when it
stores a result, and serve-expired is enabled, so that the global
reply, that is older than the ecs reply, does not return after
the ecs reply expires.
- Add unit tests for cachedb and subnet cache expired data.
- Man page entry for unbound-checkconf -q.
26 April 2024: Yorgos
- Fix #876: [FR] can unbound-checkconf be silenced when configuration
is valid?
25 April 2024: Wouter
- Fix configure flto check error, by finding grep for it.
- Merge #1041: Stub and Forward unshare. This has one structure
for them and fixes #1038: fatal error: Could not initialize
thread / error: reading root hints.
- Fix to disable fragmentation on systems with IP_DONTFRAG,
with a nonzero value for the socket option argument.
- Fix doc unit test for out of directory build.
24 April 2024: Wouter
- Fix ci workflow for macos for moved install locations.
23 April 2024: Yorgos
- Merge #1053: Remove child delegations from cache when grandchild
delegations are returned from parent.
22 April 2024: Wouter
- Add checklock feature verbose_locking to trace locks and unlocks.
- Fix edns subnet to sort rrset references when storing messages
in the cache. This fixes a race condition in the rrset locks.
15 April 2024: Wouter
- Fix #1048: Update ax_pkg_swig.m4 and ax_pthread.m4.
- Fix configure, autoconf for #1048.
15 April 2024: Yorgos
- Merge #1049 from Petr Menšík: Py_NoSiteFlag is not needed since
Python 3.8
12 April 2024: Wouter
- Fix cachedb for serve-expired with serve-expired-client-timeout.
- Fixup unit test for cachedb server expired client timeout with
a check if response if from upstream or from cachedb.
- Fixup cachedb to not refetch when serve-expired-client-timeout is
used.
10 April 2024: Wouter
- Implement cachedb-check-when-serve-expired: yes option, default
is enabled. When serve expired is enabled with cachedb, it first
checks cachedb before serving the expired response.
- Fixup compile without cachedb.
- Add test for cachedb serve expired.
- Extended test for cachedb serve expired.
- Fix makefile dependencies for fake_event.c.
- Fix cachedb for serve-expired with serve-expired-reply-ttl.
- Fix to not reply serve expired unless enabled for cachedb.
9 April 2024: Yorgos
- Merge #1043 from xiaoxiaoafeifei: Add loongarch support; updates
config.guess(2024-01-01) and config.sub(2024-01-01), verified
with upstream.
8 April 2024: Yorgos
- Fix #595: unbound-anchor cannot deal with full disk; it will now
first write out to a temp file before replacing the original one,
like Unbound already does for auto-trust-anchor-file.
5 April 2024: Wouter
- Fix comment syntax for view function views_find_view.
5 April 2024: Yorgos
- Merge #1027: Introduce 'cache-min-negative-ttl' option.
3 April 2024: Wouter
- Fix #1040: fix heap-buffer-overflow issue in function cfg_mark_ports
of file util/config_file.c.
- For #1040: adjust error text and disallow negative ports in other
parts of cfg_mark_ports.
3 April 2024: Yorgos
- Fix #1035: Potential Bug while parsing port from the "stub-host"
string; also affected forward-zones and remote-control host
directives.
- Fix #369: dnstap showing extra responses; for client responses
right from the cache when replying with expired data or
prefetching.
28 March 2024: Wouter
- Fix #1034: DoT forward-zone via unbound-control.
- Fix for crypto related failures to have a better error string.
27 March 2024: Wouter
- Fix name of unit test for subnet cache response.
- Fix #1032: The size of subnet_msg_cache calculation mistake cause
memory usage increased beyond expectations.
- Fix for #1032, add safeguard to make table space positive.
- Fix comment in lruhash space function.
- Fix to add unit test for lruhash space that exercises the routines.
- Fix that when the server truncates the pidfile, it does not follow
symbolic links.
- Fix that the server does not chown the pidfile.
25 March 2024: Yorgos
- Merge #831 from Pierre4012: Improve Windows NSIS installer
script (setup.nsi).
- For #831: Format text, use exclamation icon and explicit label
names.
19 March 2024: Wouter
- Fix rpz so that rpz CNAME can apply after rpz CNAME. And fix that
clientip and nsip can give a CNAME.
- Fix localdata and rpz localdata to match CNAME only if no direct
type match is available.
18 March 2024: Wouter
- Fix that rpz CNAME content is limited to the max number of cnames.
- Fix rpz, it follows iterator CNAMEs for nsip and nsdname and sets
the reply query_info values, that is better for debug logging.
- Fix rpz that copies the cname override completely to the temp
region, so there are no references to the rpz region.
- Add rpz unit test for nsip action override.
- Fix rpz for qtype CNAME after nameserver trigger.
15 March 2024: Yorgos
- Merge #1030: Persist the openssl and expat directories for repeated
Windows builds.
15 March 2024: Wouter
- Fix that addrinfo is not kept around but copied and freed, so that
log-destaddr uses a copy of the information, much like NSD does.
13 March 2024: Wouter
- Fix #1029: rpz trigger clientip and action rpz-passthru not working
as expected.
- Fix rpz that the rpz override is taken in case of clientip triggers.
Fix that the clientip passthru action is logged. Fix that the
clientip localdata action is logged. Fix rpz override action cname
for the clientip trigger.
- Fix to unify codepath for local alias for rpz cname action override.
- Fix rpz for cname override action after nsdname and nsip triggers.
12 March 2024: Yorgos
- Merge #1028: Clearer documentation for tcp-idle-timeout and
edns-tcp-keepalive-timeout.
11 March 2024: Wouter
- Fix #1021 Inconsistent Behavior with Changing rpz-cname-override
and doing a unbound-control reload.
8 March 2024: Wouter
- Fix unbound-control-setup.cmd to use 3072 bits so that certificates
are long enough for newer OpenSSL versions.
- Fix TTL of synthesized CNAME when a DNAME is used from cache.
are long enough for newer OpenSSL versions. This fix is included
in 1.19.3rc2.
- Fix TTL of synthesized CNAME when a DNAME is used from cache. This
fix is included in 1.19.3rc2.
- Remove unused portion from iter_dname_ttl unit test.
- Fix validator classification of qtype DNAME for positive and
redirection answers, and fix validator signature routine for dealing
with the synthesized CNAME for a DNAME without previously
encountering it and also for when the qtype is DNAME.
- Fix qname minimisation for reply with a DNAME for qtype CNAME that
answers it.
- Fix doc test so it ignores but outputs unsupported doxygen options.
- Fix unbound-control-setup.cmd to have CA v3 basicConstraints,
like unbound-control-setup.sh has.
like unbound-control-setup.sh has. This fix is included in 1.19.3rc2.
8 March 2024: Yorgos
- Update doc/unbound.doxygen with 'doxygen -u'. Fixes option
deprecation warnings and updates with newer defaults.
7 March 2024: Wouter
- Version set to 1.19.3 for release. After 1.19.2 point release with
security fix for CVE-2024-1931, Denial of service when trimming
EDE text on positive replies. The code repo includes the fix and
is for version 1.19.3.
is for version 1.19.3. The code repo continues for version 1.19.4,
but 1.19.3 includes the fixes in 1.19.3rc2 as well.
5 March 2024: Wouter
- Fix for #1022: Fix ede prohibited in access control refused answers.
+1 -1
View File
@@ -1,4 +1,4 @@
README for Unbound 1.19.3
README for Unbound 1.20.0
Copyright 2007 NLnet Labs
http://unbound.net
+26 -2
View File
@@ -1,7 +1,7 @@
#
# Example configuration file.
#
# See unbound.conf(5) man page, version 1.19.3.
# See unbound.conf(5) man page, version 1.20.0.
#
# this is a comment.
@@ -191,6 +191,21 @@ server:
# are behind a slow satellite link, to eg. 1128.
# unknown-server-time-limit: 376
# msec before recursion replies are dropped. The work item continues.
# discard-timeout: 1900
# Max number of replies waiting for recursion per IP address.
# wait-limit: 1000
# Max replies waiting for recursion for IP address with cookie.
# wait-limit-cookie: 10000
# Apart from the default, the wait limit can be set for a netblock.
# wait-limit-netblock: 192.0.2.0/24 50000
# Apart from the default, the wait limit with cookie can be adjusted.
# wait-limit-cookie-netblock: 192.0.2.0/24 50000
# the amount of memory to use for the RRset cache.
# plain value in bytes or you can append k, m or G. default is "4Mb".
# rrset-cache-size: 4m
@@ -211,6 +226,11 @@ server:
# the time to live (TTL) value cap for negative responses in the cache
# cache-max-negative-ttl: 3600
# the time to live (TTL) value lower bound, in seconds. Default 0.
# For negative responses in the cache. If disabled, default,
# cache-min-tll applies if configured.
# cache-min-negative-ttl: 0
# the time to live (TTL) value for cached roundtrip times, lameness and
# EDNS version information for hosts. In seconds.
# infra-host-ttl: 900
@@ -283,7 +303,8 @@ server:
# Enable EDNS TCP keepalive option.
# edns-tcp-keepalive: no
# Timeout for EDNS TCP keepalive, in msec.
# Timeout for EDNS TCP keepalive, in msec. Overrides tcp-idle-timeout
# if edns-tcp-keepalive is set.
# edns-tcp-keepalive-timeout: 120000
# UDP queries that have waited in the socket buffer for a long time
@@ -1247,6 +1268,9 @@ remote-control:
# secret-seed: "default"
# # if the backend should be read from, but not written to.
# cachedb-no-store: no
# # if the cachedb should be checked before a serve-expired response is
# # given, when serve-expired is enabled.
# cachedb-check-when-serve-expired: yes
#
# # For "redis" backend:
# # (to enable, use --with-libhiredis to configure before compiling)
+2 -2
View File
@@ -1,4 +1,4 @@
.TH "libunbound" "3" "Mar 14, 2024" "NLnet Labs" "unbound 1.19.3"
.TH "libunbound" "3" "May 8, 2024" "NLnet Labs" "unbound 1.20.0"
.\"
.\" libunbound.3 -- unbound library functions manual
.\"
@@ -44,7 +44,7 @@
.B ub_ctx_zone_remove,
.B ub_ctx_data_add,
.B ub_ctx_data_remove
\- Unbound DNS validating resolver 1.19.3 functions.
\- Unbound DNS validating resolver 1.20.0 functions.
.SH "SYNOPSIS"
.B #include <unbound.h>
.LP
+1 -1
View File
@@ -1,4 +1,4 @@
.TH "unbound-anchor" "8" "Mar 14, 2024" "NLnet Labs" "unbound 1.19.3"
.TH "unbound-anchor" "8" "May 8, 2024" "NLnet Labs" "unbound 1.20.0"
.\"
.\" unbound-anchor.8 -- unbound anchor maintenance utility manual
.\"
+5 -1
View File
@@ -1,4 +1,4 @@
.TH "unbound-checkconf" "8" "Mar 14, 2024" "NLnet Labs" "unbound 1.19.3"
.TH "unbound-checkconf" "8" "May 8, 2024" "NLnet Labs" "unbound 1.20.0"
.\"
.\" unbound-checkconf.8 -- unbound configuration checker manual
.\"
@@ -14,6 +14,7 @@ unbound\-checkconf
.B unbound\-checkconf
.RB [ \-h ]
.RB [ \-f ]
.RB [ \-q ]
.RB [ \-o
.IR option ]
.RI [ cfgfile ]
@@ -37,6 +38,9 @@ Print full pathname, with chroot applied to it. Use with the \-o option.
If given, after checking the config file the value of this option is
printed to stdout. For "" (disabled) options an empty line is printed.
.TP
.B \-q
Make the operation quiet, suppress output on success.
.TP
.I cfgfile
The config file to read with settings for Unbound. It is checked.
If omitted, the config file at the default location is checked.
+5 -3
View File
@@ -1,4 +1,4 @@
.TH "unbound-control" "8" "Mar 14, 2024" "NLnet Labs" "unbound 1.19.3"
.TH "unbound-control" "8" "May 8, 2024" "NLnet Labs" "unbound 1.20.0"
.\"
.\" unbound-control.8 -- unbound remote control manual
.\"
@@ -239,22 +239,24 @@ still be bogus, use \fBflush_zone\fR to remove it), does not affect the config f
.B insecure_remove \fIzone
Removes domain\-insecure for the given zone.
.TP
.B forward_add \fR[\fI+i\fR] \fIzone addr ...
.B forward_add \fR[\fI+it\fR] \fIzone addr ...
Add a new forward zone to running Unbound. With +i option also adds a
\fIdomain\-insecure\fR for the zone (so it can resolve insecurely if you have
a DNSSEC root trust anchor configured for other names).
The addr can be IP4, IP6 or nameserver names, like \fIforward-zone\fR config
in unbound.conf.
The +t option sets it to use tls upstream, like \fIforward\-tls\-upstream\fR: yes.
.TP
.B forward_remove \fR[\fI+i\fR] \fIzone
Remove a forward zone from running Unbound. The +i also removes a
\fIdomain\-insecure\fR for the zone.
.TP
.B stub_add \fR[\fI+ip\fR] \fIzone addr ...
.B stub_add \fR[\fI+ipt\fR] \fIzone addr ...
Add a new stub zone to running Unbound. With +i option also adds a
\fIdomain\-insecure\fR for the zone. With +p the stub zone is set to prime,
without it it is set to notprime. The addr can be IP4, IP6 or nameserver
names, like the \fIstub-zone\fR config in unbound.conf.
The +t option sets it to use tls upstream, like \fIstub\-tls\-upstream\fR: yes.
.TP
.B stub_remove \fR[\fI+i\fR] \fIzone
Remove a stub zone from running Unbound. The +i also removes a
+1 -1
View File
@@ -1,4 +1,4 @@
.TH "unbound\-host" "1" "Mar 14, 2024" "NLnet Labs" "unbound 1.19.3"
.TH "unbound\-host" "1" "May 8, 2024" "NLnet Labs" "unbound 1.20.0"
.\"
.\" unbound-host.1 -- unbound DNS lookup utility
.\"
+2 -2
View File
@@ -1,4 +1,4 @@
.TH "unbound" "8" "Mar 14, 2024" "NLnet Labs" "unbound 1.19.3"
.TH "unbound" "8" "May 8, 2024" "NLnet Labs" "unbound 1.20.0"
.\"
.\" unbound.8 -- unbound manual
.\"
@@ -9,7 +9,7 @@
.\"
.SH "NAME"
.B unbound
\- Unbound DNS validating resolver 1.19.3.
\- Unbound DNS validating resolver 1.20.0.
.SH "SYNOPSIS"
.B unbound
.RB [ \-h ]
+55 -17
View File
@@ -1,4 +1,4 @@
.TH "unbound.conf" "5" "Mar 14, 2024" "NLnet Labs" "unbound 1.19.3"
.TH "unbound.conf" "5" "May 8, 2024" "NLnet Labs" "unbound 1.20.0"
.\"
.\" unbound.conf.5 -- unbound.conf manual
.\"
@@ -302,6 +302,36 @@ Increase this if you are behind a slow satellite link, to eg. 1128.
That would then avoid re\-querying every initial query because it times out.
Default is 376 msec.
.TP
.B discard\-timeout: \fI<msec>
The wait time in msec where recursion requests are dropped. This is
to stop a large number of replies from accumulating. They receive
no reply, the work item continues to recurse. It is nice to be a bit
larger than serve\-expired\-client\-timeout if that is enabled.
A value of 1900 msec is suggested. The value 0 disables it.
Default 1900 msec.
.TP
.B wait\-limit: \fI<number>
The number of replies that can wait for recursion, for an IP address.
This makes a ratelimit per IP address of waiting replies for recursion.
It stops very large amounts of queries waiting to be returned to one
destination. The value 0 disables wait limits. Default is 1000.
.TP
.B wait\-limit\-cookie: \fI<number>
The number of replies that can wait for recursion, for an IP address
that sent the query with a valid DNS cookie. Since the cookie validates
the client address, the limit can be higher. Default is 10000.
.TP
.B wait\-limit\-netblock: \fI<netblock> <number>
The wait limit for the netblock. If not given the wait\-limit value is
used. The most specific netblock is used to determine the limit. Useful for
overriding the default for a specific, group or individual, server.
The value -1 disables wait limits for the netblock.
.TP
.B wait\-limit\-cookie\-netblock: \fI<netblock> <number>
The wait limit for the netblock, when the query has a DNS cookie.
If not given, the wait\-limit\-cookie value is used.
The value -1 disables wait limits for the netblock.
.TP
.B so\-rcvbuf: \fI<number>
If not 0, then set the SO_RCVBUF socket option to get more buffer
space on UDP port 53 incoming queries. So that short spikes on busy
@@ -388,6 +418,15 @@ Time to live maximum for negative responses, these have a SOA in the
authority section that is limited in time. Default is 3600.
This applies to nxdomain and nodata answers.
.TP
.B cache\-min\-negative\-ttl: \fI<seconds>
Time to live minimum for negative responses, these have a SOA in the
authority section that is limited in time.
Default is 0 (disabled).
If this is disabled and \fBcache-min-ttl\fR is configured, it will take effect
instead.
In that case you can set this to 1 to honor the upstream TTL.
This applies to nxdomain and nodata answers.
.TP
.B infra\-host\-ttl: \fI<seconds>
Time to live for entries in the host cache. The host cache contains
roundtrip timing, lameness and EDNS support information. Default is 900.
@@ -472,6 +511,8 @@ configured value if the number of free buffers falls below 35% of the
total number configured, and finally to 0 if the number of free buffers
falls below 20% of the total number configured. A minimum timeout of
200 milliseconds is observed regardless of the option value used.
It will be overriden by \fBedns\-tcp\-keepalive\-timeout\fR if
\fBedns\-tcp\-keepalive\fR is enabled.
.TP
.B tcp-reuse-timeout: \fI<msec>\fR
The period Unbound will keep TCP persistent connections open to
@@ -490,20 +531,11 @@ This option defaults to 3000 milliseconds.
Enable or disable EDNS TCP Keepalive. Default is no.
.TP
.B edns-tcp-keepalive-timeout: \fI<msec>\fR
The period Unbound will wait for a query on a TCP connection when
EDNS TCP Keepalive is active. If this timeout expires Unbound closes
the connection. If the client supports the EDNS TCP Keepalive option,
Overrides \fBtcp\-idle\-timeout\fR when \fBedns\-tcp\-keepalive\fR is enabled.
If the client supports the EDNS TCP Keepalive option,
Unbound sends the timeout value to the client to encourage it to
close the connection before the server times out.
This option defaults to 120000 milliseconds.
When the number of free incoming TCP buffers falls below 50% of
the total number configured, the advertised timeout is progressively
reduced to 1% of the configured value, then to 0.2% of the configured
value if the number of free buffers falls below 35% of the total number
configured, and finally to 0 if the number of free buffers falls below
20% of the total number configured.
A minimum actual timeout of 200 milliseconds is observed regardless of the
advertised timeout.
.TP
.B sock\-queue\-timeout: \fI<sec>\fR
UDP queries that have waited in the socket buffer for a long time can be
@@ -2638,11 +2670,7 @@ If Unbound cannot even find an answer in the backend, it resolves the
query as usual, and stores the answer in the backend.
.P
This module interacts with the \fBserve\-expired\-*\fR options and will reply
with expired data if Unbound is configured for that. Currently the use
of \fBserve\-expired\-client\-timeout:\fR and
\fBserve\-expired\-reply\-ttl:\fR is not consistent for data originating from
the external cache as these will result in a reply with 0 TTL without trying to
update the data first, ignoring the configured values.
with expired data if Unbound is configured for that.
.P
If Unbound was built with
\fB\-\-with\-libhiredis\fR
@@ -2698,6 +2726,16 @@ This option defaults to "default".
If the backend should be read from, but not written to. This makes this
instance not store dns messages in the backend. But if data is available it
is retrieved. The default is no.
.TP
.B cachedb-check-when-serve-expired: \fI<yes or no>\fR
If enabled, the cachedb is checked before an expired response is returned.
When \fBserve\-expired\fR is enabled, without \fBserve\-expired\-client\-timeout\fR, it then
does not immediately respond with an expired response from cache, but instead
first checks the cachedb for valid contents, and if so returns it. If the
cachedb also has no valid contents, the serve expired response is sent.
If also \fBserve\-expired\-client\-timeout\fR is enabled, the expired response
is delayed until the timeout expires. Unless the lookup succeeds within the
timeout. The default is yes.
.P
The following
.B cachedb
File diff suppressed because it is too large. Load diff
+36 -4
View File
@@ -57,6 +57,9 @@
#include "sldns/sbuffer.h"
#include "sldns/wire2str.h"
#include "iterator/iter_utils.h"
#ifdef USE_CACHEDB
#include "cachedb/cachedb.h"
#endif
/** externally called */
void
@@ -152,7 +155,7 @@ int ecs_whitelist_check(struct query_info* qinfo,
/* Cache by default, might be disabled after parsing EDNS option
* received from nameserver. */
if(!iter_stub_fwd_no_cache(qstate, &qstate->qinfo, NULL, NULL)) {
if(!iter_stub_fwd_no_cache(qstate, &qstate->qinfo, NULL, NULL, NULL, 0)) {
qstate->no_cache_store = 0;
}
@@ -310,9 +313,18 @@ delfunc(void *envptr, void *elemptr) {
static size_t
sizefunc(void *elemptr) {
struct reply_info *elem = (struct reply_info *)elemptr;
return sizeof (struct reply_info) - sizeof (struct rrset_ref)
size_t s = sizeof (struct reply_info) - sizeof (struct rrset_ref)
+ elem->rrset_count * sizeof (struct rrset_ref)
+ elem->rrset_count * sizeof (struct ub_packed_rrset_key *);
size_t i;
for (i = 0; i < elem->rrset_count; i++) {
struct ub_packed_rrset_key *key = elem->rrsets[i];
struct packed_rrset_data *data = key->entry.data;
s += ub_rrset_sizefunc(key, data);
}
if(elem->reason_bogus_str)
s += strlen(elem->reason_bogus_str)+1;
return s;
}
/**
@@ -352,7 +364,7 @@ update_cache(struct module_qstate *qstate, int id)
struct slabhash *subnet_msg_cache = sne->subnet_msg_cache;
struct ecs_data *edns = &sq->ecs_client_in;
size_t i;
int only_match_scope_zero;
int only_match_scope_zero, diff_size;
/* We already calculated hash upon lookup (lookup_and_reply) if we were
* allowed to look in the ECS cache */
@@ -412,19 +424,25 @@ update_cache(struct module_qstate *qstate, int id)
rep->ref[i].id = rep->rrsets[i]->id;
}
reply_info_set_ttls(rep, *qstate->env->now);
reply_info_sortref(rep);
rep->flags |= (BIT_RA | BIT_QR); /* fix flags to be sensible for */
rep->flags &= ~(BIT_AA | BIT_CD);/* a reply based on the cache */
if(edns->subnet_source_mask == 0 && edns->subnet_scope_mask == 0)
only_match_scope_zero = 1;
else only_match_scope_zero = 0;
diff_size = (int)tree->size_bytes;
addrtree_insert(tree, (addrkey_t*)edns->subnet_addr,
edns->subnet_source_mask, sq->max_scope, rep,
rep->ttl, *qstate->env->now, only_match_scope_zero);
diff_size = (int)tree->size_bytes - diff_size;
lock_rw_unlock(&lru_entry->lock);
if (need_to_insert) {
slabhash_insert(subnet_msg_cache, h, lru_entry, lru_entry->data,
NULL);
} else {
slabhash_update_space_used(subnet_msg_cache, h, NULL,
diff_size);
}
}
@@ -587,7 +605,21 @@ eval_response(struct module_qstate *qstate, int id, struct subnet_qstate *sq)
}
sne->num_msg_nocache++;
lock_rw_unlock(&sne->biglock);
/* If there is an expired answer in the global cache, remove that,
* because expired answers would otherwise resurface once the ecs data
* expires, giving once in a while global data responses for ecs
* domains, with serve expired enabled. */
if(qstate->env->cfg->serve_expired) {
msg_cache_remove(qstate->env, qstate->qinfo.qname,
qstate->qinfo.qname_len, qstate->qinfo.qtype,
qstate->qinfo.qclass, 0);
#ifdef USE_CACHEDB
if(qstate->env->cachedb_enabled)
cachedb_msg_remove(qstate);
#endif
}
if (sq->subnet_downstream) {
/* Client wants to see the answer, echo option back
* and adjust the scope. */
+93 -26
View File
@@ -71,6 +71,7 @@ forwards_create(void)
sizeof(struct iter_forwards));
if(!fwd)
return NULL;
lock_rw_init(&fwd->lock);
return fwd;
}
@@ -100,6 +101,7 @@ forwards_delete(struct iter_forwards* fwd)
{
if(!fwd)
return;
lock_rw_destroy(&fwd->lock);
fwd_del_tree(fwd);
free(fwd);
}
@@ -332,45 +334,64 @@ make_stub_holes(struct iter_forwards* fwd, struct config_file* cfg)
int
forwards_apply_cfg(struct iter_forwards* fwd, struct config_file* cfg)
{
if(fwd->tree) {
lock_unprotect(&fwd->lock, fwd->tree);
}
fwd_del_tree(fwd);
fwd->tree = rbtree_create(fwd_cmp);
if(!fwd->tree)
return 0;
lock_protect(&fwd->lock, fwd->tree, sizeof(*fwd->tree));
lock_rw_wrlock(&fwd->lock);
/* read forward zones */
if(!read_forwards(fwd, cfg))
if(!read_forwards(fwd, cfg)) {
lock_rw_unlock(&fwd->lock);
return 0;
if(!make_stub_holes(fwd, cfg))
}
if(!make_stub_holes(fwd, cfg)) {
lock_rw_unlock(&fwd->lock);
return 0;
}
fwd_init_parents(fwd);
lock_rw_unlock(&fwd->lock);
return 1;
}
struct delegpt*
forwards_find(struct iter_forwards* fwd, uint8_t* qname, uint16_t qclass)
forwards_find(struct iter_forwards* fwd, uint8_t* qname, uint16_t qclass,
int nolock)
{
rbnode_type* res = NULL;
struct iter_forward_zone* res;
struct iter_forward_zone key;
int has_dp;
key.node.key = &key;
key.dclass = qclass;
key.name = qname;
key.namelabs = dname_count_size_labels(qname, &key.namelen);
res = rbtree_search(fwd->tree, &key);
if(res) return ((struct iter_forward_zone*)res)->dp;
return NULL;
/* lock_() calls are macros that could be nothing, surround in {} */
if(!nolock) { lock_rw_rdlock(&fwd->lock); }
res = (struct iter_forward_zone*)rbtree_search(fwd->tree, &key);
has_dp = res && res->dp;
if(!has_dp && !nolock) { lock_rw_unlock(&fwd->lock); }
return has_dp?res->dp:NULL;
}
struct delegpt*
forwards_lookup(struct iter_forwards* fwd, uint8_t* qname, uint16_t qclass)
forwards_lookup(struct iter_forwards* fwd, uint8_t* qname, uint16_t qclass,
int nolock)
{
/* lookup the forward zone in the tree */
rbnode_type* res = NULL;
struct iter_forward_zone *result;
struct iter_forward_zone key;
int has_dp;
key.node.key = &key;
key.dclass = qclass;
key.name = qname;
key.namelabs = dname_count_size_labels(qname, &key.namelen);
/* lock_() calls are macros that could be nothing, surround in {} */
if(!nolock) { lock_rw_rdlock(&fwd->lock); }
if(rbtree_find_less_equal(fwd->tree, &key, &res)) {
/* exact */
result = (struct iter_forward_zone*)res;
@@ -378,8 +399,10 @@ forwards_lookup(struct iter_forwards* fwd, uint8_t* qname, uint16_t qclass)
/* smaller element (or no element) */
int m;
result = (struct iter_forward_zone*)res;
if(!result || result->dclass != qclass)
if(!result || result->dclass != qclass) {
if(!nolock) { lock_rw_unlock(&fwd->lock); }
return NULL;
}
/* count number of labels matched */
(void)dname_lab_cmp(result->name, result->namelabs, key.name,
key.namelabs, &m);
@@ -389,20 +412,22 @@ forwards_lookup(struct iter_forwards* fwd, uint8_t* qname, uint16_t qclass)
result = result->parent;
}
}
if(result)
return result->dp;
return NULL;
has_dp = result && result->dp;
if(!has_dp && !nolock) { lock_rw_unlock(&fwd->lock); }
return has_dp?result->dp:NULL;
}
struct delegpt*
forwards_lookup_root(struct iter_forwards* fwd, uint16_t qclass)
forwards_lookup_root(struct iter_forwards* fwd, uint16_t qclass, int nolock)
{
uint8_t root = 0;
return forwards_lookup(fwd, &root, qclass);
return forwards_lookup(fwd, &root, qclass, nolock);
}
int
forwards_next_root(struct iter_forwards* fwd, uint16_t* dclass)
/* Finds next root item in forwards lookup tree.
* Caller needs to handle locking of the forwards structure. */
static int
next_root_locked(struct iter_forwards* fwd, uint16_t* dclass)
{
struct iter_forward_zone key;
rbnode_type* n;
@@ -419,7 +444,7 @@ forwards_next_root(struct iter_forwards* fwd, uint16_t* dclass)
}
/* root not first item? search for higher items */
*dclass = p->dclass + 1;
return forwards_next_root(fwd, dclass);
return next_root_locked(fwd, dclass);
}
/* find class n in tree, we may get a direct hit, or if we don't
* this is the last item of the previous class so rbtree_next() takes
@@ -447,10 +472,21 @@ forwards_next_root(struct iter_forwards* fwd, uint16_t* dclass)
}
/* not a root node, return next higher item */
*dclass = p->dclass+1;
return forwards_next_root(fwd, dclass);
return next_root_locked(fwd, dclass);
}
}
int
forwards_next_root(struct iter_forwards* fwd, uint16_t* dclass, int nolock)
{
int ret;
/* lock_() calls are macros that could be nothing, surround in {} */
if(!nolock) { lock_rw_rdlock(&fwd->lock); }
ret = next_root_locked(fwd, dclass);
if(!nolock) { lock_rw_unlock(&fwd->lock); }
return ret;
}
size_t
forwards_get_mem(struct iter_forwards* fwd)
{
@@ -458,10 +494,12 @@ forwards_get_mem(struct iter_forwards* fwd)
size_t s;
if(!fwd)
return 0;
lock_rw_rdlock(&fwd->lock);
s = sizeof(*fwd) + sizeof(*fwd->tree);
RBTREE_FOR(p, struct iter_forward_zone*, fwd->tree) {
s += sizeof(*p) + p->namelen + delegpt_get_mem(p->dp);
}
lock_rw_unlock(&fwd->lock);
return s;
}
@@ -477,49 +515,78 @@ fwd_zone_find(struct iter_forwards* fwd, uint16_t c, uint8_t* nm)
}
int
forwards_add_zone(struct iter_forwards* fwd, uint16_t c, struct delegpt* dp)
forwards_add_zone(struct iter_forwards* fwd, uint16_t c, struct delegpt* dp,
int nolock)
{
struct iter_forward_zone *z;
/* lock_() calls are macros that could be nothing, surround in {} */
if(!nolock) { lock_rw_wrlock(&fwd->lock); }
if((z=fwd_zone_find(fwd, c, dp->name)) != NULL) {
(void)rbtree_delete(fwd->tree, &z->node);
fwd_zone_free(z);
}
if(!forwards_insert(fwd, c, dp))
if(!forwards_insert(fwd, c, dp)) {
if(!nolock) { lock_rw_unlock(&fwd->lock); }
return 0;
}
fwd_init_parents(fwd);
if(!nolock) { lock_rw_unlock(&fwd->lock); }
return 1;
}
void
forwards_delete_zone(struct iter_forwards* fwd, uint16_t c, uint8_t* nm)
forwards_delete_zone(struct iter_forwards* fwd, uint16_t c, uint8_t* nm,
int nolock)
{
struct iter_forward_zone *z;
if(!(z=fwd_zone_find(fwd, c, nm)))
/* lock_() calls are macros that could be nothing, surround in {} */
if(!nolock) { lock_rw_wrlock(&fwd->lock); }
if(!(z=fwd_zone_find(fwd, c, nm))) {
if(!nolock) { lock_rw_unlock(&fwd->lock); }
return; /* nothing to do */
}
(void)rbtree_delete(fwd->tree, &z->node);
fwd_zone_free(z);
fwd_init_parents(fwd);
if(!nolock) { lock_rw_unlock(&fwd->lock); }
}
int
forwards_add_stub_hole(struct iter_forwards* fwd, uint16_t c, uint8_t* nm)
forwards_add_stub_hole(struct iter_forwards* fwd, uint16_t c, uint8_t* nm,
int nolock)
{
/* lock_() calls are macros that could be nothing, surround in {} */
if(!nolock) { lock_rw_wrlock(&fwd->lock); }
if(fwd_zone_find(fwd, c, nm) != NULL) {
if(!nolock) { lock_rw_unlock(&fwd->lock); }
return 1; /* already a stub zone there */
}
if(!fwd_add_stub_hole(fwd, c, nm)) {
if(!nolock) { lock_rw_unlock(&fwd->lock); }
return 0;
}
fwd_init_parents(fwd);
if(!nolock) { lock_rw_unlock(&fwd->lock); }
return 1;
}
void
forwards_delete_stub_hole(struct iter_forwards* fwd, uint16_t c, uint8_t* nm)
forwards_delete_stub_hole(struct iter_forwards* fwd, uint16_t c,
uint8_t* nm, int nolock)
{
struct iter_forward_zone *z;
if(!(z=fwd_zone_find(fwd, c, nm)))
/* lock_() calls are macros that could be nothing, surround in {} */
if(!nolock) { lock_rw_wrlock(&fwd->lock); }
if(!(z=fwd_zone_find(fwd, c, nm))) {
if(!nolock) { lock_rw_unlock(&fwd->lock); }
return; /* nothing to do */
if(z->dp != NULL)
}
if(z->dp != NULL) {
if(!nolock) { lock_rw_unlock(&fwd->lock); }
return; /* not a stub hole */
}
(void)rbtree_delete(fwd->tree, &z->node);
fwd_zone_free(z);
fwd_init_parents(fwd);
if(!nolock) { lock_rw_unlock(&fwd->lock); }
}
+49 -11
View File
@@ -43,6 +43,7 @@
#ifndef ITERATOR_ITER_FWD_H
#define ITERATOR_ITER_FWD_H
#include "util/rbtree.h"
#include "util/locks.h"
struct config_file;
struct delegpt;
@@ -50,6 +51,11 @@ struct delegpt;
* Iterator forward zones structure
*/
struct iter_forwards {
/** lock on the forwards tree.
* When grabbing both this lock and the anchors.lock, this lock
* is grabbed first. When grabbing both this lock and the hints.lock
* this lock is grabbed first. */
lock_rw_type lock;
/**
* Zones are stored in this tree. Sort order is specially chosen.
* first sorted on qclass. Then on dname in nsec-like order, so that
@@ -106,47 +112,65 @@ int forwards_apply_cfg(struct iter_forwards* fwd, struct config_file* cfg);
/**
* Find forward zone exactly by name
* The return value is contents of the forwards structure.
* Caller should lock and unlock a readlock on the forwards structure if nolock
* is set.
* Otherwise caller should unlock the readlock on the forwards structure if a
* value was returned.
* @param fwd: forward storage.
* @param qname: The qname of the query.
* @param qclass: The qclass of the query.
* @param nolock: Skip locking, locking is handled by the caller.
* @return: A delegation point or null.
*/
struct delegpt* forwards_find(struct iter_forwards* fwd, uint8_t* qname,
uint16_t qclass);
uint16_t qclass, int nolock);
/**
* Find forward zone information
* For this qname/qclass find forward zone information, returns delegation
* point with server names and addresses, or NULL if no forwarding is needed.
* The return value is contents of the forwards structure.
* Caller should lock and unlock a readlock on the forwards structure if nolock
* is set.
* Otherwise caller should unlock the readlock on the forwards structure if a
* value was returned.
*
* @param fwd: forward storage.
* @param qname: The qname of the query.
* @param qclass: The qclass of the query.
* @param nolock: Skip locking, locking is handled by the caller.
* @return: A delegation point if the query has to be forwarded to that list,
* otherwise null.
*/
struct delegpt* forwards_lookup(struct iter_forwards* fwd,
uint8_t* qname, uint16_t qclass);
struct delegpt* forwards_lookup(struct iter_forwards* fwd,
uint8_t* qname, uint16_t qclass, int nolock);
/**
* Same as forwards_lookup, but for the root only
* @param fwd: forward storage.
* @param qclass: The qclass of the query.
* @param nolock: Skip locking, locking is handled by the caller.
* @return: A delegation point if root forward exists, otherwise null.
*/
struct delegpt* forwards_lookup_root(struct iter_forwards* fwd,
uint16_t qclass);
struct delegpt* forwards_lookup_root(struct iter_forwards* fwd,
uint16_t qclass, int nolock);
/**
* Find next root item in forwards lookup tree.
* Handles its own locking unless nolock is set. In that case the caller
* should lock and unlock a readlock on the forwards structure.
* @param fwd: the forward storage
* @param qclass: class to look at next, or higher.
* @param nolock: Skip locking, locking is handled by the caller.
* @return false if none found, or if true stored in qclass.
*/
int forwards_next_root(struct iter_forwards* fwd, uint16_t* qclass);
int forwards_next_root(struct iter_forwards* fwd, uint16_t* qclass,
int nolock);
/**
* Get memory in use by forward storage
* Locks and unlocks the structure.
* @param fwd: forward storage.
* @return bytes in use
*/
@@ -158,42 +182,56 @@ int fwd_cmp(const void* k1, const void* k2);
/**
* Add zone to forward structure. For external use since it recalcs
* the tree parents.
* Handles its own locking unless nolock is set. In that case the caller
* should lock and unlock a writelock on the forwards structure.
* @param fwd: the forward data structure
* @param c: class of zone
* @param dp: delegation point with name and target nameservers for new
* forward zone. malloced.
* @param nolock: Skip locking, locking is handled by the caller.
* @return false on failure (out of memory);
*/
int forwards_add_zone(struct iter_forwards* fwd, uint16_t c,
struct delegpt* dp);
int forwards_add_zone(struct iter_forwards* fwd, uint16_t c,
struct delegpt* dp, int nolock);
/**
* Remove zone from forward structure. For external use since it
* recalcs the tree parents.
* Handles its own locking unless nolock is set. In that case the caller
* should lock and unlock a writelock on the forwards structure.
* @param fwd: the forward data structure
* @param c: class of zone
* @param nm: name of zone (in uncompressed wireformat).
* @param nolock: Skip locking, locking is handled by the caller.
*/
void forwards_delete_zone(struct iter_forwards* fwd, uint16_t c, uint8_t* nm);
void forwards_delete_zone(struct iter_forwards* fwd, uint16_t c,
uint8_t* nm, int nolock);
/**
* Add stub hole (empty entry in forward table, that makes resolution skip
* a forward-zone because the stub zone should override the forward zone).
* Does not add one if not necessary.
* Handles its own locking unless nolock is set. In that case the caller
* should lock and unlock a writelock on the forwards structure.
* @param fwd: the forward data structure
* @param c: class of zone
* @param nm: name of zone (in uncompressed wireformat).
* @param nolock: Skip locking, locking is handled by the caller.
* @return false on failure (out of memory);
*/
int forwards_add_stub_hole(struct iter_forwards* fwd, uint16_t c, uint8_t* nm);
int forwards_add_stub_hole(struct iter_forwards* fwd, uint16_t c,
uint8_t* nm, int nolock);
/**
* Remove stub hole, if one exists.
* Handles its own locking unless nolock is set. In that case the caller
* should lock and unlock a writelock on the forwards structure.
* @param fwd: the forward data structure
* @param c: class of zone
* @param nm: name of zone (in uncompressed wireformat).
* @param nolock: Skip locking, locking is handled by the caller.
*/
void forwards_delete_stub_hole(struct iter_forwards* fwd, uint16_t c,
uint8_t* nm);
uint8_t* nm, int nolock);
#endif /* ITERATOR_ITER_FWD_H */
+74 -23
View File
@@ -57,6 +57,8 @@ hints_create(void)
sizeof(struct iter_hints));
if(!hints)
return NULL;
lock_rw_init(&hints->lock);
lock_protect(&hints->lock, &hints->tree, sizeof(hints->tree));
return hints;
}
@@ -83,6 +85,7 @@ hints_delete(struct iter_hints* hints)
{
if(!hints)
return;
lock_rw_destroy(&hints->lock);
hints_del_tree(hints);
free(hints);
}
@@ -438,47 +441,70 @@ read_root_hints_list(struct iter_hints* hints, struct config_file* cfg)
int
hints_apply_cfg(struct iter_hints* hints, struct config_file* cfg)
{
int nolock = 1;
lock_rw_wrlock(&hints->lock);
hints_del_tree(hints);
name_tree_init(&hints->tree);
/* read root hints */
if(!read_root_hints_list(hints, cfg))
if(!read_root_hints_list(hints, cfg)) {
lock_rw_unlock(&hints->lock);
return 0;
}
/* read stub hints */
if(!read_stubs(hints, cfg))
if(!read_stubs(hints, cfg)) {
lock_rw_unlock(&hints->lock);
return 0;
}
/* use fallback compiletime root hints */
if(!hints_lookup_root(hints, LDNS_RR_CLASS_IN)) {
if(!hints_find_root(hints, LDNS_RR_CLASS_IN, nolock)) {
struct delegpt* dp = compile_time_root_prime(cfg->do_ip4,
cfg->do_ip6);
verbose(VERB_ALGO, "no config, using builtin root hints.");
if(!dp)
if(!dp) {
lock_rw_unlock(&hints->lock);
return 0;
if(!hints_insert(hints, LDNS_RR_CLASS_IN, dp, 0))
}
if(!hints_insert(hints, LDNS_RR_CLASS_IN, dp, 0)) {
lock_rw_unlock(&hints->lock);
return 0;
}
}
name_tree_init_parents(&hints->tree);
lock_rw_unlock(&hints->lock);
return 1;
}
struct delegpt*
hints_lookup_root(struct iter_hints* hints, uint16_t qclass)
struct delegpt*
hints_find(struct iter_hints* hints, uint8_t* qname, uint16_t qclass,
int nolock)
{
struct iter_hints_stub *stub;
size_t len;
int has_dp;
int labs = dname_count_size_labels(qname, &len);
/* lock_() calls are macros that could be nothing, surround in {} */
if(!nolock) { lock_rw_rdlock(&hints->lock); }
stub = (struct iter_hints_stub*)name_tree_find(&hints->tree,
qname, len, labs, qclass);
has_dp = stub && stub->dp;
if(!has_dp && !nolock) { lock_rw_unlock(&hints->lock); }
return has_dp?stub->dp:NULL;
}
struct delegpt*
hints_find_root(struct iter_hints* hints, uint16_t qclass, int nolock)
{
uint8_t rootlab = 0;
struct iter_hints_stub *stub;
stub = (struct iter_hints_stub*)name_tree_find(&hints->tree,
&rootlab, 1, 1, qclass);
if(!stub)
return NULL;
return stub->dp;
return hints_find(hints, &rootlab, qclass, nolock);
}
struct iter_hints_stub*
hints_lookup_stub(struct iter_hints* hints, uint8_t* qname,
uint16_t qclass, struct delegpt* cache_dp)
hints_lookup_stub(struct iter_hints* hints, uint8_t* qname,
uint16_t qclass, struct delegpt* cache_dp, int nolock)
{
size_t len;
int labs;
@@ -486,14 +512,20 @@ hints_lookup_stub(struct iter_hints* hints, uint8_t* qname,
/* first lookup the stub */
labs = dname_count_size_labels(qname, &len);
/* lock_() calls are macros that could be nothing, surround in {} */
if(!nolock) { lock_rw_rdlock(&hints->lock); }
r = (struct iter_hints_stub*)name_tree_lookup(&hints->tree, qname,
len, labs, qclass);
if(!r) return NULL;
if(!r) {
if(!nolock) { lock_rw_unlock(&hints->lock); }
return NULL;
}
/* If there is no cache (root prime situation) */
if(cache_dp == NULL) {
if(r->dp->namelabs != 1)
return r; /* no cache dp, use any non-root stub */
if(!nolock) { lock_rw_unlock(&hints->lock); }
return NULL;
}
@@ -510,12 +542,18 @@ hints_lookup_stub(struct iter_hints* hints, uint8_t* qname,
if(dname_strict_subdomain(r->dp->name, r->dp->namelabs,
cache_dp->name, cache_dp->namelabs))
return r; /* need to prime this stub */
if(!nolock) { lock_rw_unlock(&hints->lock); }
return NULL;
}
int hints_next_root(struct iter_hints* hints, uint16_t* qclass)
int hints_next_root(struct iter_hints* hints, uint16_t* qclass, int nolock)
{
return name_tree_next_root(&hints->tree, qclass);
int ret;
/* lock_() calls are macros that could be nothing, surround in {} */
if(!nolock) { lock_rw_rdlock(&hints->lock); }
ret = name_tree_next_root(&hints->tree, qclass);
if(!nolock) { lock_rw_unlock(&hints->lock); }
return ret;
}
size_t
@@ -524,39 +562,52 @@ hints_get_mem(struct iter_hints* hints)
size_t s;
struct iter_hints_stub* p;
if(!hints) return 0;
lock_rw_rdlock(&hints->lock);
s = sizeof(*hints);
RBTREE_FOR(p, struct iter_hints_stub*, &hints->tree) {
s += sizeof(*p) + delegpt_get_mem(p->dp);
}
lock_rw_unlock(&hints->lock);
return s;
}
int
hints_add_stub(struct iter_hints* hints, uint16_t c, struct delegpt* dp,
int noprime)
int noprime, int nolock)
{
struct iter_hints_stub *z;
/* lock_() calls are macros that could be nothing, surround in {} */
if(!nolock) { lock_rw_wrlock(&hints->lock); }
if((z=(struct iter_hints_stub*)name_tree_find(&hints->tree,
dp->name, dp->namelen, dp->namelabs, c)) != NULL) {
(void)rbtree_delete(&hints->tree, &z->node);
hints_stub_free(z);
}
if(!hints_insert(hints, c, dp, noprime))
if(!hints_insert(hints, c, dp, noprime)) {
if(!nolock) { lock_rw_unlock(&hints->lock); }
return 0;
}
name_tree_init_parents(&hints->tree);
if(!nolock) { lock_rw_unlock(&hints->lock); }
return 1;
}
void
hints_delete_stub(struct iter_hints* hints, uint16_t c, uint8_t* nm)
hints_delete_stub(struct iter_hints* hints, uint16_t c, uint8_t* nm,
int nolock)
{
struct iter_hints_stub *z;
size_t len;
int labs = dname_count_size_labels(nm, &len);
/* lock_() calls are macros that could be nothing, surround in {} */
if(!nolock) { lock_rw_wrlock(&hints->lock); }
if(!(z=(struct iter_hints_stub*)name_tree_find(&hints->tree,
nm, len, labs, c)))
nm, len, labs, c))) {
if(!nolock) { lock_rw_unlock(&hints->lock); }
return; /* nothing to do */
}
(void)rbtree_delete(&hints->tree, &z->node);
hints_stub_free(z);
name_tree_init_parents(&hints->tree);
if(!nolock) { lock_rw_unlock(&hints->lock); }
}
+47 -7
View File
@@ -43,6 +43,7 @@
#ifndef ITERATOR_ITER_HINTS_H
#define ITERATOR_ITER_HINTS_H
#include "util/storage/dnstree.h"
#include "util/locks.h"
struct iter_env;
struct config_file;
struct delegpt;
@@ -51,6 +52,10 @@ struct delegpt;
* Iterator hints structure
*/
struct iter_hints {
/** lock on the forwards tree.
* When grabbing both this lock and the anchors.lock, this lock
* is grabbed first. */
lock_rw_type lock;
/**
* Hints are stored in this tree. Sort order is specially chosen.
* first sorted on qclass. Then on dname in nsec-like order, so that
@@ -95,42 +100,70 @@ void hints_delete(struct iter_hints* hints);
int hints_apply_cfg(struct iter_hints* hints, struct config_file* cfg);
/**
* Find root hints for the given class.
* Find hints for the given class.
* The return value is contents of the hints structure.
* Caller should lock and unlock a readlock on the hints structure if nolock
* is set.
* Otherwise caller should unlock the readlock on the hints structure if a
* value was returned.
* @param hints: hint storage.
* @param qname: the qname that generated the delegation point.
* @param qclass: class for which root hints are requested. host order.
* @param nolock: Skip locking, locking is handled by the caller.
* @return: NULL if no hints, or a ptr to stored hints.
*/
struct delegpt* hints_lookup_root(struct iter_hints* hints, uint16_t qclass);
struct delegpt* hints_find(struct iter_hints* hints, uint8_t* qname,
uint16_t qclass, int nolock);
/**
* Same as hints_lookup, but for the root only.
* @param hints: hint storage.
* @param qclass: class for which root hints are requested. host order.
* @param nolock: Skip locking, locking is handled by the caller.
* @return: NULL if no hints, or a ptr to stored hints.
*/
struct delegpt* hints_find_root(struct iter_hints* hints,
uint16_t qclass, int nolock);
/**
* Find next root hints (to cycle through all root hints).
* Handles its own locking unless nolock is set. In that case the caller
* should lock and unlock a readlock on the hints structure.
* @param hints: hint storage
* @param qclass: class for which root hints are sought.
* 0 means give the first available root hints class.
* x means, give class x or a higher class if any.
* returns the found class in this variable.
* @param nolock: Skip locking, locking is handled by the caller.
* @return true if a root hint class is found.
* false if not root hint class is found (qclass may have been changed).
*/
int hints_next_root(struct iter_hints* hints, uint16_t* qclass);
int hints_next_root(struct iter_hints* hints, uint16_t* qclass, int nolock);
/**
* Given a qname/qclass combination, and the delegation point from the cache
* for this qname/qclass, determine if this combination indicates that a
* stub hint exists and must be primed.
* The return value is contents of the hints structure.
* Caller should lock and unlock a readlock on the hints structure if nolock
* is set.
* Otherwise caller should unlock the readlock on the hints structure if a
* value was returned.
*
* @param hints: hint storage.
* @param qname: The qname that generated the delegation point.
* @param qclass: The qclass that generated the delegation point.
* @param dp: The cache generated delegation point.
* @param nolock: Skip locking, locking is handled by the caller.
* @return: A priming delegation point if there is a stub hint that must
* be primed, otherwise null.
*/
struct iter_hints_stub* hints_lookup_stub(struct iter_hints* hints,
uint8_t* qname, uint16_t qclass, struct delegpt* dp);
struct iter_hints_stub* hints_lookup_stub(struct iter_hints* hints,
uint8_t* qname, uint16_t qclass, struct delegpt* dp, int nolock);
/**
* Get memory in use by hints
* Locks and unlocks the structure.
* @param hints: hint storage.
* @return bytes in use
*/
@@ -139,23 +172,30 @@ size_t hints_get_mem(struct iter_hints* hints);
/**
* Add stub to hints structure. For external use since it recalcs
* the tree parents.
* Handles its own locking unless nolock is set. In that case the caller
* should lock and unlock a writelock on the hints structure.
* @param hints: the hints data structure
* @param c: class of zone
* @param dp: delegation point with name and target nameservers for new
* hints stub. malloced.
* @param noprime: set noprime option to true or false on new hint stub.
* @param nolock: Skip locking, locking is handled by the caller.
* @return false on failure (out of memory);
*/
int hints_add_stub(struct iter_hints* hints, uint16_t c, struct delegpt* dp,
int noprime);
int noprime, int nolock);
/**
* Remove stub from hints structure. For external use since it
* recalcs the tree parents.
* Handles its own locking unless nolock is set. In that case the caller
* should lock and unlock a writelock on the hints structure.
* @param hints: the hints data structure
* @param c: class of stub zone
* @param nm: name of stub zone (in uncompressed wireformat).
* @param nolock: Skip locking, locking is handled by the caller.
*/
void hints_delete_stub(struct iter_hints* hints, uint16_t c, uint8_t* nm);
void hints_delete_stub(struct iter_hints* hints, uint16_t c,
uint8_t* nm, int nolock);
#endif /* ITERATOR_ITER_HINTS_H */
+51 -11
View File
@@ -1284,8 +1284,17 @@ iter_get_next_root(struct iter_hints* hints, struct iter_forwards* fwd,
uint16_t* c)
{
uint16_t c1 = *c, c2 = *c;
int r1 = hints_next_root(hints, &c1);
int r2 = forwards_next_root(fwd, &c2);
int r1, r2;
int nolock = 1;
/* prelock both forwards and hints for atomic read. */
lock_rw_rdlock(&fwd->lock);
lock_rw_rdlock(&hints->lock);
r1 = hints_next_root(hints, &c1, nolock);
r2 = forwards_next_root(fwd, &c2, nolock);
lock_rw_unlock(&fwd->lock);
lock_rw_unlock(&hints->lock);
if(!r1 && !r2) /* got none, end of list */
return 0;
else if(!r1) /* got one, return that */
@@ -1450,15 +1459,21 @@ int iter_dp_cangodown(struct query_info* qinfo, struct delegpt* dp)
int
iter_stub_fwd_no_cache(struct module_qstate *qstate, struct query_info *qinf,
uint8_t** retdpname, size_t* retdpnamelen)
uint8_t** retdpname, size_t* retdpnamelen, uint8_t* dpname_storage,
size_t dpname_storage_len)
{
struct iter_hints_stub *stub;
struct delegpt *dp;
int nolock = 1;
/* Check for stub. */
/* Lock both forwards and hints for atomic read. */
lock_rw_rdlock(&qstate->env->fwds->lock);
lock_rw_rdlock(&qstate->env->hints->lock);
stub = hints_lookup_stub(qstate->env->hints, qinf->qname,
qinf->qclass, NULL);
dp = forwards_lookup(qstate->env->fwds, qinf->qname, qinf->qclass);
qinf->qclass, NULL, nolock);
dp = forwards_lookup(qstate->env->fwds, qinf->qname, qinf->qclass,
nolock);
/* see if forward or stub is more pertinent */
if(stub && stub->dp && dp) {
@@ -1472,7 +1487,9 @@ iter_stub_fwd_no_cache(struct module_qstate *qstate, struct query_info *qinf,
/* check stub */
if (stub != NULL && stub->dp != NULL) {
if(stub->dp->no_cache) {
int stub_no_cache = stub->dp->no_cache;
lock_rw_unlock(&qstate->env->fwds->lock);
if(stub_no_cache) {
char qname[255+1];
char dpname[255+1];
dname_str(qinf->qname, qname);
@@ -1480,15 +1497,27 @@ iter_stub_fwd_no_cache(struct module_qstate *qstate, struct query_info *qinf,
verbose(VERB_ALGO, "stub for %s %s has no_cache", qname, dpname);
}
if(retdpname) {
*retdpname = stub->dp->name;
if(stub->dp->namelen > dpname_storage_len) {
verbose(VERB_ALGO, "no cache stub dpname too long");
lock_rw_unlock(&qstate->env->hints->lock);
*retdpname = NULL;
*retdpnamelen = 0;
return stub_no_cache;
}
memmove(dpname_storage, stub->dp->name,
stub->dp->namelen);
*retdpname = dpname_storage;
*retdpnamelen = stub->dp->namelen;
}
return (stub->dp->no_cache);
lock_rw_unlock(&qstate->env->hints->lock);
return stub_no_cache;
}
/* Check for forward. */
if (dp) {
if(dp->no_cache) {
int dp_no_cache = dp->no_cache;
lock_rw_unlock(&qstate->env->hints->lock);
if(dp_no_cache) {
char qname[255+1];
char dpname[255+1];
dname_str(qinf->qname, qname);
@@ -1496,11 +1525,22 @@ iter_stub_fwd_no_cache(struct module_qstate *qstate, struct query_info *qinf,
verbose(VERB_ALGO, "forward for %s %s has no_cache", qname, dpname);
}
if(retdpname) {
*retdpname = dp->name;
if(dp->namelen > dpname_storage_len) {
verbose(VERB_ALGO, "no cache dpname too long");
lock_rw_unlock(&qstate->env->fwds->lock);
*retdpname = NULL;
*retdpnamelen = 0;
return dp_no_cache;
}
memmove(dpname_storage, dp->name, dp->namelen);
*retdpname = dpname_storage;
*retdpnamelen = dp->namelen;
}
return (dp->no_cache);
lock_rw_unlock(&qstate->env->fwds->lock);
return dp_no_cache;
}
lock_rw_unlock(&qstate->env->fwds->lock);
lock_rw_unlock(&qstate->env->hints->lock);
if(retdpname) {
*retdpname = NULL;
*retdpnamelen = 0;
+5 -1
View File
@@ -407,10 +407,14 @@ int iter_dp_cangodown(struct query_info* qinfo, struct delegpt* dp);
* Used for NXDOMAIN checks, above that it is an nxdomain from a
* different server and zone. You can pass NULL to not get it.
* @param retdpnamelen: returns the length of the dpname.
* @param dpname_storage: this is where the dpname buf is stored, if any.
* So that caller can manage the buffer.
* @param dpname_storage_len: size of dpname_storage buffer.
* @return true if no_cache is set in stub or fwd.
*/
int iter_stub_fwd_no_cache(struct module_qstate *qstate,
struct query_info *qinf, uint8_t** retdpname, size_t* retdpnamelen);
struct query_info *qinf, uint8_t** retdpname, size_t* retdpnamelen,
uint8_t* dpname_storage, size_t dpname_storage_len);
/**
* Set support for IP4 and IP6 depending on outgoing interfaces
+203 -92
View File
@@ -52,6 +52,7 @@
#include "iterator/iter_priv.h"
#include "validator/val_neg.h"
#include "services/cache/dns.h"
#include "services/cache/rrset.h"
#include "services/cache/infra.h"
#include "services/authzone.h"
#include "util/module.h"
@@ -678,30 +679,40 @@ errinf_reply(struct module_qstate* qstate, struct iter_qstate* iq)
/** see if last resort is possible - does config allow queries to parent */
static int
can_have_last_resort(struct module_env* env, uint8_t* nm, size_t nmlen,
uint16_t qclass, struct delegpt** retdp)
can_have_last_resort(struct module_env* env, uint8_t* nm, size_t ATTR_UNUSED(nmlen),
uint16_t qclass, int* have_dp, struct delegpt** retdp,
struct regional* region)
{
struct delegpt* fwddp;
struct iter_hints_stub* stub;
int labs = dname_count_labels(nm);
struct delegpt* dp = NULL;
int nolock = 0;
/* do not process a last resort (the parent side) if a stub
* or forward is configured, because we do not want to go 'above'
* the configured servers */
if(!dname_is_root(nm) && (stub = (struct iter_hints_stub*)
name_tree_find(&env->hints->tree, nm, nmlen, labs, qclass)) &&
if(!dname_is_root(nm) &&
(dp = hints_find(env->hints, nm, qclass, nolock)) &&
/* has_parent side is turned off for stub_first, where we
* are allowed to go to the parent */
stub->dp->has_parent_side_NS) {
if(retdp) *retdp = stub->dp;
dp->has_parent_side_NS) {
if(retdp) *retdp = delegpt_copy(dp, region);
lock_rw_unlock(&env->hints->lock);
if(have_dp) *have_dp = 1;
return 0;
}
if((fwddp = forwards_find(env->fwds, nm, qclass)) &&
if(dp) {
lock_rw_unlock(&env->hints->lock);
dp = NULL;
}
if((dp = forwards_find(env->fwds, nm, qclass, nolock)) &&
/* has_parent_side is turned off for forward_first, where
* we are allowed to go to the parent */
fwddp->has_parent_side_NS) {
if(retdp) *retdp = fwddp;
dp->has_parent_side_NS) {
if(retdp) *retdp = delegpt_copy(dp, region);
lock_rw_unlock(&env->fwds->lock);
if(have_dp) *have_dp = 1;
return 0;
}
/* lock_() calls are macros that could be nothing, surround in {} */
if(dp) { lock_rw_unlock(&env->fwds->lock); }
return 1;
}
@@ -877,10 +888,11 @@ prime_root(struct module_qstate* qstate, struct iter_qstate* iq, int id,
{
struct delegpt* dp;
struct module_qstate* subq;
int nolock = 0;
verbose(VERB_DETAIL, "priming . %s NS",
sldns_lookup_by_id(sldns_rr_classes, (int)qclass)?
sldns_lookup_by_id(sldns_rr_classes, (int)qclass)->name:"??");
dp = hints_lookup_root(qstate->env->hints, qclass);
dp = hints_find_root(qstate->env->hints, qclass, nolock);
if(!dp) {
verbose(VERB_ALGO, "Cannot prime due to lack of hints");
return 0;
@@ -890,6 +902,7 @@ prime_root(struct module_qstate* qstate, struct iter_qstate* iq, int id,
if(!generate_sub_request((uint8_t*)"\000", 1, LDNS_RR_TYPE_NS,
qclass, qstate, id, iq, QUERYTARGETS_STATE, PRIME_RESP_STATE,
&subq, 0, 0)) {
lock_rw_unlock(&qstate->env->hints->lock);
verbose(VERB_ALGO, "could not prime root");
return 0;
}
@@ -900,6 +913,7 @@ prime_root(struct module_qstate* qstate, struct iter_qstate* iq, int id,
* copy dp, it is now part of the root prime query.
* dp was part of in the fixed hints structure. */
subiq->dp = delegpt_copy(dp, subq->region);
lock_rw_unlock(&qstate->env->hints->lock);
if(!subiq->dp) {
log_err("out of memory priming root, copydp");
fptr_ok(fptr_whitelist_modenv_kill_sub(
@@ -911,6 +925,8 @@ prime_root(struct module_qstate* qstate, struct iter_qstate* iq, int id,
subiq->num_target_queries = 0;
subiq->dnssec_expected = iter_indicates_dnssec(
qstate->env, subiq->dp, NULL, subq->qinfo.qclass);
} else {
lock_rw_unlock(&qstate->env->hints->lock);
}
/* this module stops, our submodule starts, and does the query. */
@@ -941,18 +957,21 @@ prime_stub(struct module_qstate* qstate, struct iter_qstate* iq, int id,
struct iter_hints_stub* stub;
struct delegpt* stub_dp;
struct module_qstate* subq;
int nolock = 0;
if(!qname) return 0;
stub = hints_lookup_stub(qstate->env->hints, qname, qclass, iq->dp);
stub = hints_lookup_stub(qstate->env->hints, qname, qclass, iq->dp,
nolock);
/* The stub (if there is one) does not need priming. */
if(!stub)
return 0;
if(!stub) return 0;
stub_dp = stub->dp;
/* if we have an auth_zone dp, and stub is equal, don't prime stub
* yet, unless we want to fallback and avoid the auth_zone */
if(!iq->auth_zone_avoid && iq->dp && iq->dp->auth_dp &&
query_dname_compare(iq->dp->name, stub_dp->name) == 0)
query_dname_compare(iq->dp->name, stub_dp->name) == 0) {
lock_rw_unlock(&qstate->env->hints->lock);
return 0;
}
/* is it a noprime stub (always use) */
if(stub->noprime) {
@@ -961,13 +980,14 @@ prime_stub(struct module_qstate* qstate, struct iter_qstate* iq, int id,
/* copy the dp out of the fixed hints structure, so that
* it can be changed when servicing this query */
iq->dp = delegpt_copy(stub_dp, qstate->region);
lock_rw_unlock(&qstate->env->hints->lock);
if(!iq->dp) {
log_err("out of memory priming stub");
errinf(qstate, "malloc failure, priming stub");
(void)error_response(qstate, id, LDNS_RCODE_SERVFAIL);
return 1; /* return 1 to make module stop, with error */
}
log_nametypeclass(VERB_DETAIL, "use stub", stub_dp->name,
log_nametypeclass(VERB_DETAIL, "use stub", iq->dp->name,
LDNS_RR_TYPE_NS, qclass);
return r;
}
@@ -981,6 +1001,7 @@ prime_stub(struct module_qstate* qstate, struct iter_qstate* iq, int id,
if(!generate_sub_request(stub_dp->name, stub_dp->namelen,
LDNS_RR_TYPE_NS, qclass, qstate, id, iq,
QUERYTARGETS_STATE, PRIME_RESP_STATE, &subq, 0, 0)) {
lock_rw_unlock(&qstate->env->hints->lock);
verbose(VERB_ALGO, "could not prime stub");
errinf(qstate, "could not generate lookup for stub prime");
(void)error_response(qstate, id, LDNS_RCODE_SERVFAIL);
@@ -993,6 +1014,7 @@ prime_stub(struct module_qstate* qstate, struct iter_qstate* iq, int id,
/* Set the initial delegation point to the hint. */
/* make copy to avoid use of stub dp by different qs/threads */
subiq->dp = delegpt_copy(stub_dp, subq->region);
lock_rw_unlock(&qstate->env->hints->lock);
if(!subiq->dp) {
log_err("out of memory priming stub, copydp");
fptr_ok(fptr_whitelist_modenv_kill_sub(
@@ -1009,6 +1031,8 @@ prime_stub(struct module_qstate* qstate, struct iter_qstate* iq, int id,
subiq->wait_priming_stub = 1;
subiq->dnssec_expected = iter_indicates_dnssec(
qstate->env, subiq->dp, NULL, subq->qinfo.qclass);
} else {
lock_rw_unlock(&qstate->env->hints->lock);
}
/* this module stops, our submodule starts, and does the query. */
@@ -1181,7 +1205,7 @@ generate_ns_check(struct module_qstate* qstate, struct iter_qstate* iq, int id)
if(iq->depth == ie->max_dependency_depth)
return;
if(!can_have_last_resort(qstate->env, iq->dp->name, iq->dp->namelen,
iq->qchase.qclass, NULL))
iq->qchase.qclass, NULL, NULL, NULL))
return;
/* is this query the same as the nscheck? */
if(qstate->qinfo.qtype == LDNS_RR_TYPE_NS &&
@@ -1294,6 +1318,7 @@ forward_request(struct module_qstate* qstate, struct iter_qstate* iq)
struct delegpt* dp;
uint8_t* delname = iq->qchase.qname;
size_t delnamelen = iq->qchase.qname_len;
int nolock = 0;
if(iq->refetch_glue && iq->dp) {
delname = iq->dp->name;
delnamelen = iq->dp->namelen;
@@ -1302,12 +1327,13 @@ forward_request(struct module_qstate* qstate, struct iter_qstate* iq)
if( (iq->qchase.qtype == LDNS_RR_TYPE_DS || iq->refetch_glue)
&& !dname_is_root(iq->qchase.qname))
dname_remove_label(&delname, &delnamelen);
dp = forwards_lookup(qstate->env->fwds, delname, iq->qchase.qclass);
if(!dp)
return 0;
dp = forwards_lookup(qstate->env->fwds, delname, iq->qchase.qclass,
nolock);
if(!dp) return 0;
/* send recursion desired to forward addr */
iq->chase_flags |= BIT_RD;
iq->dp = delegpt_copy(dp, qstate->region);
lock_rw_unlock(&qstate->env->fwds->lock);
/* iq->dp checked by caller */
verbose(VERB_ALGO, "forwarding request");
return 1;
@@ -1335,6 +1361,7 @@ static int
processInitRequest(struct module_qstate* qstate, struct iter_qstate* iq,
struct iter_env* ie, int id)
{
uint8_t dpname_storage[LDNS_MAX_DOMAINLEN+1];
uint8_t* delname, *dpname=NULL;
size_t delnamelen, dpnamelen=0;
struct dns_msg* msg = NULL;
@@ -1381,7 +1408,7 @@ processInitRequest(struct module_qstate* qstate, struct iter_qstate* iq,
if (iq->refetch_glue &&
iq->dp &&
!can_have_last_resort(qstate->env, iq->dp->name,
iq->dp->namelen, iq->qchase.qclass, NULL)) {
iq->dp->namelen, iq->qchase.qclass, NULL, NULL, NULL)) {
iq->refetch_glue = 0;
}
@@ -1389,8 +1416,61 @@ processInitRequest(struct module_qstate* qstate, struct iter_qstate* iq,
/* This either results in a query restart (CNAME cache response), a
* terminating response (ANSWER), or a cache miss (null). */
if (iter_stub_fwd_no_cache(qstate, &iq->qchase, &dpname, &dpnamelen)) {
/* Check RPZ for override */
if(qstate->env->auth_zones) {
/* apply rpz qname triggers, like after cname */
struct dns_msg* forged_response =
rpz_callback_from_iterator_cname(qstate, iq);
if(forged_response) {
uint8_t* sname = 0;
size_t slen = 0;
int count = 0;
while(forged_response && reply_find_rrset_section_an(
forged_response->rep, iq->qchase.qname,
iq->qchase.qname_len, LDNS_RR_TYPE_CNAME,
iq->qchase.qclass) &&
iq->qchase.qtype != LDNS_RR_TYPE_CNAME &&
count++ < ie->max_query_restarts) {
/* another cname to follow */
if(!handle_cname_response(qstate, iq, forged_response,
&sname, &slen)) {
errinf(qstate, "malloc failure, CNAME info");
return error_response(qstate, id, LDNS_RCODE_SERVFAIL);
}
iq->qchase.qname = sname;
iq->qchase.qname_len = slen;
forged_response =
rpz_callback_from_iterator_cname(qstate, iq);
}
if(forged_response != NULL) {
qstate->ext_state[id] = module_finished;
qstate->return_rcode = LDNS_RCODE_NOERROR;
qstate->return_msg = forged_response;
iq->response = forged_response;
next_state(iq, FINISHED_STATE);
if(!iter_prepend(iq, qstate->return_msg, qstate->region)) {
log_err("rpz: after cached cname, prepend rrsets: out of memory");
return error_response(qstate, id, LDNS_RCODE_SERVFAIL);
}
qstate->return_msg->qinfo = qstate->qinfo;
return 0;
}
/* Follow the CNAME response */
iq->dp = NULL;
iq->refetch_glue = 0;
iq->query_restart_count++;
iq->sent_count = 0;
iq->dp_target_count = 0;
sock_list_insert(&qstate->reply_origin, NULL, 0, qstate->region);
if(qstate->env->cfg->qname_minimisation)
iq->minimisation_state = INIT_MINIMISE_STATE;
return next_state(iq, INIT_REQUEST_STATE);
}
}
if (iter_stub_fwd_no_cache(qstate, &iq->qchase, &dpname, &dpnamelen,
dpname_storage, sizeof(dpname_storage))) {
/* Asked to not query cache. */
verbose(VERB_ALGO, "no-cache set, going to the network");
qstate->no_cache_lookup = 1;
@@ -1449,39 +1529,6 @@ processInitRequest(struct module_qstate* qstate, struct iter_qstate* iq,
}
iq->qchase.qname = sname;
iq->qchase.qname_len = slen;
if(qstate->env->auth_zones) {
/* apply rpz qname triggers after cname */
struct dns_msg* forged_response =
rpz_callback_from_iterator_cname(qstate, iq);
while(forged_response && reply_find_rrset_section_an(
forged_response->rep, iq->qchase.qname,
iq->qchase.qname_len, LDNS_RR_TYPE_CNAME,
iq->qchase.qclass)) {
/* another cname to follow */
if(!handle_cname_response(qstate, iq, forged_response,
&sname, &slen)) {
errinf(qstate, "malloc failure, CNAME info");
return error_response(qstate, id, LDNS_RCODE_SERVFAIL);
}
iq->qchase.qname = sname;
iq->qchase.qname_len = slen;
forged_response =
rpz_callback_from_iterator_cname(qstate, iq);
}
if(forged_response != NULL) {
qstate->ext_state[id] = module_finished;
qstate->return_rcode = LDNS_RCODE_NOERROR;
qstate->return_msg = forged_response;
iq->response = forged_response;
next_state(iq, FINISHED_STATE);
if(!iter_prepend(iq, qstate->return_msg, qstate->region)) {
log_err("rpz: after cached cname, prepend rrsets: out of memory");
return error_response(qstate, id, LDNS_RCODE_SERVFAIL);
}
qstate->return_msg->qinfo = qstate->qinfo;
return 0;
}
}
/* This *is* a query restart, even if it is a cheap
* one. */
iq->dp = NULL;
@@ -1494,7 +1541,6 @@ processInitRequest(struct module_qstate* qstate, struct iter_qstate* iq,
iq->minimisation_state = INIT_MINIMISE_STATE;
return next_state(iq, INIT_REQUEST_STATE);
}
/* if from cache, NULL, else insert 'cache IP' len=0 */
if(qstate->reply_origin)
sock_list_insert(&qstate->reply_origin, NULL, 0, qstate->region);
@@ -1555,7 +1601,7 @@ processInitRequest(struct module_qstate* qstate, struct iter_qstate* iq,
}
if(iq->qchase.qtype == LDNS_RR_TYPE_DS || iq->refetch_glue ||
(iq->qchase.qtype == LDNS_RR_TYPE_NS && qstate->prefetch_leeway
&& can_have_last_resort(qstate->env, delname, delnamelen, iq->qchase.qclass, NULL))) {
&& can_have_last_resort(qstate->env, delname, delnamelen, iq->qchase.qclass, NULL, NULL, NULL))) {
/* remove first label from delname, root goes to hints,
* but only to fetch glue, not for qtype=DS. */
/* also when prefetching an NS record, fetch it again from
@@ -1584,6 +1630,7 @@ processInitRequest(struct module_qstate* qstate, struct iter_qstate* iq,
* root priming situation. */
if(iq->dp == NULL) {
int r;
int nolock = 0;
/* if under auth zone, no prime needed */
if(!auth_zone_delegpt(qstate, iq, delname, delnamelen))
return error_response(qstate, id,
@@ -1597,12 +1644,13 @@ processInitRequest(struct module_qstate* qstate, struct iter_qstate* iq,
break; /* got noprime-stub-zone, continue */
else if(r)
return 0; /* stub prime request made */
if(forwards_lookup_root(qstate->env->fwds,
iq->qchase.qclass)) {
if(forwards_lookup_root(qstate->env->fwds,
iq->qchase.qclass, nolock)) {
lock_rw_unlock(&qstate->env->fwds->lock);
/* forward zone root, no root prime needed */
/* fill in some dp - safety belt */
iq->dp = hints_lookup_root(qstate->env->hints,
iq->qchase.qclass);
iq->dp = hints_find_root(qstate->env->hints,
iq->qchase.qclass, nolock);
if(!iq->dp) {
log_err("internal error: no hints dp");
errinf(qstate, "no hints for this class");
@@ -1610,6 +1658,7 @@ processInitRequest(struct module_qstate* qstate, struct iter_qstate* iq,
LDNS_RCODE_SERVFAIL);
}
iq->dp = delegpt_copy(iq->dp, qstate->region);
lock_rw_unlock(&qstate->env->hints->lock);
if(!iq->dp) {
log_err("out of memory in safety belt");
errinf(qstate, "malloc failure, in safety belt");
@@ -1649,15 +1698,13 @@ processInitRequest(struct module_qstate* qstate, struct iter_qstate* iq,
if(iter_dp_is_useless(&qstate->qinfo, qstate->query_flags,
iq->dp, ie->supports_ipv4, ie->supports_ipv6,
ie->use_nat64)) {
struct delegpt* retdp = NULL;
if(!can_have_last_resort(qstate->env, iq->dp->name, iq->dp->namelen, iq->qchase.qclass, &retdp)) {
if(retdp) {
int have_dp = 0;
if(!can_have_last_resort(qstate->env, iq->dp->name, iq->dp->namelen, iq->qchase.qclass, &have_dp, &iq->dp, qstate->region)) {
if(have_dp) {
verbose(VERB_QUERY, "cache has stub "
"or fwd but no addresses, "
"fallback to config");
iq->dp = delegpt_copy(retdp,
qstate->region);
if(!iq->dp) {
if(have_dp && !iq->dp) {
log_err("out of memory in "
"stub/fwd fallback");
errinf(qstate, "malloc failure, for fallback to config");
@@ -1677,10 +1724,11 @@ processInitRequest(struct module_qstate* qstate, struct iter_qstate* iq,
}
if(dname_is_root(iq->dp->name)) {
/* use safety belt */
int nolock = 0;
verbose(VERB_QUERY, "Cache has root NS but "
"no addresses. Fallback to the safety belt.");
iq->dp = hints_lookup_root(qstate->env->hints,
iq->qchase.qclass);
iq->dp = hints_find_root(qstate->env->hints,
iq->qchase.qclass, nolock);
/* note deleg_msg is from previous lookup,
* but RD is on, so it is not used */
if(!iq->dp) {
@@ -1689,6 +1737,7 @@ processInitRequest(struct module_qstate* qstate, struct iter_qstate* iq,
LDNS_RCODE_REFUSED);
}
iq->dp = delegpt_copy(iq->dp, qstate->region);
lock_rw_unlock(&qstate->env->hints->lock);
if(!iq->dp) {
log_err("out of memory in safety belt");
errinf(qstate, "malloc failure, in safety belt, for root");
@@ -1744,6 +1793,7 @@ processInitRequest2(struct module_qstate* qstate, struct iter_qstate* iq,
delnamelen = iq->qchase.qname_len;
if(iq->refetch_glue) {
struct iter_hints_stub* stub;
int nolock = 0;
if(!iq->dp) {
log_err("internal or malloc fail: no dp for refetch");
errinf(qstate, "malloc failure, no delegation info");
@@ -1753,12 +1803,14 @@ processInitRequest2(struct module_qstate* qstate, struct iter_qstate* iq,
* this is above stub without stub-first. */
stub = hints_lookup_stub(
qstate->env->hints, iq->qchase.qname, iq->qchase.qclass,
iq->dp);
iq->dp, nolock);
if(!stub || !stub->dp->has_parent_side_NS ||
dname_subdomain_c(iq->dp->name, stub->dp->name)) {
delname = iq->dp->name;
delnamelen = iq->dp->namelen;
}
/* lock_() calls are macros that could be nothing, surround in {} */
if(stub) { lock_rw_unlock(&qstate->env->hints->lock); }
}
if(iq->qchase.qtype == LDNS_RR_TYPE_DS || iq->refetch_glue) {
if(!dname_is_root(delname))
@@ -2062,7 +2114,7 @@ processLastResort(struct module_qstate* qstate, struct iter_qstate* iq,
log_assert(iq->dp);
if(!can_have_last_resort(qstate->env, iq->dp->name, iq->dp->namelen,
iq->qchase.qclass, NULL)) {
iq->qchase.qclass, NULL, NULL, NULL)) {
/* fail -- no more targets, no more hope of targets, no hope
* of a response. */
errinf(qstate, "all the configured stub or forward servers failed,");
@@ -2072,21 +2124,24 @@ processLastResort(struct module_qstate* qstate, struct iter_qstate* iq,
return error_response_cache(qstate, id, LDNS_RCODE_SERVFAIL);
}
if(!iq->dp->has_parent_side_NS && dname_is_root(iq->dp->name)) {
struct delegpt* p = hints_lookup_root(qstate->env->hints,
iq->qchase.qclass);
if(p) {
struct delegpt* dp;
int nolock = 0;
dp = hints_find_root(qstate->env->hints,
iq->qchase.qclass, nolock);
if(dp) {
struct delegpt_addr* a;
iq->chase_flags &= ~BIT_RD; /* go to authorities */
for(ns = p->nslist; ns; ns=ns->next) {
for(ns = dp->nslist; ns; ns=ns->next) {
(void)delegpt_add_ns(iq->dp, qstate->region,
ns->name, ns->lame, ns->tls_auth_name,
ns->port);
}
for(a = p->target_list; a; a=a->next_target) {
for(a = dp->target_list; a; a=a->next_target) {
(void)delegpt_add_addr(iq->dp, qstate->region,
&a->addr, a->addrlen, a->bogus,
a->lame, a->tls_auth_name, -1, NULL);
}
lock_rw_unlock(&qstate->env->hints->lock);
}
iq->dp->has_parent_side_NS = 1;
} else if(!iq->dp->has_parent_side_NS) {
@@ -2164,7 +2219,7 @@ processLastResort(struct module_qstate* qstate, struct iter_qstate* iq,
if( ((ie->supports_ipv6 && !ns->done_pside6) ||
((ie->supports_ipv4 || ie->use_nat64) && !ns->done_pside4)) &&
!can_have_last_resort(qstate->env, ns->name, ns->namelen,
iq->qchase.qclass, NULL)) {
iq->qchase.qclass, NULL, NULL, NULL)) {
log_nametypeclass(VERB_ALGO, "cannot pside lookup ns "
"because it is also a stub/forward,",
ns->name, LDNS_RR_TYPE_NS, iq->qchase.qclass);
@@ -2746,8 +2801,51 @@ processQueryTargets(struct module_qstate* qstate, struct iter_qstate* iq,
delegpt_add_unused_targets(iq->dp);
if(qstate->env->auth_zones) {
/* apply rpz triggers at query time */
uint8_t* sname = NULL;
size_t snamelen = 0;
/* apply rpz triggers at query time; nameserver IP and dname */
struct dns_msg* forged_response_after_cname;
struct dns_msg* forged_response = rpz_callback_from_iterator_module(qstate, iq);
int count = 0;
while(forged_response && reply_find_rrset_section_an(
forged_response->rep, iq->qchase.qname,
iq->qchase.qname_len, LDNS_RR_TYPE_CNAME,
iq->qchase.qclass) &&
iq->qchase.qtype != LDNS_RR_TYPE_CNAME &&
count++ < ie->max_query_restarts) {
/* another cname to follow */
if(!handle_cname_response(qstate, iq, forged_response,
&sname, &snamelen)) {
errinf(qstate, "malloc failure, CNAME info");
return error_response(qstate, id, LDNS_RCODE_SERVFAIL);
}
iq->qchase.qname = sname;
iq->qchase.qname_len = snamelen;
forged_response_after_cname =
rpz_callback_from_iterator_cname(qstate, iq);
if(forged_response_after_cname) {
forged_response = forged_response_after_cname;
} else {
/* Follow the CNAME with a query restart */
iq->deleg_msg = NULL;
iq->dp = NULL;
iq->dsns_point = NULL;
iq->auth_zone_response = 0;
iq->refetch_glue = 0;
iq->query_restart_count++;
iq->sent_count = 0;
iq->dp_target_count = 0;
if(qstate->env->cfg->qname_minimisation)
iq->minimisation_state = INIT_MINIMISE_STATE;
outbound_list_clear(&iq->outlist);
iq->num_current_queries = 0;
fptr_ok(fptr_whitelist_modenv_detach_subs(
qstate->env->detach_subs));
(*qstate->env->detach_subs)(qstate);
iq->num_target_queries = 0;
return next_state(iq, INIT_REQUEST_STATE);
}
}
if(forged_response != NULL) {
qstate->ext_state[id] = module_finished;
qstate->return_rcode = LDNS_RCODE_NOERROR;
@@ -3082,7 +3180,8 @@ processQueryResponse(struct module_qstate* qstate, struct iter_qstate* iq,
/* DNAME to a subdomain loop; do not recurse */
type = RESPONSE_TYPE_ANSWER;
}
} else if(type == RESPONSE_TYPE_CNAME &&
}
if(type == RESPONSE_TYPE_CNAME &&
iq->qchase.qtype == LDNS_RR_TYPE_CNAME &&
iq->minimisation_state == MINIMISE_STATE &&
query_dname_compare(iq->qchase.qname, iq->qinfo_out.qname) == 0) {
@@ -3193,6 +3292,7 @@ processQueryResponse(struct module_qstate* qstate, struct iter_qstate* iq,
}
return final_state(iq);
} else if(type == RESPONSE_TYPE_REFERRAL) {
struct delegpt* old_dp = NULL;
/* REFERRAL type responses get a reset of the
* delegation point, and back to the QUERYTARGETS_STATE. */
verbose(VERB_DETAIL, "query response was REFERRAL");
@@ -3244,6 +3344,8 @@ processQueryResponse(struct module_qstate* qstate, struct iter_qstate* iq,
/* Reset the event state, setting the current delegation
* point to the referral. */
iq->deleg_msg = iq->response;
/* Keep current delegation point for label comparison */
old_dp = iq->dp;
iq->dp = delegpt_from_message(iq->response, qstate->region);
if (qstate->env->cfg->qname_minimisation)
iq->minimisation_state = INIT_MINIMISE_STATE;
@@ -3251,6 +3353,20 @@ processQueryResponse(struct module_qstate* qstate, struct iter_qstate* iq,
errinf(qstate, "malloc failure, for delegation point");
return error_response(qstate, id, LDNS_RCODE_SERVFAIL);
}
if(old_dp->namelabs + 1 < iq->dp->namelabs) {
/* We got a grandchild delegation (more than one label
* difference) than expected. Check for in-between
* delegations in the cache and remove them.
* They could prove problematic when they expire
* and rrset_expired_above() encounters them during
* delegation cache lookups. */
uint8_t* qname = iq->dp->name;
size_t qnamelen = iq->dp->namelen;
rrset_cache_remove_above(qstate->env->rrset_cache,
&qname, &qnamelen, LDNS_RR_TYPE_NS,
iq->qchase.qclass, *qstate->env->now,
old_dp->name, old_dp->namelen);
}
if(!cache_fill_missing(qstate->env, iq->qchase.qclass,
qstate->region, iq->dp)) {
errinf(qstate, "malloc failure, copy extra info into delegation point");
@@ -3341,10 +3457,13 @@ processQueryResponse(struct module_qstate* qstate, struct iter_qstate* iq,
/* apply rpz qname triggers after cname */
struct dns_msg* forged_response =
rpz_callback_from_iterator_cname(qstate, iq);
int count = 0;
while(forged_response && reply_find_rrset_section_an(
forged_response->rep, iq->qchase.qname,
iq->qchase.qname_len, LDNS_RR_TYPE_CNAME,
iq->qchase.qclass)) {
iq->qchase.qclass) &&
iq->qchase.qtype != LDNS_RR_TYPE_CNAME &&
count++ < ie->max_query_restarts) {
/* another cname to follow */
if(!handle_cname_response(qstate, iq, forged_response,
&sname, &snamelen)) {
@@ -3926,17 +4045,9 @@ processFinished(struct module_qstate* qstate, struct iter_qstate* iq,
!qstate->env->cfg->val_log_squelch) {
char* err_str = errinf_to_str_misc(qstate);
if(err_str) {
size_t err_str_len = strlen(err_str);
verbose(VERB_ALGO, "iterator EDE: %s", err_str);
/* allocate space and store the error
* string */
iq->response->rep->reason_bogus_str = regional_alloc(
qstate->region,
sizeof(char) * (err_str_len+1));
memcpy(iq->response->rep->reason_bogus_str,
err_str, err_str_len+1);
iq->response->rep->reason_bogus_str = err_str;
}
free(err_str);
}
/* we have finished processing this query */
+8
View File
@@ -53,6 +53,8 @@
#include "util/storage/slabhash.h"
#include "util/edns.h"
#include "sldns/sbuffer.h"
#include "iterator/iter_fwd.h"
#include "iterator/iter_hints.h"
int
context_finalize(struct ub_ctx* ctx)
@@ -85,6 +87,12 @@ context_finalize(struct ub_ctx* ctx)
if(!auth_zones_apply_cfg(ctx->env->auth_zones, cfg, 1, &is_rpz,
ctx->env, &ctx->mods))
return UB_INITFAIL;
if(!(ctx->env->fwds = forwards_create()) ||
!forwards_apply_cfg(ctx->env->fwds, cfg))
return UB_INITFAIL;
if(!(ctx->env->hints = hints_create()) ||
!hints_apply_cfg(ctx->env->hints, cfg))
return UB_INITFAIL;
if(!edns_strings_apply_cfg(ctx->env->edns_strings, cfg))
return UB_INITFAIL;
if(!slabhash_is_size(ctx->env->msg_cache, cfg->msg_cache_size,
Loaded 100 of 464 files, more files were not shown because too many files have changed in this diff. Show more