summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* irmd: Fix compilation with configfile on FreeBSDDimitri Staessens2024-07-222-1/+4
| | | | | | | 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-167-7/+31
| | | | | | | | | | | | | | | | | | 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-012-2/+2
| | | | | | | | 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-2612-87/+94
| | | | | | | | | | | | | | | | 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-2332-758/+1298
| | | | | | | | | | | | | 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>
* build: Fix build and tests on appveyorDimitri Staessens2024-02-232-5/+12
| | | | | | | | | | | The configuration parameter was not correctly passed, which caused the build system to build with debug symbols (configuration does not match "Release" and not set CONFIG_OUROBOROS_DEBUG, causing the compiler to include the debugging code. Fixed appveyor command. The build will now fail on an unknown CMAKE_BUILD_TYPE. Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
* lib: Fix CRC32 hashing0.21.1Dimitri Staessens2024-02-194-30/+55
| | | | | | | | | 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>
* include: Fix wstatus check for assertion tests0.21.0Dimitri Staessens2024-02-192-3/+3
| | | | | | | | The macro checks tests for exit code 134 (interrupted by SIGABRT) but not for exit code 6. 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-1924-24/+24
| | | | | | | 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-1974-3280/+7171
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* cmake: Use execute_process in newer CMake versionsDimitri Staessens2024-01-312-8/+16
| | | | | | | | | Fixes warnings in CMake 3.28 and newer related to CMP0153. https://cmake.org/cmake/help/latest/policy/CMP0153.html 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-3116-91/+125
| | | | | | | | 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-13221-222/+222
| | | | | | | 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>
* doc: Fix typoThijs Paelman2023-12-171-1/+1
| | | | | | | Fixes a typo in the fccntl manpage. Signed-off-by: Thijs Paelman <thijs@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
* irmd: Use long-form options in config filesThijs Paelman2023-12-171-2/+3
| | | | | | | | | Since config files are meant to be read, use long-form arguments where possible. Also fixed autostart behaviour for oecho. 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-2912-104/+179
| | | | | | | | 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-2912-23/+23
| | | | | | | | 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-2915-104/+104
| | | | | | | | | 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-263-21/+20
| | | | | | | | | | 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-202-1/+6
| | | | | | | | 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>
* build: Change appveyor build VM to Ubuntu2204Sander Vrijders2023-11-081-3/+3
| | | | | | | | We were building on an Ubuntu1804. Probably best to change to newer versions. Signed-off-by: Sander Vrijders <sander@ouroboros.rocks> Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks>