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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.