Commit graph

170 commits

Author SHA1 Message Date
Erik Boasson
1c963b5c3b add torture test for read, query conditions
The "rhc" test runs a random sequence of operations (writes, reads, &c.)
through an RHC with conditions attached to it.  All possible state masks
are used, and query conditions are tried with a condition that only
tests the key value, and one that tests attribute values.  It depends on
the internal checking logic of the RHC, which is currently enabled only
in Debug builds because of the associated run-time overhead.

Signed-off-by: Erik Boasson <eb@ilities.com>
2019-02-12 14:22:06 +01:00
Erik Boasson
796f6860c7 add missing braces to initializers for vendor ids
Signed-off-by: Erik Boasson <eb@ilities.com>
2019-02-10 19:19:41 +01:00
Erik Boasson
fcdffa8cf8 add a separate RHC tracing category
The RHC tracing produces so much junk that is hardly ever useful that a
normal trace should definitely not include it.

Signed-off-by: Erik Boasson <eb@ilities.com>
2019-02-10 18:23:51 +01:00
Erik Boasson
6646a766c5 fixup following rename SYSDEPS to OS_MSGHDR_FLAGS
The name change missed the uses of the macro, with the result that
datagram truncation on reception does not result in warning (but in
the default configuration, truncation cannot occur); and that the
message flags are undefined on sending datagrams, but judging by the
man page, the likelihood of this causing problems is also small in
practice.

