2811 Commits
Author SHA1 Message Date
Julius Pfrommer 830ba0976d fix(client): detach subscription heads before reentrant cleanup
Separate disposal from list removal so bulk cleanup updates the live list head explicitly before invoking callbacks. Cover recursive cleanup across two subscriptions and use the existing synchronized server pause helpers in the notification regression.
2026-10-28 19:42:09 +01:00
Julius Pfrommer bec490a60c test(pubsub): expect the validated connection address error 2026-10-28 19:42:09 +01:00
Julius Pfrommer f0d40a16db test(pubsub): expect empty targets before an accepted message 2026-10-28 17:51:44 +01:00
Julius Pfrommer 5bde0ea466 Merge origin/1.5 into master
Adapt the 1.5 fixes to master's discovery, alarms and conditions, session, and nodeset-loader architecture. Preserve master behavior and combine PubSub replay protection with authenticated key rollover. Enable allocation-failure regression coverage and retain both branches' relevant tests.
2026-10-28 17:37:05 +01:00
Julius Pfrommer 2d3186d30f fix(compiler): preserve XML values and their source namespace mappings 2026-10-28 17:04:47 +01:00
Julius Pfrommer 10a0beaea4 fix(compiler): parse namespace tables and identifiers without data loss 2026-10-28 17:04:47 +01:00
Julius Pfrommer c201d96dc6 fix(encoding): preserve namespace mappings and custom binary XML types 2026-10-28 17:04:47 +01:00
Julius Pfrommer 2d43e9bfbd fix(server): resolve simple datatype aliases in structure descriptions 2026-10-28 17:04:47 +01:00
Julius Pfrommer a31b56afef fix(types): preserve signed enums and support disabled type descriptions 2026-10-28 17:04:47 +01:00
Julius Pfrommer 15b8ec0d5c fix(types): align reconstructed unions with native C layouts 2026-10-28 17:04:47 +01:00
Julius Pfrommer 3377e56591 fix(types): clean up datatype copies and descriptions on allocation failures 2026-10-28 17:04:47 +01:00
Bastian Engel 9a2029277d feat(discovery): announce registered servers by default
announceRegisteredServers was false unless set explicitly. Before the
option existed, every registered server was announced when mDNS was
enabled. And an LDS-ME announces all applications that it knows about
(OPC 10000-12, 5.1). The option only has an effect if registered
servers and ServerOnNetwork entries are enabled and an mDNS driver
announces. That is, if the server is an LDS-ME.

The default config sets the option to true. Turning it off remains
possible, for example if the registered servers announce themselves.
2026-10-28 11:04:44 +01:00
Bastian Engel 883bb016bf fix(discovery): keep the ServerOnNetwork entries of registered servers
A registered server can also announce itself over mDNS. The received
information then replaced the entry of the registration, and the expiry
of the received information removed it. Also, a registration did not
update an entry with the same content that was received before. So the
entry stayed unmarked for the announcement.

This commit rejects changes and removals of the entry of a registered
server through UA_Server_registerServerOnNetwork and
UA_Server_deregisterServerOnNetwork. A registration leaves an unchanged
entry alone only if the entry is its own and announceRegisteredServers
did not change since.
2026-10-28 11:04:44 +01:00
Bastian Engel 16d9f059d7 fix(discovery): announce only marked ServerOnNetwork entries over mDNS
The mDNS drivers announced every ServerOnNetwork entry that differed
from their cache of received records. An entry that was received first
and then added locally with the same content was never announced, and
an entry could not be removed from the announcement without removing
it from FindServersOnNetwork.

This commit makes the drivers follow the 0:announce flag of the
notifications. Entries without the flag are not announced, and an entry
that was announced before is retracted. An announced entry takes over a
received one of the same name. The tests that rely on an announcement
set the flag, and the LDS in the tests announces registered servers.
2026-10-28 11:04:44 +01:00
Bastian Engel d0994d2adb feat(discovery): mark ServerOnNetwork entries for announcement
The mDNS drivers announce every ServerOnNetwork entry that differs from
their cache of received records. Whether an entry is announced therefore
depends on its content instead of its origin. An entry that was received
first and then added locally with the same content is never announced.
And every registered server is announced, without a way to turn that
off.

This commit adds the 0:announce parameter to
UA_Server_registerServerOnNetwork and the announceRegisteredServers
config option for the entries of registered servers. The
ServerOnNetwork notifications carry the flag as 0:announce. Entries
without the parameter, such as the received ones, are not marked. The
drivers do not use the flag yet.
2026-10-28 11:04:44 +01:00
Bastian Engel d359379935 fix(tests): do not expect silence from mdnsd in injected PTR tests
mdnsd schedules the probes and publish retries for the records of the
fixture servers with the real clock. Under valgrind, a publish retry of
the LDS goes out while the test iterates the servers, so the checks that
the global send count does not change fail.

Check instead that no server sends a query for the injected service
instance, which is the behavior these tests must reject.
2026-10-28 11:04:44 +01:00
Bastian Engel 6f6da8ebea fix(discovery): keep RecordIds when a server registers unchanged
Registered servers call RegisterServer again periodically. Each call
updated the ServerOnNetwork entry of the registration, and an update
gives new RecordIds to all entries and sets a new LastCounterResetTime.
So a client that pages through FindServersOnNetwork with
StartingRecordId saw the RecordIds change all the time.

This commit leaves the entry alone if the registration did not change
it. A changed entry is updated as before.
2026-10-28 11:04:44 +01:00
Bastian Engel 31dfec903b fix(discovery): announce registered servers only with opc.tcp urls
The ServerOnNetwork entry of a registered server took the first
DiscoveryUrl of the registration. The mDNS drivers announce the entries
with the service name _opcua-tcp, which is for opc.tcp urls only (Part
12, C.3). UA_parseEndpointUrl also accepts other schemas, so an
opc.https url was announced as _opcua-tcp with the https port.

This commit uses the first opc.tcp DiscoveryUrl. A registration without
one gets no entry. The entry is removed if a registration is updated
without an opc.tcp url. The removal of a registration without an opc.tcp
url does not remove an entry of the same name from another source.
2026-10-28 11:04:44 +01:00
Bastian Engel 7676635b08 fix(discovery): default registered server capabilities to NA
A server registered without capabilities got a ServerOnNetwork entry
with an empty capability list. The mDNS drivers announce such a server
with caps=NA (no capability information is available, Part 12, Annex
D), and the entries had NA before the discovery refactoring as well.
FindServersOnNetwork with the NA filter therefore did not find it.

This commit sets the capabilities of the entry to NA if the
registration has none.
2026-10-28 11:04:44 +01:00
Bastian Engel 5d33fc7535 fix(discovery): add ServerOnNetwork entries for registered servers
Since the discovery refactoring in 575e5d97d, the LDS no longer created
ServerOnNetwork entries for servers registered with RegisterServer and
RegisterServer2. FindServersOnNetwork did not list them, and the mDNS
drivers did not announce them.

This commit adds or updates an entry under the mDNS name of the
registration, which is the mdnsServerName from RegisterServer2 or else
the first ServerName. The record stores that name, so that the entry is
removed together with the registration: when the server unregisters,
with UA_Server_deregisterServer, and when the cleanup removes a timed
out registration or one whose semaphore file was deleted. If a server
registers again under a different mDNS name, the entry under the
previous name is removed.
2026-10-28 11:04:44 +01:00
Bastian Engel 044cac0fb2 fix(discovery): reject missing and empty server names in RegisterServer
RegisterServer and RegisterServer2 only checked that some name was
present. A request without ServerNames passed if it carried a
MdnsDiscoveryConfiguration, and an empty mdnsServerName was used as is
instead of falling back to the first ServerName.

