summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* 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>
* lib: Fix timeout overflow on 32-bit systems0.20.1Dimitri Staessens2023-11-082-3/+3
| | | | | | | | | | 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>
* irmd: Don't load config file without --config setDimitri Staessens2023-10-253-2/+7
| | | | | | | | | | The irmd was automatically loading the default configfile (usually /etc/ouroboros/irmd.conf) if present. Now the --config parameter has to be set for the irmd to load a config. The service is adapted to have the --config command line parameter set at install. Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
* lib: Wrap pthread_cond_timedwait for NULL abstimeDimitri Staessens2023-10-2510-73/+30
| | | | | | | | | We often have the pattern where we NULL-check abstime for pthread_cond_timedwait to call pthread_cond_wait if it is. Added a __timedwait function to wrap this. Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
* irmd: Remove separate rwlock for flowsDimitri Staessens2023-10-251-62/+36
| | | | | | | | | | Modifications for flows were made under a different rwlock (flows_lock) than the rwlock used for names, etc (reg_lock). This has little value and unnecessarily complicates things. This removes the flows_lock and uses the reg_lock for all registry objects. Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
* ipcpd: Improve logging in ipcpd-udpDimitri Staessens2023-10-251-9/+14
| | | | | | | Printed some more info on a few errors using strerror. Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
* irmd: Simplify mainloopDimitri Staessens2023-10-251-212/+213
| | | | | | | | This moves the command parsing function out of the mainloop implementation to make it a bit less unwieldy. Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
* lib: Make crypt.c independent source fileDimitri Staessens2023-10-256-55/+125
| | | | | | | | | | | The cryptography functions were in a C source that was directly imported into dev.c, enabling ECDHE+AES256 symmetric key encryption on flows. Now crypt.c is an independent source file with associated crypt.h header, to prepare for security management and configuration in the IRMd. Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
* ipcpd: Broadcast destruction of DHT requests0.20.0Dimitri Staessens2023-09-202-3/+3
| | | | | | | | When a request is cancelled/destroyed, all blocking threads should exit. Noticed some hangs on the DHT, this seems to fix/reduce it. Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
* lib: Revise port construct in applicationDimitri Staessens2023-09-201-84/+91
| | | | | | | | | | | | | | | | | | The application had a port construct, which is a leftover from the early days implementing RINA specs, which had a "port_id" to access flows. O7s doesn't really have a "port" concept, only flows. The port_wait_assign function was used in the IPCP to wait for the IRMd to assign the flow_id and return so the flow object could be created. This renames things a bit, and also simplifies the locking to us a single lock/condvar for managing flows. This should be further improved to move the flow state into the flow object, maintain a double mapping of to flow objects (id_to_flow and fd_to_flow) and malloc flow objects at flow allocation, instead of keeping the full table in memory at init to further reduce memory footprint. Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
* ipcpd: Fix dereference of unknown pointer typeDimitri Staessens2023-09-201-2/+2
| | | | | | | | The event handler was dereferencing the pointer to a connection, but the pointer type is not known yet. Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
* ipcpd: Register event handler after scheduler startDimitri Staessens2023-09-201-10/+15
| | | | | | | | | | | The event handler was registered before the scheduler was started. Which could in theory cause addition of fds to an uninitialized scheduler. The event handler is now registered after the scheduler is created as part of dt_start. Likewise it now unregisters as part of dt_stop. Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
* lib: Revise application init and finiDimitri Staessens2023-09-201-50/+72
| | | | | | | | The init will now print more useful errors if a process fails to initialize. Also rearranged these procedures a little bit. Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
* lib: Rename portevent to floweventDimitri Staessens2023-09-203-12/+11
| | | | | | | Doesn't make any sense to call it a port event... Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
* irmd: Print ascii Ouroboros logo at startupDimitri Staessens2023-09-202-1/+34
| | | | | | | | | | | | | | | | | | The IRMd will now print a stylized logo at startup: ▄▄█████▄▄▄ ▄█▀▀ ▀▀███▄ █ ██ ▄▄▄ ▄███▄ ▄ ▄ ▄ ▄▄ ▄▄ █ ▄▄ ▄▄ ▄ ▄▄ ▄▄ ▄▄ ██ █ █ █████ █ █ █▀ ▀ █ █ █▀ █ █ █ █▀ ▀ █ █ ▀▄ ▀ ██ ▀▄▄▄▀ ▀█▀ █ █ █ █ █ █▄ █ █ █ █ █ █ ▄ ▀▄ █▄ █ ▀▀▀ ▀ ▀ ▀▀ ▀ ▀▀ ▀▀ ▀ ▀▀ ▀▀ ▀█▄▄▄▄▄▄▄▄▀ ▀▀▀▀▀▀ All credits to Zen for providing the ASCII art! Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
* ipcpd: Revise loggingDimitri Staessens2023-08-3013-245/+344
| | | | | | | | This revises the logging in the IPCPs to be a more consistent and reduce duplicate messages in nested functions. Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
* lib: Move protobuf definitions to pb/ directoryDimitri Staessens2023-08-3032-112/+108
| | | | | | | | | | This moves the protobuf definition in the library to a pb/ directory. Also renames the protobuf files and does a quick review of the #define guards in the include library to specify _LIB_ for internal/non-public library headers. Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
* ipcpd: Move alloc race mitigation to common sourceDimitri Staessens2023-08-306-235/+100
| | | | | | | | | | All flow allocator code was duplicating the mitigation for a race where the IRMd response for the flow allocation with a new flow fd was arriving before the response to the flow_req_arr. This is now moved to the ipcp common source. Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
* ipcpd: Don't release sdb before writing packetDimitri Staessens2023-08-301-20/+25
| | | | | | | | | The flow allocator fa_alloc_resp would release the packet buffer (sdb) before writing if the response was a failure. Also sets the IPCP allocation timeout in nanoseconds as per the comment. Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
* ipcpd: Set IPCP states in common sourcesDimitri Staessens2023-08-306-25/+12
| | | | | | | | The state of the IPCP was set and checked in the main files, but it's more convenient to do it in the common source. Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
* ipcpd: Remove unused rwlockDimitri Staessens2023-08-301-2/+1
| | | | | Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
* ipcpd: Simplify including common enrollment codeDimitri Staessens2023-08-305-31/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | The common enrollment code between the unicast and broadcast IPCP included the same C source from a source file in the unicast and broadcast directories. Now it's handled by defining COMMON_SOURCES for the unicast and broadcast IPCP. For now, only the enrollment component is common. Two things are needed for the connection manager: * Routing to be fixed to use a supporting broadcast layer. Then management flows can be removed from the unicast IPCP (as they are in fact data transfer flows of the broadcast layer that supports the routing dissemination traffic). * DHT to enroll as part of IPCP enrollment. Now it enrolls when a data transfer flow is established to be more akin to how Kademlia nodes join a Kademlia DHT, but this should be revised to adhere more to O7s enrollment concepts. After that, the connection manager code will also be completely shared between the unicast and broadcast layer and the connmgr will also be common code. Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
* ipcpd: Add IDs to enrollmentDimitri Staessens2023-08-239-224/+322
| | | | | | | | The enrollment messages now have a 64-bit ID to easier track enrollments in the logs in larger scale tests. Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
* include: Add option to prefix logs with an IDDimitri Staessens2023-08-231-21/+53
| | | | | | | | | | | | | | | | | | | | | | This adds the log_xxx_id() macros to print a logline prefixed with a 64-bit identifier in hex format, for instance: [2a92d78c2f52b76a] Hello ouroboros! The ID is assumed to be 8 bytes in big endian format (it uses the HASH_FMT functions and hashes are stored in big endian byte arrays). The implementation uses the compiler-specific '##' operator to allow empty variadics. E.g. func(arg , ## __VA_ARGS__); will eat the comma if __VA_ARGS__ is empty and thus allow func(arg); Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
* include: Revise printing hashesDimitri Staessens2023-08-2311-33/+245
| | | | | | | | | | | The code was a bit convoluted to print hashes as hex strings. Renamed to HASH_FMT32 and HASH_VAL32 to make clear we are printing the first 32 bits only, and added options to print 64 up to 512 bits as well. This doesn't depend on endianness anymore. Adds a small test for the hash (printing) functions. Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>