summaryrefslogtreecommitdiff
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
* build: Add target include directory for libtomlc99beDimitri Staessens2024-08-021-0/+5
| | | | | | | | On OS X, user-installed libraries will have their headers in /usr/local/include/ which is not automatically included. Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
* build: Fix build without openSSL installedHEAD0.21.4testingmasterDimitri Staessens2024-07-221-3/+7
| | | | | | | | The library was still trying to link against OpenSSL on OS X after it was uninstalled. Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
* irmd: Fix compilation with configfile on FreeBSDDimitri Staessens2024-07-221-0/+3
| | | | | | | AF_INET is defined in <sys/socket.h> on FreeBSD. Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
* irmd: Fix printing tv_secDimitri Staessens2024-07-221-1/+1
| | | | | | | | There was a logline printing tv_sec as a ssize_t instead of a long, causing compilation on raspbian 32-bit to fail. Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
* ipcpd: Fix build on OSXDimitri Staessens2024-07-192-1/+5
| | | | | | | | | Macro was missing for CLOCK_REALTIME_COARSE, which does not exist on OS X, and the preprocessor macro for the ipcpd-eth had an #endif misplaced which was exposing an otherwise unknown label. Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
* irmd: Fix shutdown on configfile failureDimitri Staessens2024-04-231-1/+1
| | | | | | | | The state was set to IRMD_NULL, so the IRMd was still waiting for a signal to actually shut down. It should be set to IRMD_SHUTDOWN. Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
* build: Fix tests with CMake >= 3.29Dimitri Staessens2024-04-166-6/+30
| | | | | | | | | | | | | | | | | | Removing the testdriver source by the driver name doesn't work anymore in CMake 3.29 because of the following (breaking) change: Changed in version 3.29: The test driver source is listed by absolute path in the build tree. Previously it was listed only as <driverName>. https://cmake.org/cmake/help/latest/command/create_test_sourcelist.html When using CMake 3.29 or above, Ouroboros will use the list POP_FRONT function (introduced in CMake 3.15) to get rid of it. https://cmake.org/cmake/help/latest/command/list.html#pop-front Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
* irmd: Fix parsing arguments in configfile0.21.3Dimitri Staessens2024-03-011-1/+1
| | | | | | | | The argc counter was improperly reset before building the arguments list. Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
* lib: Rename CACEP to CEP and set conngmr timeout0.21.2Dimitri Staessens2024-02-269-73/+81
| | | | | | | | | | | | | | | | The Common Application Connection Establishment Protocol (CACEP) is a RINA construct associated with the Common Distributed Application Protocol (CDAP). We dropped CDAP as O7s sees connection establishment as common to all applications (though it can be a nop). The wiki already refers to this as (O7s) Connection Establishment Protocol (CEP). The connection manager will now timeout waiting for CEP messages to avoid hanging forever, configurable at build time via CONNMGR_RCV_TIMEOUT. Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
* irmd: Fix handling destroy during wait timeoutsDimitri Staessens2024-02-261-14/+25
| | | | | | | | The object must be refreshed from the list to see if it wasn't yet destroyed if the wait times out. Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
* irmd: Fix wrong hash length when getting ipcpdDimitri Staessens2024-02-262-4/+4
| | | | | | | | The get_ipcpd_by_dst function was returning the hash length of the last IPCP in the list instead of the length of the actual hash. Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
* irmd: Fix memleak on cancelDimitri Staessens2024-02-261-5/+12
| | | | | | | | | | | If the mainloop is cancelled during a write, the response buffer leaks. The IRMd now warns about failed writes only when the error is not EPIPE, as EPIPE is expected to happen with timed out requests. Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
* ipcpd: Mitigate race in wait_req_arr and wait_respDimitri Staessens2024-02-261-6/+15
| | | | | | | | | | | | | | | | | | | | The wait_flow_req_arr and wait_flow_resp functions are there to ensure the responses of the IRMd to flow allocation requests arrive in the correct order. These functions use a mutex: alloc_lock. After these functions return, the IPCP will switch to it's own (usually read-write) lock. In the local IPCP, this leaves room for a race where the state of the flow is accessed in alloc_resp before it is updated in wait_flow_req_arr. This race is only visible in the local IPCP, as the other IPCP have to send information between these calls, but it is theoretically possible when using any IPCP for local IPC. In the ipcpd-local, it happens ~0.01% to ~0.03% of flow allocations. This mitigates the problem in the ipcpd-local by adding a 1ms wait to the flow allocation if this race is detected. Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
* irmd: Fix flow deallocation timeoutDimitri Staessens2024-02-262-8/+15
| | | | | | | | The timeout was set to a value calculated as abstime for a cond_wait instead of a timeout, causing flows to linger in the IPCP. Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
* irmd: Always use reg_destroy_procDimitri Staessens2024-02-237-126/+95
| | | | | | | | | | | Destroying a process will now always be done with reg_destroy_proc, regardless of whether it was an IPCP or spawned. This makes it easier to keep the registry consistent and avoid races. Also improves some logs and updates some default settings. Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
* ipcpd: Add build option to use pid as addressDimitri Staessens2024-02-233-1/+8
| | | | | | | | | This adds a build option IPCP_DEBUG_LOCAL that will use the pid as the DT name (address) in the unicast IPCP, which is handy for integration testing and debugging. Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
* ipcpd: Clean up connection when cancelling connectDimitri Staessens2024-02-231-1/+8
| | | | | | | | The connection element was not free'd on shutdown during a connect operation. Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
* irmd: Fix race between alloc timeout and respondDimitri Staessens2024-02-231-2/+6
| | | | | | | | | If a flow allocation times out just before the response, there is a short window where the response will still find the flow, but in DEALLOCATED state. Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
* lib: Revise app flow allocationDimitri Staessens2024-02-2326-715/+1168
| | | | | | | | | | | | | This revises the application flow allocator to use the flow_info struct/message between the components. Revises the messaging to move the use protocol buffers to its own source (serdes-irm). Adds a timeout to the IRMd flow allocator to make sure flow allocations don't hang forever (this was previously taken care of by the sanitize thread). Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
* lib: Fix CRC32 hashing0.21.1Dimitri Staessens2024-02-192-14/+36
| | | | | | | | | I assumed that all hashes were stored in Big Endian, but apparently the CRC32 was still in machine endianness when calculated by the rhash implementation. Fixed and updated hash tests a bit. Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
* irmd: Fix free of uninitialized ptrDimitri Staessens2024-02-191-2/+3
| | | | | | | | | The reg_list_ipcps function left *ipcps uninitialized when there were no IPCPs in the system. This caused a free to SEGV in the IRMd when trying to allocate a flow. Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
* build: Fix missing newlines at end of fileDimitri Staessens2024-02-1914-14/+14
| | | | | | | Some files had a newline at the end, others didn't. Now they all do. Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
* irmd: Revise IRMd internalsDimitri Staessens2024-02-1959-3248/+6962
| | | | | | | | | | | | | | | | | | | | | | | | | | | This is a full revision of the IRMd internal implementation. The registry is now a proper subcomponent managing its own internal lock (a single mutex). Some tests are added for the registry and its data structures. Some macros for tests are added in <ouroboros/test.h>. Flow allocation is now more symmetric between the client side (alloc) and server size (accept). Each will create a flow in pending state (ALLOC_PENDING/ACCEPT_PENDING) that is potentially fulfilled by an IPCP using respond_alloc and respond_accept primitives. Deallocation is split in flow_dealloc (application side) and ipcp_flow_dealloc (IPCP side) to get the flow in DEALLOC_PENDING and DEALLOCATED state. Cleanup of failed flow allocation is now properly handled instead of relying on the sanitizer thread. The new sanitizer only needs to monitor crashed processes. On shutdown, the IRMd will now detect hanging processes and SIGKILL them and clean up their fuse mountpoints if needed. A lot of other things have been cleaned up and shuffled around a bit. Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
* ipcpd: Fix hash conversion in ipcpd-udpDimitri Staessens2024-01-311-1/+3
| | | | | | | | The bootstrap function was not returning the correct hash. Bug introduced in 99545fa2. Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
* ipcpd: Fix memleak in rib_readdirDimitri Staessens2024-01-311-2/+2
| | | | | | | On fail_dup, the last element (0) was not free'd. Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
* include: Use common definition between lib and IRMdDimitri Staessens2024-01-3113-61/+35
| | | | | | | | Some definitions/enums were different between the library and IRMd (flow_state, ipcp_state). This moves them to common ground. Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
* lib: Make list empty on deleteDimitri Staessens2024-01-311-1/+1
| | | | | | | | The list_del operation now lets nxt and prv point to the element itself, so that list_is_empty(e) is true after list_del(e). Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
* irmd: Don't release flow_id before destroying flowDimitri Staessens2024-01-132-4/+5
| | | | | | | | | | When flow_alloc failed, it was releasing the flow_id, but the flow was needs to be cleaned up by the sanitizer. Bug introduced by ongoing refactor of the flow allocator, which - when done - will properly clean up the flow after a failure and not depend on the sanitizer. Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
* irmd: Error when config not foundThijs Paelman2024-01-132-3/+4
| | | | | | | | | | | | | Error instead of warn when the --config param is set, but the file is not found. This prevents the IRMd from being in a 'half state', where it is started, but the expected config is not applied. One simply has to remove the --config option OR supply a correct filepath. Also fix compile option for the help message. Signed-off-by: Thijs Paelman <thijs@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
* irmd: Fix parsing empty argument in configfileThijs Paelman2024-01-131-1/+1
| | | | | | | | | | | | | | Previously, args=[""] would crash the IRMd when it tried to auto-instantiate the program. Now, specifying an empty string as argument to a program WILL automatically start that program if there is an incoming flow, but without any arguments, as intended. Remark: The semantics might be a bit less clear than e.g. args=["--listen"], but they are a natural extension. Signed-off-by: Thijs Paelman <thijs@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
* build: Update licenses to 2024Dimitri Staessens2024-01-13173-174/+174
| | | | | | | Slow but steady. Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
* irmd: Fix parsing multiple args in configfileThijs Paelman2023-12-311-9/+11
| | | | | | | | | | | | | | | | | New method retains the original string in parsing the args string into an argv dynamic array. Previous method (`strtok`) didn't work, because it is a destructive function, changing the supplied string. We however needed to apply it twice to the same string. It is still done twice in a loop, to make sure argc is exact. Other methods, like counting the amount of spaces to determine argc, would be incorrect for his particular way of tokenizing if arguments are separated by e.g. two spaces. Also fixes a wrong pointer dereference, which did go unnoticed before due to the previous error. Signed-off-by: Thijs Paelman <thijs@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
* irmd: Fix passing symmetric key on allocationDimitri Staessens2023-12-312-5/+9
| | | | | | | | | The check if the flow requires a key in irmd flow_alloc was missing when setting the pointers for the piggyback data, so non-encrypted flow allocations failed on irm_msg__pack(). Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
* lib: Fix wrong fccntl return for FLOWGRCVTIMEOThijs Paelman2023-12-171-1/+1
| | | | | | | The send timeout was returned instead of the receive timeout. Signed-off-by: Thijs Paelman <thijs@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
* lib: Move public key handling from app to IRMdDimitri Staessens2023-12-174-125/+188
| | | | | | | | | | | | | | | The application was generating its public keypair for its ECDHE key exchange. This is now done by the IRMd, which will check the requested qosspec and then apply what is needed. The flow_alloc and flow_accept calls will just return the symmetric key to the application. This makes it easier when we add configurations with given public key pairs and other encryption algorithms, which can then all be configured globally in the IRMd instead of having all the options replicated and implemented in each and every application. Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
* lib: Fix memleak when creating IPCPDimitri Staessens2023-12-171-0/+4
| | | | | | | The irm_create_ipcp leaked the ipcp_info protobuf message. Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
* tools: Fix missing eth-dix in "irm ipcp create"Dimitri Staessens2023-12-1711-35/+38
| | | | | | | | | | | | | | | | The irm ipcp create tool had the ipcpd-eth-dix missing in the help. Updated the help text where PARAM = {options list} to where PARAM in {options list} and some other small fixes. Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
* irmd: Don't log an error when server quitsDimitri Staessens2023-11-301-2/+7
| | | | | | | | | | The revision of the IRMd caused it to log an error when an application terminates and closes the unix socket (EPIPE) or the IRMd shutds down (EIRMD). These are expected and correct behaviour. Replaced the error logs with debug logs. Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
* include: Store IPCP name and type in info structDimitri Staessens2023-11-2910-103/+165
| | | | | | | | The information for an IPCP is now stored in an ipcp_info struct, containing name and type. The IRM public API is not changed. Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
* include: Rename layer.layer_name to layer.nameDimitri Staessens2023-11-2911-22/+22
| | | | | | | | The layer_info had a member layer_name which is a bit redundant. Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
* lib: Rename ipcp_info to ipcp_list_infoDimitri Staessens2023-11-2913-101/+101
| | | | | | | | | The ipcp_info struct / message contains information only used for listing IPCPs, and I will reuse the ipcp_info name for general IPCP information common to all IPCPs such as name and type. Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
* ipcpd: Fix eth management packets blocking rdrbuff0.20.3Dimitri Staessens2023-11-262-20/+19
| | | | | | | | | | The ipcpd-eth-* reserve a packet buffer slot for the N+1 data packets whenever receiving a frame. For management frames, that slot is not needed and it was not released, thus blocking the rdrbuff. Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
* lib: Fix reading FUSE output on RaspbianDimitri Staessens2023-11-262-8/+17
| | | | | | | | | | | | | | | | | The previous patch only fixed listing the contents on the fuse filesystem. Apparently files with st_blocks = 0 as seen as empty on Raspbian, and the FUSE read() function isn't invoked for such files. Setting st_blocks to 1 fixes that, but st_blksize is ignored for fuse. So, on raspbian the filesize is now a huge number, but at least reading the fuse filesystem works. Corrected the filesystem attributes for the IPCP output for systems that don't rely on st_blocks to assess filesize. Also set the file mode to 0644 as these are not executables. Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
* lib: Add newlines to stderr output at initDimitri Staessens2023-11-261-16/+16
| | | | | | | The stderr lines had no newline. Fixed. Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
* irmd: Fix parsing names without args in configfile0.20.2Dimitri Staessens2023-11-201-0/+5
| | | | | | | | Config files that had service names without the args option specified would cause the IRMd to segfault. Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
* lib: Fix FUSE output on RaspbianDimitri Staessens2023-11-202-1/+5
| | | | | | | | | | | | For some reason, 'ls' on raspbian invoked the fuse readdir() in a loop where the first call had fuse_file_info * info set to NULL and subsequent calls had info->nonseekable set to 1. Since we don't check the value the info struct, this caused an infinite loop when trying to list the contents of the fuse filesystem subdirectories of /tmp/ouroboros/. Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
* lib: Fix timeout overflow on 32-bit systems0.20.1Dimitri Staessens2023-11-081-2/+2
| | | | | | | | | | The timeout comparison for keepalives could overflow on 32-bit systems, as times were converted to nanoseconds and be limited to a bit over 4 seconds. This caused flow reads to fail miserably with EFLOWPEER errors when keepalives were set higher on these systems. Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
* irmd: Fix use of uninitialized valueDimitri Staessens2023-11-081-1/+1
| | | | | | | | The value for 'ret' was not initialized when comparing to -ETIMEDOUT in reg_name_leave_state(). Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
* ipcpd: Fix log line in ipcpd-udpDimitri Staessens2023-11-081-1/+2
| | | | | | | The dst was printed as a string instead of using hash-formatting. Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
* lib: Remove pid from flow structDimitri Staessens2023-10-251-4/+0
| | | | | | | | | The pid of the N-1 IPCP process was needlessly stored in the flow struct. We only need it to open the right shared memory maps, which is done when the flow is created. Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>