Signed-off-by: Erik Boasson <eb@ilities.com>
2019-02-10 08:30:39 +00:00
Erik Boasson
98465035e6 start using the DDSI vendor id code for the Eclipse Foundation
Signed-off-by: Erik Boasson <eb@ilities.com>
2019-02-07 12:23:01 +01:00
eboasson
92fca549cb
Merge pull request #108 from eboasson/fix-104
Fallback to unicast should set options for unicast discovery (#104)

A very simple change that addresses a real usability issue, does not rely on any platform-specific changes and moreover builds cleanly on the source branch. So I am not going to wait until the AppVeyor build completes.
2019-02-04 16:10:34 +00:00
Erik Boasson
69a493ebb3 Fallback to unicast should set options for unicast discovery (#104)
The default behaviour is to allow multicast, with a fallback of
disabling multicast altogether if the selected interface doesn't support
it. The trouble is that the default discovery configuration assumes that
multicast is available, avoiding the "well-known" port numbers and
avoiding sending any participant discovery messages via unicast. The
result is that the process will run in isolation, which is typically not
the desired result. (It is a quite annoying problem because it happens
on Linux when only a loopback interface is available. It appears that
multicast over loopback works fine, if only you try it, but the kernel
doesn't advertise it and so it doesn't get used.)

This commit changes two things: firstly, it this case it forces the
allocation of "well-known" unicast ports, and secondly, it automatically
adds the local interface's address to the discovery address set. This
way, at least communication inside the machine works.

(Note: AssumeMulticastCapable can be still be used to force it to treat
a Linux loopback interface has multicast capable. It is only the default
behaviour that has changed.)

With thanks to @jwcesign who did all the work except writing the commit
message.

Signed-off-by: Erik Boasson <eb@ilities.com>
2019-02-04 14:00:21 +01:00
Erik Boasson
69e55b04e3 suppress openssl-induced SOCKET-to-int warnings on Win64
One is reasonable (a difference between size_t and the type used for a blob in an iovec), the others are SOCKET-to-int conversions that are caused by the openssl API. Since I'm not going to fix openssl and every indication is that the conversion is safe in practice, silencing the compiler is a sensible thing to do.

Signed-off-by: Erik Boasson <eb@ilities.com>
2019-02-01 14:56:42 +01:00
Erik Boasson
c5e1c5b2f1 By default require TLS1.3
A configuration setting to allow negotiating TLS1.2 is included. If I
got things done correctly, OpenSSL pre-1.1 can be used but requires
explicitly lowering the minimum allowed TLS version in the
configuration file.

Signed-off-by: Erik Boasson <eb@ilities.com>
2019-02-01 14:56:42 +01:00
Erik Boasson
228aa71967 TLS1.3 requires handling "spurious reads"
With TLS1.3 the socket can indicate data is available even when there is no application data. This commit ignores a 0-byte read when no data is required. Long-term, handling short reads/writes in TCP mode need to be handled completely differently, but that is a story for another day.

Signed-off-by: Erik Boasson <eb@ilities.com>
2019-02-01 10:39:49 +01:00
Erik Boasson
f31fba8766 fix and enable SSL support when OpenSSL is available
Signed-off-by: Erik Boasson <eb@ilities.com>
2019-01-30 15:27:35 +01:00
Erik Boasson
e55dc3703a address the last remaining warning by Clang's static analyzer
Signed-off-by: Erik Boasson <eb@ilities.com>
2019-01-22 09:15:18 +01:00
Erik Boasson
c35c5f9190 the "tracing" category in the configuration should only affect the "trace" sink and leave the "log" sink alone
Fixing that produces a lot of noise on stderr because of inappropriate use of the "info" category in various place and, on macOS, because of a rather stupid way of messing with thread scheduling priorities even when none have been specified explicitly in the configuration.

Signed-off-by: Erik Boasson <eb@ilities.com>
2019-01-21 12:53:55 +01:00
Erik Boasson
102e657d45 minor cleanup to address some compiler warnings
Signed-off-by: Erik Boasson <eb@ilities.com>
2019-01-17 10:18:14 +01:00
Erik Boasson
b864c83879 fix de-initialisation of tcp support code
Stopping and restarting the DDSI stack in a single process would not re-initialise the TCP support code properly

Signed-off-by: Erik Boasson <eb@ilities.com>
2019-01-17 10:18:14 +01:00
Erik Boasson
54b5bed8d2 use enum with values log2(STATUS) for identifying status/listener
Signed-off-by: Erik Boasson <eb@ilities.com>
2019-01-17 10:18:14 +01:00
Erik Boasson
e4360d25a0 code cleanup: replacement of lots of function-like macros by inline functions, removal of unnecessary casts
Signed-off-by: Erik Boasson <eb@ilities.com>
2019-01-17 10:18:14 +01:00
eboasson
c10a7fab4a
Merge pull request #89 from eboasson/builtintopics
Builtintopics Revisited
2019-01-15 11:46:48 +01:00
Erik Boasson
72c1920eed Avoid delivery of history to volatile reader
When a remote writer is discovery, a proxy_writer object representation
that writer is created without yet having any knowledge of what the
current sequence number for that writer is.  If a local reader is
matched with that proxy writer before a Heartbeat has been recevied and
this sequence number information is known, all historical data will be
made available to that reader, even if it is volatile.

By treating the first Heartbeat specially, by moving the next sequence
number to be delivered as fresh data forward to the next sequence
number, retrieval of historical data is avoided.  Transient-local
readers have a separate ("out-of-sync") route to request it anyway.

Signed-off-by: Erik Boasson <eb@ilities.com>
2019-01-11 13:12:15 +01:00
Erik Boasson
d659b416f2 undo breakage of OpenIndiana (Solaris) build
Signed-off-by: Erik Boasson <eb@ilities.com>
2019-01-09 11:15:11 +01:00
Erik Boasson
66076817e1 rework built-in topics again
Move details of built-in topics out of the DDSI core (so the only hooks
remain).  For this, rtps_term had to be split, so now it is "stop"
followed by "fini".

Add a notion of local writers that are not bound to a participant ("local
orphans"), so that the local built-in topic writers can be created during
initialization.  This eliminates the "builtin" participant.  This
uncovered in inconsistency in the unit tests: on the one hand, a newly
created participant is expected to have no child entities; on the other
hand, the built-in topics were expected to be returned by find_topic ...
This inconsistency has been resolved by creating them lazily and
accepting that find_topic can't return them until they have been
created.  Special code was in place in dds_create_reader anyway, so it
is not expected to have any real consequence for applications.

Use a special WHC implementation that regenerates the data on the fly
using the internal discovery tables of DDSI, so that the samples are only
stored by readers.  This eliminates the memory overhead of that existed
previously when the WHC of the writers stored the data.

No longer return topic name and type name in the built-in topics, they
have been extracted already and are not accessible through the normal
interface but do cause problems when comparing QoS.

Signed-off-by: Erik Boasson <eb@ilities.com>
2019-01-09 08:38:56 +01:00
Erik Boasson
24802ecad3 avoid setting topic and type name in the QoS objects returned in the built-in topics
Signed-off-by: Erik Boasson <eb@ilities.com>
2019-01-09 08:38:37 +01:00
Jeroen Koekkoek
62b9b8d9dc Replace OS_INLINE by inline
Signed-off-by: Jeroen Koekkoek <jeroen@koekkoek.nl>
2019-01-08 16:40:07 +01:00
Jeroen Koekkoek
c86bda7aa4 Move operating system abstractions from DDSI to abstraction layer
Signed-off-by: Jeroen Koekkoek <jeroen@koekkoek.nl>
2019-01-08 16:40:07 +01:00
Jeroen Koekkoek
9475024a5f Replace NN_C99_INLINE and VDDS_INLINE by OS_INLINE
Signed-off-by: Jeroen Koekkoek <jeroen@koekkoek.nl>
2019-01-08 16:40:07 +01:00
Jeroen Koekkoek
0bc263e537 Remove unnecessary os_procName and os_procNamePid functions
Signed-off-by: Jeroen Koekkoek <jeroen@koekkoek.nl>
2019-01-08 16:40:07 +01:00
Jeroen Koekkoek
a2aab8eab2 Remove dead code
Signed-off-by: Jeroen Koekkoek <jeroen@koekkoek.nl>
2019-01-08 16:40:07 +01:00
Jeroen Koekkoek
3c0b86df9c Add os_gethostbyname and tidy socket address to and from text form functions
Signed-off-by: Jeroen Koekkoek <jeroen@koekkoek.nl>
2019-01-08 16:40:07 +01:00
Jeroen Koekkoek
5835a85dc2 Remove unused types and definitions from abstraction layer
Signed-off-by: Jeroen Koekkoek <jeroen@koekkoek.nl>
2019-01-07 18:15:07 +01:00
Jeroen Koekkoek
e25656a4c5 Remove unnecessary CMake modules and fixup os/CMakeLists.txt
Signed-off-by: Jeroen Koekkoek <jeroen@koekkoek.nl>
2019-01-07 18:15:07 +01:00
Erik Boasson
d920b51b05 fix uninitialised value propagating into key of topic discovery data used by WHC
The only consequence is that the tkmap would probably map the same topic to a different iid each time one was written, or that a different topic would get mapped to some other iid. The latter would cause the WHC to overwrite the older topic. Actual damage is minimal as it would only result in incomplete topic discovery by OpenSplice. That it is mostly harmless today does not mean it couldn't cause any number of interesting surprises in the future.

Signed-off-by: Erik Boasson <eb@ilities.com>
2019-01-04 16:22:35 +01:00
Erik Boasson
f2d0dd2ef4 fix use of initialized memory (in this case, harmless) when a undersized packet is received
Signed-off-by: Erik Boasson <eb@ilities.com>
2019-01-04 16:22:35 +01:00
Erik Boasson
95f070d097 cleanup_defrag need not inspect any readers when all readers are in sync
Signed-off-by: Erik Boasson <eb@ilities.com>
2019-01-04 10:49:21 +01:00
Erik Boasson
4cc7fac8bc clean up tracing for SPDP messages in when discovery category is enabled, but not full tracing
Signed-off-by: Erik Boasson <eb@ilities.com>
2019-01-04 10:49:21 +01:00
Erik Boasson
c60f4fb797 be consistent in generating the hash for the key value for keyless topics
Signed-off-by: Erik Boasson <eb@ilities.com>
2019-01-04 10:49:21 +01:00
Erik Boasson
c61c880fd2 make proxy reader/writer references to sertopics properly counted, strong references
without this, deleting the last reader/writer that references the topic results in a dangling pointer ... but there is another intriguing solution: erase the topic from the proxy reader/writer when the last matching local one disappears, so that the topic completely disappears. I rather like this second solution, but I am not yet sure of the consequences and the first (implemented one) is such a simple change that fixes a real problem that it is a no-brainer

Signed-off-by: Erik Boasson <eb@ilities.com>
2019-01-03 17:30:25 +01:00
Erik Boasson
52a0751055 fix leaking of address sets in network partitions
Signed-off-by: Erik Boasson <eb@ilities.com>
2019-01-02 16:43:42 +01:00
Erik Boasson
23972aa8f7 change the way WHC state is passed round in the transmit path to allow tighter assertions and silencing of warnings from clang's static analyzer
Signed-off-by: Erik Boasson <eb@ilities.com>
2019-01-02 15:03:21 +01:00
Erik Boasson
ed06ab8f4b trivial modifications to pacify gcc -O2 and clang --analyze
Signed-off-by: Erik Boasson <eb@ilities.com>
2019-01-02 15:03:20 +01:00
Erik Boasson
b70e88c16f change initialization of AVL trees to avoid "strict prototype" warnings
Signed-off-by: Erik Boasson <eb@ilities.com>
2019-01-02 15:03:19 +01:00
Erik Boasson
9f51c44e50 Avoid deadlock on publication-matched listener invocation
This addresses the deadlock of #41 but leaves another issue open: sequencing of listener invocations on publication/subscription matched events: there is a risk that the "unmatch" even precedes the "match" event from the application perspective, even though it is quite unlike in practice. Various ways of addressing it exist, but it looks like sequencing at the level of the "dds" entities suffers from similar risks. So better to just avoid the deadlock for now.

Signed-off-by: Erik Boasson <eb@ilities.com>
2019-01-02 12:13:40 +01:00
Erik Boasson
ca99fd10aa Refactor handling of an SPDP-republish event
Signed-off-by: Erik Boasson <eb@ilities.com>
2019-01-02 12:13:40 +01:00
Erik Boasson
0064def595 Set cover in address set generation used a temporary that was too large by a factor of sizeof(void*)
Signed-off-by: Erik Boasson <eb@ilities.com>
2019-01-02 12:13:40 +01:00
Erik Boasson
c491f321dd Fix incorrect free of unicast socket/connection in rtps_init error handling
Signed-off-by: Erik Boasson <eb@ilities.com>
2019-01-02 12:13:40 +01:00
Erik Boasson
27913be1c3 Fix memory leak in function to clear all writer address sets
Signed-off-by: Erik Boasson <eb@ilities.com>
2019-01-02 12:13:40 +01:00
Erik Boasson
0b814df584 Use sizeof(sin_addr) in IPv4 address compare instead of effectively sizeof(size_t)
Signed-off-by: Erik Boasson <eb@ilities.com>
2019-01-02 12:13:40 +01:00
Erik Boasson
d6306bddbb Properly handle "incompatible if unrecognized" in parameter lists (#79)
Previously it would fall through and assert in a debug build or return an error in a release build. The behaviour in a release build was almost correct, as the flag means the entity should be completely ignored if the parameter is not understood by the implementation, but I don't believe it should result in a warning — certainly not that claims the parameter list is invalid. A specific return code is now used to indicate a parameter list that was rejected because of this flag, and that suppresses the warning.

Signed-off-by: Erik Boasson <eb@ilities.com>
2019-01-02 12:13:40 +01:00
Erik Boasson
e0d5587639 Unified key-to-iid map means a backref to the map is no longer needed
Signed-off-by: Erik Boasson <eb@ilities.com>
2019-01-02 12:13:40 +01:00
Erik Boasson
781c644800 participants are not hidden built-in entities in built-in topics and should get an instance handle consistent with the DCPSParticipant topic
Signed-off-by: Erik Boasson <erik.boasson@prismtech.com>
2019-01-01 18:52:27 +01:00
Erik Boasson
179a35d192 fix race conditions in instance id-to-key lookup
this is just an intermediate step: firstly, iid-to-key lookup is a linear scan; secondly, the lookup should happen on the RHC or the WHC and not on some internal map to associates key values with instance handles and is independent of entities

Signed-off-by: Erik Boasson <eb@ilities.com>
2018-12-25 12:40:05 +01:00