Commit graph

980 commits

Author SHA1 Message Date
Stefan Kimmer
aef4f0a126 Certificate trigger and directory operations
Implement trigger of certificate and permission expiries using the timed callbacks.

Implement directory operations such that trusted CA can be read.
This implements OS abstraction functions such as opendir and stat.

Signed-off-by: Stefan Kimmer <skimmer@s2e-systems.com>
2020-02-10 11:07:13 +01:00
Jeroen Koekkoek
3de040d21a Add support for musl libc
Based on patch by mauropasse (issue #383).

Signed-off-by: Jeroen Koekkoek <jeroen@koekkoek.nl>
2020-02-06 18:30:24 +01:00
Dennis Potman
59d4d1eb57 Processed review comments: fixed Bincrafters repo name in readme and changed suggested local name for repo
Signed-off-by: Dennis Potman <dennis.potman@adlinktech.com>
2020-02-06 13:18:14 +01:00
Dennis Potman
e4069d79ca Update readme file with info on adding Bintray repository to conan remotes list
Signed-off-by: Dennis Potman <dennis.potman@adlinktech.com>
2020-02-06 13:18:14 +01:00
Dennis Potman
150f20d10c Bugfix in liveliness tests
Some of the liveliness qos tests were not using unique topic names
for the tests for local and remote readers. Re-using the participant
for these 2 tests results in unexpected reader-proxywriter matches
in the latter test. Fixed by adding a sequence number in the topic name.

Signed-off-by: Dennis Potman <dennis.potman@adlinktech.com>
2020-02-04 15:54:56 +01:00
Dennis Potman
02c2753bd7 Fixes in liveliness test lease_duration_zero_or_one
Signed-off-by: Dennis Potman <dennis.potman@adlinktech.com>
2020-01-31 15:07:08 +01:00
Dennis Potman
9410753076 Liveliness local readers
This commit adds support for liveliness QoS when using local readers.
The implementation for (liveliness) expiration of writers used here is
similar to that used with proxy writers, and it also supports the three
liveliness kinds (1) automatic, which is trivial when using a local
reader and writer, (2) manual-by-participant and (3) manual-by-topic.

In addition, these changes and fixes are included in this commit:
- Fixed a bug in heartbeat handling in the reader: for manual-by-
participant writers the lease was not updated on reception of a
heartbeat message with liveliness flag set. This is fixed and a
test-case is added.
- Include the liveliness flag in a heartbeat message to the trace
- Trace all lease renewals, including liveliness leases
- Replaced liveliness changed state 'twitch' by 2 subsequent calls
to the status callback
- Added a test for liveliness duration 0 and 1ns (for both local
and remote readers)

Signed-off-by: Dennis Potman <dennis.potman@adlinktech.com>
2020-01-31 15:07:08 +01:00
Dennis Potman
3b4facbd45 DDS Security built-in Access Control plugin
This commit adds the build-in Access Control plugin that is part of the
DDS Security implementation for Cyclone.

The Access Control Plugin API defines the types and operations necessary
to support an access control mechanism for DDS Domain Participants.

Similar to other builtin plugins, the DDS Security access control plugin
is built as a shared library to allow dynamic library loading on runtime.
This enables DDS participants to use specific plugin implementations with
different configurations.

This commit includes some basic tests for the access control functions.
This initial version of the plugin does not support permissions expiry
(not-valid-after date in permissions configuration).

Signed-off-by: Dennis Potman <dennis.potman@adlinktech.com>

Process review comments for access control plugin

Signed-off-by: Dennis Potman <dennis.potman@adlinktech.com>

Part 2 of processing review changes for access control

Signed-off-by: Dennis Potman <dennis.potman@adlinktech.com>

Add test for topicname dcps, add comment for xml date parser

Signed-off-by: Dennis Potman <dennis.potman@adlinktech.com>

Fixed an bug in leap year count for year 2200, changed the rounding for sub-ns fraction and added an additional overflow test in DDS_Security_parse_xml_date

Signed-off-by: Dennis Potman <dennis.potman@adlinktech.com>
2020-01-23 12:48:47 +01:00
Erik Boasson
68f789d77b Address some spurious Clang static analyzer warnings
Signed-off-by: Erik Boasson <eb@ilities.com>

Fix typo in dlopen_unknown test

Signed-off-by: Dennis Potman <dennis.potman@adlinktech.com>

Signed-off-by: Erik Boasson <eb@ilities.com>
2020-01-23 12:48:47 +01:00
Erik Boasson
bb76798492 Default to a single receive thread on Windows
This works around a termination issue on Windows caused by the process
sometimes being unable to send a packet to itself to wake up a thread
stuck in a blocking read on a socket.

Signed-off-by: Erik Boasson <eb@ilities.com>
2020-01-23 10:20:47 +01:00
Erik Boasson
263d8016b8 Fix macros for testing presence of atomic LIFO
Signed-off-by: Erik Boasson <eb@ilities.com>
2020-01-20 17:05:46 +01:00
Joao Rebelo
97c3025e54 Add timed callback dispatcher to security core
Dispatchers are added to a custom linked list while each dispatcher owns a
fibheap of callbacks that are ordered by expiry timestamp. A seperate
fibheap is use for each dispatcher to allow disabling and enabling of
each dispatcher. A new and free function is added that creates a
timed_cd_data object that is used by every public function. A thread is
initialized at object creation instead of using a counter. Add
a protection for the terminate flag.

Signed-off-by: Joao Rebelo <jrebelo@s2e-systems.com>
2020-01-20 16:29:33 +01:00
Marcel Jordense
a9b9a65e1b FSM combine event and timeout thread
Signed-off-by: Marcel Jordense <marcel.jordense@adlinktech.com>
2020-01-20 15:54:08 +01:00
Kurtulus Oksuztepe
0b1804e039 Finite State Machine for Security
A generic FSM has been added to DDS Security Core component to realize authentication handshake process.
The list of the states and the transitions are given in the creation and the FSM is started with a start call.
Passing arguments to transition funstions is possible.
Timeout transitions are possible.

Signed-off-by: Kurtulus Oksuztepe <kurtulus.oksuztepe@adlinktech.com>
2020-01-20 15:54:08 +01:00
Erik Boasson
9481a75e9d Config file doc generator parsing of RELOFF construct
Signed-off-by: Erik Boasson <eb@ilities.com>
2020-01-20 15:54:08 +01:00
Erik Boasson
be327f5e56 Fix race between DCPSParticipant write and lease expiry
Signed-off-by: Erik Boasson <eb@ilities.com>
2020-01-20 10:27:56 +01:00
Erik Boasson
4af531a1c3 Add a test for duration 0ns and 1ns manual lease
Signed-off-by: Erik Boasson <eb@ilities.com>
2020-01-20 10:27:56 +01:00
Erik Boasson
5632ed46b5 Register manual-by-topic lease in transition to alive
Lease handling removes expired leases from the heap, and so a proxy
writer that transitions from not-alive to alive needs to re-schedule
expiry again or it will remain alive forever after having regained
liveliness once.  This was missing for a manual-by-topic lease.

Signed-off-by: Erik Boasson <eb@ilities.com>
2020-01-20 10:27:56 +01:00
Erik Boasson
0f527135fc Fix pwr lease expiry during pwr creation
The transition to not-alive can occur between registering the lease and
making the proxy writer visible in the GUID hash table, so handling
lease expiry for proxy writer must not depend on it being visible
there.

Signed-off-by: Erik Boasson <eb@ilities.com>
2020-01-20 10:27:56 +01:00
Erik Boasson
1ed7a65b4f Give interface name when warning about multicast
Signed-off-by: Erik Boasson <eb@ilities.com>
2020-01-20 10:27:56 +01:00
Erik Boasson
46e0c6dc94 Implement dds_wait_for_acks (writer only)
Signed-off-by: Erik Boasson <eb@ilities.com>
2020-01-20 10:27:56 +01:00
Thijs Sassen
60e51479c1 Added extra header file needed to work around an issue(see issue #74) when reading samples in c++
And updated dds_read_instance_mask and dds_take_instance_mask to work with DDS_READ_WITHOUT_LOCK

Signed-off-by: Thijs Sassen <thijs.sassen@adlinktech.com>
2020-01-17 21:31:35 +01:00
Dennis Potman
231cb8c9f7 Deadline Missed QoS implementation
This commit contains the implementation of the deadline QoS
for readers and writers. The description of this QoS in
the DDS specification (section 2.2.3.7):

"This policy is useful for cases where a Topic is expected to
have each instance updated periodically. On the publishing side this
setting establishes a contract that the application must meet.
On the subscribing side the setting establishes a minimum
requirement for the remote publishers that are expected to supply
the data values."

On the writer side, the deadline missed event also needs to trigger in
case only local readers exist. The implementation for this inserts
the sample in the writer history cache temporary, so that an instance
is created in the whc. Immediately after inserting the sample, it is
removed again. With the creation of the instance, the deadline missed event
is created, which will take care of triggering the deadline missed
callback if required. In case the instance already existed, the timer
of the event is renewed.

To verify the changes to the writer history cache, add an additional
test to check the write history cache state. This test checks the state
of the whc after writing samples by a writer with specific combinations
of qos settings. The state of the whc is checked for stored
samples (min/max sequence number) and the absence of unacked data, after
writing samples and wait for acks by the local and/or remote
readers (which is also a parameter for this test). This test is
introduced as part of the deadline implementation, but its scope is
wider than only the changes that were made in the whc implementation for
the deadline qos.

This test showed that even before the deadline support was added,
whc_default_remove_acked_messages_full data was not marked as acked in
case of transient-local keep-all. This resulted in data in whc that
never gets in acked state. This has been fixed as well.

Signed-off-by: Dennis Potman <dennis.potman@adlinktech.com>
2020-01-17 14:35:07 +01:00
Dennis Potman
219cb6cf4f Refactored linked list administration in rhc so that it becomes reusable
Signed-off-by: Dennis Potman <dennis.potman@adlinktech.com>
2020-01-17 14:35:07 +01:00
Erik Boasson
a41a615999 Remove non-standard "CM" discovery topics
These topics are non-standard and not actually used anywhere in Cyclone,
so it is rather silly to keep them.

Signed-off-by: Erik Boasson <eb@ilities.com>
2020-01-16 16:35:13 +01:00
Erik Boasson
03b8c51332 Move security config tests
Signed-off-by: Erik Boasson <eb@ilities.com>
2020-01-16 16:10:37 +01:00
Erik Boasson
5748f72c90 Clean up plugin loading
Signed-off-by: Erik Boasson <eb@ilities.com>
2020-01-16 16:10:37 +01:00
Erik Boasson
37db2dc6c3 Update XSD
Signed-off-by: Erik Boasson <eb@ilities.com>
2020-01-16 16:10:37 +01:00
Erik Boasson
3c407a5d68 Fix tracing discovery of a non-secure participant
Use DISCOVERY instead of INFO (which ends up in the log, and so by
default on stderr).

Signed-off-by: Erik Boasson <eb@ilities.com>
2020-01-16 16:10:37 +01:00
Kurtulus Oksuztepe
b81ef4042b DDS Security dynamic plugin loading
Security plugin loading with the given configuration has been added.

The configuration can be given by either the Cyclone DDS configuration file or ParticipantQoS during participant creation.
ParticipantQoS is required by DDS Security spec. However, the configuration file is an additional useful feature that helps the user to add security to the DDS application without changing the binary.
If ParticipantQoS has a Property starting with the name "dds.sec", then the configuration file is ignored.

If the participant is the first participant, the security component is initialized. If the participant is the last active participant, then the security component is de-initialized.

Signed-off-by: Kurtulus Oksuztepe <kurtulus.oksuztepe@adlinktech.com>
2020-01-16 16:10:37 +01:00
Dan Rose
a6dc93ac03 Define NOMINMAX to suppress windows min/max macros
Signed-off-by: Dan Rose <dan@digilabs.io>
2020-01-15 13:02:57 +01:00
MarcelJordense
b561cb821f support delayed endpoint matching (#315)
* support delayed endpoint matching

Signed-off-by: Marcel Jordense <marcel.jordense@adlinktech.com>

* Update delayed endpoint matching

Signed-off-by: Marcel Jordense <marcel.jordense@adlinktech.com>
2020-01-08 16:19:55 +01:00
eboasson
861f19a2ad
Merge pull request #364 from MarcelJordense/security
Merge master into security branch
2020-01-06 14:19:51 +01:00
Marcel Jordense
73d0f604e3 Correct travis build
Signed-off-by: Marcel Jordense <marcel.jordense@adlinktech.com>
2019-12-19 11:14:20 +01:00
Marcel Jordense
35ce7788e1 Merge branch 'master' into security 2019-12-18 18:24:30 +01:00
Martin Bremmer
514bf75276 Added some security documentation.
Signed-off-by: Martin Bremmer <martin.bremmer@adlinktech.com>
2019-12-18 13:09:04 +01:00
Martin Bremmer
91111af0ea Force md5 keyhash when needed.
Signed-off-by: Martin Bremmer <martin.bremmer@adlinktech.com>
2019-12-18 13:08:10 +01:00
Dennis Potman
01dc6ebce8 Disable lifespan qos support in one of the linux_gcc8 Travis builds
Signed-off-by: Dennis Potman <dennis.potman@adlinktech.com>
2019-12-17 13:02:28 +01:00
Dennis Potman
ef0f4c2ae7 Lifespan QoS implementation
This commit enables specifying a duration for data to be valid when writing
samples. After this duration, samples are dropped from the reader and writer
history cache. See section 2.2.3.16 of the DDS specification for more
details on this QoS.

The expiration of samples in the reader history cache is calculated
based on the reception timestamp of the sample and uses the monotonic
clock. As a result, the current implementation does not rely on clock
synchronisation between reader and writer. There may be reasons to
change this behavior in future and use the source timestamp instead.

Signed-off-by: Dennis Potman <dennis.potman@adlinktech.com>
2019-12-17 13:02:28 +01:00
Dennis Potman
1ec9c3a194 Refactored xevents callback deletion
Some changes in the xevents code for deleting callback events,
required for the lifespan QoS implementation. With these changes,
there is no longer a possibility of the callback still being
executing or getting invoked after delete_xevent_callback has
returned.

Signed-off-by: Dennis Potman <dennis.potman@adlinktech.com>
2019-12-17 13:02:28 +01:00
Erik Boasson
bdb7f17053 More compile-time checks for entity index
Signed-off-by: Erik Boasson <eb@ilities.com>
2019-12-16 10:39:41 +01:00
Erik Boasson
0271c11144 Rename ephash to entity_index/entidx
It is now more than just a GUID hash so "ephash" really doesn't fit
anymore.

Signed-off-by: Erik Boasson <eb@ilities.com>
2019-12-16 10:39:41 +01:00
Erik Boasson
2dfde4bf0d Only touch endpoints of same topic when matching
Maintain an index of all entities on (kind, topic, GUID) in addition to
the concurrent hash table on GUID and use that when looking for matching
entities.  For endpoint matching, restrict the scan to readers/writers
of the right topic, for regular iterators, restrict it to the range of
the correct entity kind.

Signed-off-by: Erik Boasson <eb@ilities.com>
2019-12-16 10:39:41 +01:00
eboasson
80d0be83e0
Merge pull request #360 from martinbremmer/merge6
Merge master into security
2019-12-13 14:40:50 +02:00
eboasson
52d6e0be26
Fix array keys on little-endian machines (#358)
* Fix array keys on little-endian machines

Signed-off-by: Erik Boasson <eb@ilities.com>

* Test for writing topics with an array as key

Signed-off-by: Erik Boasson <eb@ilities.com>
2019-12-13 14:18:31 +02:00
Martin Bremmer
660d495746 Merge branch 'master' into merge6
Signed-off-by: Martin Bremmer <martin.bremmer@adlinktech.com>
2019-12-13 12:59:37 +01:00
MarcelJordense
f2f0205f25 Added volatile security endpoints. (#310)
* Added volatile security endpoints.

Signed-off-by: Marcel Jordense <marcel.jordense@adlinktech.com>

* Fix review issues with volatile security endpoints

Signed-off-by: Marcel Jordense <marcel.jordense@adlinktech.com>

* Update sending point-2-point heartbeats

Signed-off-by: Marcel Jordense <marcel.jordense@adlinktech.com>

* Fix infinite loop when sending p2p heartbeats

Signed-off-by: Marcel Jordense <marcel.jordense@adlinktech.com>
2019-12-12 16:54:19 +02:00
TheFixer
fc8d844519 Add missing documentation for dds_takecdr() (#357)
* Add missing documentation for dds_takecdr()

Signed-off-by: TheFixer <thefixer@iteazz.com>

* Updated documentation for dds_takecdr() and added documentation for dds_writecdr()

Signed-off-by: TheFixer <thefixer@iteazz.com>
2019-12-12 15:11:05 +02:00
Wilco Bonestroo
2724f94002 Refer to roundtrip example
Text refers to roundtrip example and code to helloworld.

Signed-off-by: Wilco Bonestroo <w.j.bonestroo@saxion.nl>
2019-12-09 23:27:52 +01:00
martinbremmer
66c0d87886 Encoding preparations (#329)
* Payload encoding/decoding preparations.

Signed-off-by: Martin Bremmer <martin.bremmer@adlinktech.com>

* Sub-message encoding/decoding preparations.

Signed-off-by: Martin Bremmer <martin.bremmer@adlinktech.com>

* RTPS message encoding/decoding preparations.

Signed-off-by: Martin Bremmer <martin.bremmer@adlinktech.com>

* Removed redundant destination acquiring.

Signed-off-by: Martin Bremmer <martin.bremmer@adlinktech.com>

* Refactored secure writing of RTPS messages slightly.

Signed-off-by: Martin Bremmer <martin.bremmer@adlinktech.com>
2019-12-06 17:50:31 +02:00