This commit rejects requests without ServerNames (Part 4, 7.31), treats
an empty mdnsServerName as not specified so that the first ServerName
is used (Part 4, 7.13.2), and returns Bad_ServerNameMissing if the
resulting name is empty.
2026-10-28 11:04:44 +01:00
Bastian Engel bc4c8dfc07 fix(tests): mDNS discovery tests reject wrong behavior
The mDNS discovery test setup was missing various checks. This caused
the tests to miss a regression in LDS-ME mDNS announcements. This commit
fixes the test fixture as well as the test cases by adding the proper
checks.
2026-10-28 11:04:44 +01:00
Julius Pfrommer fbc5954d35 fix(tests): cast decoded datatype description for GCC compatibility 2026-10-28 10:48:31 +01:00
Julius Pfrommer c25c806121 fix(server): share simple datatype alias resolution with the NodeSet loader 2026-10-28 10:48:31 +01:00
Julius Pfrommer b127e733c9 fix(http): cap accepted connections and incomplete request lifetime
Limit accepted HTTP peers to 100 per listener by default, before the application creates per-peer server state. Give each request an absolute receive deadline based on the configured timeout, so trickled headers or bodies cannot extend an incomplete request indefinitely. Preserve the inactivity timeout for idle keep-alive connections.
2026-10-27 22:34:39 +01:00
Bastian Engel d267d36add fix(tests): build check_discovery_mdnsd with Avahi and without mdnsd
main() reads workerCallbackStatus to fail the run if an mDNS worker
callback failed. The variable and the tests that set it exist only in
the mdnsd part of the file. So with UA_ENABLE_DRIVER_MDNS_AVAHI and
without UA_ENABLE_DRIVER_MDNS_MDNSD the test did not compile.

This commit reads workerCallbackStatus only if mdnsd is enabled.
2026-10-27 22:34:02 +01:00
Bastian Engel 9e92391773 feat(server): include ServerCapabilities in the MdnsDiscoveryConfiguration
Registering via `RegisterServer2` now includes the configured
ServerCapabilities in its `MdnsDiscoveryConfiguration`.
2026-10-27 19:16:48 +01:00
Bastian Engel 585ce3c52b feat(server): configurable Part 12 ServerCapabilities
Part 12 defines ServerCapabilities in the form of short string
identifiers like "NA", "LDS", or "DA". This was not configurable yet and
functions all returned "NA". This commit introduces configurable
ServerCapabilities in the form of a bitmask.
2026-10-27 19:16:48 +01:00
Andreas Ebner 13dd961ea1 fix(build): compile the size-optimised namespace zero configuration (#8637) 2026-10-27 10:29:40 +01:00
Bastian Engel 634edac404 fix(drivers): truncated discovery URL after mDNS reannouncement
Servers reannounce themselves regularly over mDNS. Fixed an issue where
a reannouncement reuses an old string buffer, causing its discovery URL
to get truncated even for same-length values.
2026-10-27 07:36:07 +01:00
Julius Pfrommer 4b70d6a9dc refactor(core): Fold ua_types_encoding_xml.h into ua_types_encoding.h 2026-10-27 07:34:49 +01:00
Julius Pfrommer d7ccea4b8e refactor(core): Fold ua_types_encoding_json.h into ua_types_encoding.h 2026-10-27 07:34:49 +01:00
Julius Pfrommer 2735024fd3 refactor(core): Rename src/ua_types_encoding_binary.h -> src/ua_types_encoding.h 2026-10-27 07:34:49 +01:00
Bastian Engel 42ff860552 fix(server): don't use UA_STRING_STATIC with a non-literal string
Using `UA_STRING_STATIC` with a char pointer instead of a string literal
causes the length to be fixed to 7, truncating longer and lengthening
shorter strings. This happened when setting the BrowseName of custom
data types. This commit includes a fix and two new regression tests
checking check that a server that has custom data types properly serves
long and short BrowseNames.
2026-10-26 22:18:22 +01:00
Bastian Engel 0d0b4f9268 fix(encryption): replace "DER" by "PKCS8" for private keys
Possible private key formats include "PEM", "PFX", or "PKCS8". We
reported "DER" as a supported private key format which is wrong. This
commit adds a test to check only valid key formats are presented and
fixes other tests that used invalid key formats.
2026-10-26 22:17:44 +01:00
Bastian Engel dd1c075b77 feat(server): populate optional ServerConfigurationType properties with values
Some properties of the part 12 ServerConfigurationType are optional. We
create the nodes since they are part of the generated NS0 NodeSet.
Previously, they were not set and read as NULL. This commit fills them
with the correct values.
2026-10-26 22:17:44 +01:00
Niels Beier ced38ccbef feat(client): give up reconnecting once the maximum backoff interval fails 2026-10-26 12:06:23 +01:00
Niels BeierandAndreas Ebner dc57582074 feat(client): back off between reconnects while no SecureChannel opens
Co-authored-by: Andreas Ebner <andreas.ebner@o6-automation.com>
2026-10-26 12:06:23 +01:00
Niels BeierandAndreas Ebner dbfd66ef30 fix(client): refuse session requests until the session is activated
Co-authored-by: Andreas Ebner <andreas.ebner@o6-automation.com>
2026-10-26 12:06:23 +01:00
Niels BeierandAndreas Ebner 9b0af1fbe4 fix(historydata): treat a zero start or end time as unspecified
Co-authored-by: Andreas Ebner <andreas.ebner@o6-automation.com>
2026-10-26 12:06:23 +01:00
Niels BeierandAndreas Ebner 00b5e8cb4a fix(types): follow Part 6 when encoding DateTime and ExpandedNodeId
Co-authored-by: Andreas Ebner <andreas.ebner@o6-automation.com>
2026-10-26 12:06:23 +01:00
Niels BeierandAndreas Ebner d5c20884d9 fix(eventloop): keep a one-shot timer from becoming repeating
Co-authored-by: Andreas Ebner <andreas.ebner@o6-automation.com>
2026-10-26 12:06:23 +01:00
Julius Pfrommer 7e57792d1b fix(util): remove fixed NodeId buffer limit from operand printing
Print NodeIds into the dynamically allocated output instead of a 512-byte temporary buffer in AttributeOperand, SimpleAttributeOperand and ReadValueId printing. Long valid identifiers otherwise return BadEncodingLimitsExceeded and fail the parse/print fuzz round-trip.

Cover long String and ByteString identifiers, including percent and base64 expansion, with six round-trip regressions.
2026-10-22 14:38:20 +02:00
Julius Pfrommer 2499647e6c test: fix allocator-enabled example builds and callback test timeouts
Include stdlib.h explicitly in examples using EXIT_SUCCESS or EXIT_FAILURE. Allocator hooks disable the transitive inclusion through config.h in the alarms coverage build.

Use the existing test-client helper for callback lifetime regressions so client and server share the fake clock and the client has the Valgrind-safe timeout.
2026-10-22 14:17:08 +02:00
Julius Pfrommer e0ec7f1e4a test(history): exercise allocation failures in CI coverage builds
Enable allocator hooks in the alarms coverage configuration and cover history constructor and insertion failures. Include stdlib.h explicitly in tests that use EXIT_SUCCESS and EXIT_FAILURE so the allocator-enabled build compiles without transitive standard-library includes.
2026-10-21 23:07:14 +02:00
Julius Pfrommer d90d30a700 test(client): drive callback lifetime regression deterministically 2026-10-21 22:53:23 +02:00
Julius Pfrommer ac3f42dd27 Merge branch '1.4' into 1.5
Adapt the 1.4 fixes to the 1.5 PubSub, Session, discovery and utility APIs. Preserve per-ReaderGroup authentication, add bounded replay history, harden allocation error paths and widen callback lifetime regression coverage.
2026-10-21 22:53:23 +02:00
Julius Pfrommer 1f1d2b201a fix(pubsub): reject replayed secured messages 2026-10-21 20:23:09 +02:00
Julius Pfrommer 366ad86917 fix(session): bound ClientUserId history 2026-10-21 20:23:09 +02:00
Julius Pfrommer 7225bc4cda fix(discovery): bound registered server records 2026-10-21 20:23:09 +02:00