summaryrefslogtreecommitdiff
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
* irmd: Fix argvdup util functionDimitri Staessens2022-02-171-10/+12
| | | | | | | | The argvdup function didn't handle the case where argc is 0. Small refactor that also handles this case correctly. Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
* ipcpd: Fix free in fail path of readdirDimitri Staessens2022-02-174-3/+12
| | | | | | | | | The free of the buffer in the failure path of the readdir RIB functions was taking the wrong pointer in a couple of places. The FRCT RIB readdir was missing error handling for malloc and strdup. Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
* lib: Don't use pointer to set FRCT flagsDimitri Staessens2021-12-291-5/+4
| | | | | | | | | | | | | | | | | | The fccntl call FRCTSFLAGS was using a pointer to a flags so set flags, which should just be a regular uint16_t. For instance, the FRCTLINGER flags can now be turned off using fccntl(fd, FRCTSFLAGS, FRCTFRESCNTL | FRCTFRTX) leaving only resource control (flow control, FRCTFRESCNTL) and retransmission enabled. Note that retransmission (FRCTFRTX) can't be enabled or disabled on a live flow, it will be set on flow allocation. Updates the man page for fccntl to add these FRCT options. Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
* ipcpd: Use wrlock for rotating multipath pff entryDimitri Staessens2021-12-291-12/+14
| | | | | | | | The multipath pff entry was modified (rotated) under a read lock, which is now changed to a write lock. Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
* ipcpd: Allow creation of multiple directoriesDimitri Staessens2021-12-295-421/+523
| | | | | | | | | To allow merging large network layers, a situation will arise where multiple directories need to coexist within the layer. This reverts commit 9422e6be94ac1007e8115a920379fd545055e531. Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
* lib: Ease lock in timerwheel0.18.4Dimitri Staessens2021-12-221-2/+2
| | | | | | | It was taking a write lock when a read lock was sufficient. Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
* lib: Fix waiting for FRCT at deallocationDimitri Staessens2021-12-221-6/+6
| | | | | | | | | | This is a fix to wait for outstanding retransmissions when a flow is deallocated. Instead of waiting the full timeout, it will now wait in the same tic increments used within FRCT. Bit of a stopgap at the moment, FRCT and the flows are in need of a serious refactor. Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
* lib: Add missing rwlock unlock in FRCTDimitri Staessens2021-12-221-2/+4
| | | | | | | There was a missing unlock in FRCT. Also fixes some indentation. Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
* ipcpd: Fix waiting for FRCP to time outDimitri Staessens2021-12-221-1/+1
| | | | | | | | | | The timeout variable was not correctly passed to the IPCP, causing flow IDs to be reused immediately instead of waiting for the full Delta-t to expire. This caused all kinds of havoc with retransmissions in reliable flows. Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
* lib: Fix flow dealloc after expired FRCT timeoutDimitri Staessens2021-12-221-0/+1
| | | | | | | | | | If the timeout is already expired, the wait variable would be negative and return a negative value for the __frcti_dealloc function, thinking that the timeout was not expired causing an unnecessary wait even if all packets are acknowledged. Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
* lib: Set initial sender rwe to sender seqnoDimitri Staessens2021-12-221-1/+1
| | | | | | | | | | | The initial sender right window edge (indicating acknowledged packet sequence number) was initialized to seqno - 1. This should be the same as seqno, since we acknowledge with the next expected sequence number. It also indicates that a flow without traffic has no outstanding acknowledgements. Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
* ipcpd: Add dt component to regular startup flowDimitri Staessens2021-12-061-16/+9
| | | | | | | | | The dt component had init/start commands somewhat outside of the overall flow of startup of the unicast IPCP. This was probably some old code and wasn't needed. Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
* ipcpd: Consolidate policies within folderDimitri Staessens2021-12-0611-12/+125
| | | | | | | | Each policy folder will now have a pol.h file, so that (in most cases) adding a new policy only requires changes inside the policy folder. Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
* ipcpd: Make the DHT a directory policyDimitri Staessens2021-12-068-29/+81
| | | | | | | | The DHT is now a proper directory policy instead of a unicast IPCP component. Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
* ipcpd: Move DHT to stackDimitri Staessens2021-12-064-498/+410
| | | | | | | | | | This makes the DHT a single directory implementation and moves it to the stack (init/fini instead of create/destroy). This is a step towards making it a directory policy, in line with our other policy implementations. Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
* ipcpd: Restructure policy codeDimitri Staessens2021-12-0633-72/+106
| | | | | | | | The policies were all in a single folder pol/, and have been moved to a folder per component/mechanism to keep things a bit more orderly. Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
* lib: Remove old rib_fini codeDimitri Staessens2021-12-061-3/+0
| | | | | | | | There was some leftover code in dev.c wrt to the process RIB that is not needed anymore. Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
* ipcpd: Fix fallthrough warningsDimitri Staessens2021-12-061-0/+4
| | | | | | | Some cases were not guarded by explicit fallthrough where needed. Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
* lib: Fix undefined behaviour in sha3Dimitri Staessens2021-12-061-2/+1
| | | | | | | | | Arithmetic with NULL pointers is undefined behaviour. Caught by clang 13. Fixed by using uintptr_t, which is guaranteed to be the size of a pointer. Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
* ipcpd: Fix conversion to uint64_tDimitri Staessens2021-09-051-1/+1
| | | | | | | | The print output for MB-ECN had a size_t conversion to uint64_t that some compilers complain about. Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
* ipcpd: Don't include prctl.h on non-linux systemsDimitri Staessens2021-09-051-2/+4
| | | | | | | prctl.h is linux only. Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
* ipcpd: Don't use sigwaitinfo() on OS XDimitri Staessens2021-09-051-1/+13
| | | | | | | | | Apparently that function isn't implemented on some versions of OS X. On these systems, we can just use sigwait, but now the IPCP will also accept signals not coming from the IRMd. Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
* ipcpd: Fix additive increase in CA-MB-ECNDimitri Staessens2021-07-211-2/+2
| | | | | | | | | | | | | | | | | The logic for additive increase was botched. It was adding to the current window limit, and to avoid a count-to-infinity when sending below the limit, I added a check that the application was trying to send more than the current limit. This fails in congestion avoidance mode when the IPCP is throttling traffic below the limit; causing the app to never increase the congestion window (and even worse, to keep decreasing in some cases). The Additive Increase will now always add bandwidth to the latest sending rate instead of the window bandwidth limit, avoiding all the problems. Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
* ipcpd: Fix flow allocator build without fuseDimitri Staessens2021-07-181-3/+4
| | | | | | | | The u_snd and u_rcv variables were not guarded by ifdefs when updating. Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
* ipcpd: Export flow updates sent/recvd to fa RIBDimitri Staessens2021-07-121-1/+9
| | | | | | | | The RIB of the flow allocator will now export the number of flow updates sent/received per flow. Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
* ipcpd: Reduce Linux slack timerDimitri Staessens2021-07-123-0/+10
| | | | | | | | | This will reduce the linux high resolution slack timer in IPCPs. Linux default for userspace processes is 50us. It is configurable at build using IPCP_LINUX_SLACKTIMER_NS. Default is now 1us. Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
* ipcpd: Fix update rate for Multi-Bit ECNDimitri Staessens2021-07-121-1/+1
| | | | | | | | The rate was supposed to be 1 update per 8 data packets, but the calculation was doing 1 update per 4 data packets. Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
* unicast: Fix RIB stats for congestion avoidanceDimitri Staessens2021-07-101-2/+2
| | | | | | | The upstream/downstream stats were switched. Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
* lib: Don't initialize process RIB for IPCPsDimitri Staessens2021-07-102-10/+5
| | | | | | | | | | | | | This will skip rib_init() at __init() for IPCPs (or at least, processes that have "ipcpd" in the executable name). The previous code tried to unmount the generic mount and then remount under the ipcp name, but it often failed because fuse_mount() is asynchronous and the mount was not up at the time of the unmount() call. Renaming the mount instead of unmounting failed for the same reason. This is a better fix for now. Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
* lib: Application RIB with FRCT statisticsDimitri Staessens2021-06-305-17/+173
| | | | | | | | | | Application flows can now be monitored from the RIB, exposing FRCT statistics (window edges, retransmission timeout, rtt estimate, etc). Application RIB requires user permissions to be able to access /dev/fuse. Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
* ipcpd: Fix layer info RIBDimitri Staessens2021-06-301-3/+8
| | | | | | | | Layer info was not converted to parse the full path with the latest RIB change. Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
* irmd: Fix unused variable in builds without fuseDimitri Staessens2021-06-301-1/+2
| | | | | | | The mode_t mask wasn't guarded by ifdefs. Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
* lib: Pass full path for RIB entriesDimitri Staessens2021-06-294-17/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | | The read functions for the RIB will now receive the full path, instead of only the entry name. For IPCPs, we organized the RIB in an /<ipcp>/<component>/entries structure with a directory per component, so we don't need the full path at this point. For process flow information, it's a lot more convenient to organize it the following way /<pid>/<fd>/stat We can then register/unregister the flow descriptor when the frct instance is created, and for getting the stats, we'd know the flow descriptor from the fuse file path. If we would create a file per flow instead of a directory per flow, something like /<pid>/flows/<fd> we'd need to do additional bookkeeping to list the contents of that directory (we would need to track all flows with an active FRCT instance), that fuse knows because it tracks the directories. Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
* irmd: Fix setting mode on RIB directoryDimitri Staessens2021-06-291-0/+5
| | | | | | | | The irmd was creating the directory with the wrong mode set because the default mask (022) was not cleared. Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
* ipcpd: Fix unregistering fa and dt RIBsDimitri Staessens2021-06-282-10/+13
| | | | | | | These RIBs were not properly unregistered on shutdown. Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
* lib: Remove struct stat from RIB APIDimitri Staessens2021-06-285-87/+66
| | | | | | | | | | The RIB API had a struct stat in the getattr() function, which made all components that exposed variables via the RIB dependent on <sys/stat.h>. The rib now has its own struct rib_attr to set attributes such as size and last modified time. Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
* build: Fix compilation with fuse (RIB) on FreeBSDDimitri Staessens2021-06-285-7/+21
| | | | | | | | | | | Compilation failed on FreeBSD 14 with fuse enabled because of some missing definitions. __XSI_VISIBLE must be set before including <ouroboros/rib.h> for some definitions in <sys/stat.h>. FreeBSD doesn't know the MSG_CONFIRM flag to sendto() or CLOCK_REALTIME_COARSE, which are Linux-specific. Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
* ipcpd: Fix missing return statement0.18.2Dimitri Staessens2021-06-231-0/+2
| | | | | | | | | The fa_handle_packet function loop is non-void but didn't have a return statement. Only got picked up if I build from AUR, which is weird. Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
* lib, ipcpd, irmd: Wrap pthread unlocks for cleanupDimitri Staessens2021-06-2324-119/+90
| | | | | | | | | | | | This add an ouroboros/pthread.h header that wraps the pthread_..._unlock() functions for cleanup using pthread_cleanup_push() as this casting is not safe (and there were definitely bad casts in the code). The close() function is now also wrapped for cleanup in ouroboros/sockets.h. This allows enabling more compiler checks. Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
* ipcpd: Add missing default for switch in shim-dataDimitri Staessens2021-06-231-0/+3
| | | | | | | | There was a switch-case without a default, causing some compiler warnings. Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
* lib: Bypass assertion in shm_rdrbuff0.18.1Dimitri Staessens2021-06-211-1/+1
| | | | | | | | | This assert() causes ipcpd and subsequent irmd abort() when shutting down debug builds. Should be fixed some day when other components are more robust (frct retransmissions and routing). Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
* ipcpd: Disable core lock by defaultDimitri Staessens2021-06-211-1/+1
| | | | | | | | This was beneficial on dual-XEON CPU systems, but on most hardware, this kills performance when running multiple IPCPs on a single CPU. Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
* ipcpd: Fix buffer overflow in flow allocator RIB.Dimitri Staessens2021-06-211-3/+3
| | | | | | | | Max value of UINT64 can be 20 characters when printed, need an extra byte for sprintf trailing '\0'. Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
* ipcpd: Fix congestion window scalingDimitri Staessens2021-06-211-18/+41
| | | | | | | This fixes scaling of the congestion window, which was a buggy mess. Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
* ipcpd: Move RIB initialization to common groundDimitri Staessens2021-06-218-32/+167
| | | | | | | | | | | | | | This moves Resource Information Base (RIB) initialization into the ipcp_init() function, so all IPCPs initialize a RIB. The RIB not shows some common IPCP information, such as the IPCP name, IPCP state and the layer name if the IPCP is part of a layer. The initialization of the hash algorithm and layer name was moved out of the common ipcp source because IPCPs may only know this information after enrollment. Some IPCPs were not even storing this information. Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
* tools: Support broadcast IPCP in irm ipcp listDimitri Staessens2021-06-181-5/+10
| | | | | | | | The broadcast IPCP was missing in the known types, causing the type to show as UNKNOWN. Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
* ipcpd: Fix free of uninitialized variable in graph.cDimitri Staessens2021-05-282-5/+1
| | | | | | | | | The new GCC 11.1 compiler discovered s_dist would be uninitialized with an unknown policy, so it doesn't need to be free'd. Also removes some unneeded includes in broadcast dt.c that I had pending. Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
* irmd: Remove unused variable in prog_tableDimitri Staessens2021-04-133-41/+3
| | | | | | | This removes a program name variable that was not used anymore. Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
* build: Move connmgr and enrolment to common groundDimitri Staessens2021-03-2821-1890/+944
| | | | | | | | | | The connection manager and enrolment components of the unicast and broadcast IPCP have a lot in common, as conjectured in the paper. The initial implementation of the broadcast IPCP just duplicated the code. This moves the shared functionality to common ground. Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
* build: Remove raptor IPCPDimitri Staessens2021-03-289-1191/+5
| | | | | | | | | | This removes the raptor IPCP. The code hasn't been updated for a while, and wouldn't compile. Raptor served its purpose as a PoC for Ouroboros-over-Ethernet-Layer-1, but giving the extreme niche hardware needed to run it, it's not worth maintaining this anymore. Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>