summaryrefslogtreecommitdiff
path: root/src/ipcpd/unicast
Commit message (Collapse)AuthorAgeFilesLines
* include: Use common definition between lib and IRMdDimitri Staessens2024-01-311-2/+2
| | | | | | | | 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 <[email protected]> Signed-off-by: Sander Vrijders <[email protected]>
* build: Update licenses to 2024Dimitri Staessens2024-01-1352-52/+52
| | | | | | | Slow but steady. Signed-off-by: Dimitri Staessens <[email protected]> Signed-off-by: Sander Vrijders <[email protected]>
* include: Rename layer.layer_name to layer.nameDimitri Staessens2023-11-291-2/+2
| | | | | | | | The layer_info had a member layer_name which is a bit redundant. Signed-off-by: Dimitri Staessens <[email protected]> Signed-off-by: Sander Vrijders <[email protected]>
* ipcpd: Broadcast destruction of DHT requests0.20.0Dimitri Staessens2023-09-201-1/+1
| | | | | | | | 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 <[email protected]> Signed-off-by: Sander Vrijders <[email protected]>
* 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 <[email protected]> Signed-off-by: Sander Vrijders <[email protected]>
* 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 <[email protected]> Signed-off-by: Sander Vrijders <[email protected]>
* ipcpd: Revise loggingDimitri Staessens2023-08-304-20/+41
| | | | | | | | This revises the logging in the IPCPs to be a more consistent and reduce duplicate messages in nested functions. Signed-off-by: Dimitri Staessens <[email protected]> Signed-off-by: Sander Vrijders <[email protected]>
* lib: Move protobuf definitions to pb/ directoryDimitri Staessens2023-08-304-40/+39
| | | | | | | | | | 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 <[email protected]> Signed-off-by: Sander Vrijders <[email protected]>
* ipcpd: Move alloc race mitigation to common sourceDimitri Staessens2023-08-301-77/+4
| | | | | | | | | | 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 <[email protected]> Signed-off-by: Sander Vrijders <[email protected]>
* 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 <[email protected]> Signed-off-by: Sander Vrijders <[email protected]>
* ipcpd: Set IPCP states in common sourcesDimitri Staessens2023-08-301-7/+0
| | | | | | | | 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 <[email protected]> Signed-off-by: Sander Vrijders <[email protected]>
* ipcpd: Simplify including common enrollment codeDimitri Staessens2023-08-302-5/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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 <[email protected]> Signed-off-by: Sander Vrijders <[email protected]>
* ipcpd: Add IDs to enrollmentDimitri Staessens2023-08-231-26/+34
| | | | | | | | 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 <[email protected]> Signed-off-by: Sander Vrijders <[email protected]>
* include: Revise printing hashesDimitri Staessens2023-08-232-0/+2
| | | | | | | | | | | 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 <[email protected]> Signed-off-by: Sander Vrijders <[email protected]>
* lib: Remove semicolon after protobuf messagesDimitri Staessens2023-03-181-2/+2
| | | | | | | | Doesn't seem to be needed, this makes it uniform in all protobuf files. Signed-off-by: Dimitri Staessens <[email protected]> Signed-off-by: Sander Vrijders <[email protected]>
* irmd: Add configuration file supportDimitri Staessens2023-03-081-1/+1
| | | | | | | | | | | | | | | | | | | | | This adds initial support for configuration files using the C99 TOML parser (to be installed separately from https://github.com/cktan/tomlc99). The default location for the IRMd configuration file is /etc/ouroboros/irmd.conf. This is configurable at build time. An example file will be installed in the configuration directory with the name irmd.conf.example. Config file support can be disabled using the DISABLE_CONFIGFILE build option. There were some refactors and changes to the configuration messages and protobuf files. This works towards consolidation of protobuf C as an option for more generic handling of serialization/deserialization of various messages. Signed-off-by: Dimitri Staessens <[email protected]> Signed-off-by: Sander Vrijders <[email protected]>
* ipcpd: refactor IPCP configurationDimitri Staessens2023-02-133-32/+13
| | | | | | | | | | The ipcp configuration struct now has internal structures for the different IPCPs and for IPCP components of the unicast IPCP. Split the very long IPCP main loop into individual handler functions. Signed-off-by: Dimitri Staessens <[email protected]> Signed-off-by: Sander Vrijders <[email protected]>
* build: Update copyright to 2023Dimitri Staessens2023-02-1352-52/+52
| | | | | | | 2022 was a rather slow year... Signed-off-by: Dimitri Staessens <[email protected]> Signed-off-by: Sander Vrijders <[email protected]>
* ipcpd: Refactor main functionsDimitri Staessens2022-07-131-15/+8
| | | | | | | | | | | | | | | | | | | The structure of main functions of the IPCPs was a bit strange with a ipcp_shutdown() call that combined waiting for a terminating signal with stopping the internal threads. This is now revised into a symmetrical design of ipcp_start(), which now includes the create response towards the IRMd. ipcp_sigwait(), which waits for a shutdown signal ipcp_stop() that then stops the internal threads. Now the main() functions of the IPCPs will make sense without checking what that ipcp_shutdown() functions actually does. Signed-off-by: Dimitri Staessens <[email protected]> Signed-off-by: Sander Vrijders <[email protected]>
* build: Update copyright to 2022Dimitri Staessens2022-04-0352-52/+52
| | | | | | | Growing pains. Signed-off-by: Dimitri Staessens <[email protected]> Signed-off-by: Sander Vrijders <[email protected]>
* lib: Add np1_flow_read and np1_flow_write callsDimitri Staessens2022-03-304-5/+12
| | | | | | | | | | | | | | | | Reading/writing to (N + 1)-flows from the IPCP was using a raw QoS flow to bypass some functions in the ipcp_flow_read call. But this call was broken for keepalive packets. Fixing the ipcp_flow_read call for (N - 1) flows causes the IPCPs to drop 0-byte keepalive packets coming from (N + 1) client flows. >From now on, there is a dedicated call for (N + 1) reads/writes from the IPCPs that's more efficient and cleaner. The (N + 1) flow internal QoS is now also defaulted to a qos_np1 qosspec, instead of tampering with the qosspec requested by the (N + 1) client. Signed-off-by: Dimitri Staessens <[email protected]> Signed-off-by: Sander Vrijders <[email protected]>
* lib: Refactor reading packet from rbuffDimitri Staessens2022-03-303-7/+7
| | | | | | | | | | | | Reading packets from the rbuff and checking their validity (non-zero size, pass crc check, pass decryption) is now extracted into a function. Also adds a function to get the length of an sdu_du_buff instead of subtracting the tail and head pointers. Signed-off-by: Dimitri Staessens <[email protected]> Signed-off-by: Sander Vrijders <[email protected]>
* ipcpd: Fix memcpy with NULL in piggyback APIDimitri Staessens2022-03-081-2/+4
| | | | | | | | If there is no piggyback data, memcpy was passed a NULL pointer in memcpy(buf, NULL, 0) calls, which is undefined behaviour. Signed-off-by: Dimitri Staessens <[email protected]> Signed-off-by: Sander Vrijders <[email protected]>
* ipcpd: Refactor kad_req_createDimitri Staessens2022-03-081-20/+25
| | | | | | | A small refactor of the kad_req_create function's cleanup code. Signed-off-by: Dimitri Staessens <[email protected]> Signed-off-by: Sander Vrijders <[email protected]>
* ipdpd: Pass MPL to application at flow_allocationDimitri Staessens2022-03-082-2/+6
| | | | | | | | | | | | The maximum packet lifetime (MPL) is a property of the flow that needs to be passed to the reliable transmission protocol (FRCP) for its correct operation. Previously, the value of MPL was set fixed as one of the (fixed) Delta-t parameters. This patch makes the MPL a property of the layer, and it can now be set per layer-type at build time. This is a step towards a proper MPL estimator in the flow allocator. Signed-off-by: Dimitri Staessens <[email protected]> Signed-off-by: Sander Vrijders <[email protected]>
* lib: Make flow liveness timeout configurableDimitri Staessens2022-03-031-2/+5
| | | | | | | | | The qosspec_t now has a timeout value that sets the timeout value of the flow. Flows with a peer that has timed out will now return -EFLOWPEER on flow_read() or flow_write(). Signed-off-by: Dimitri Staessens <[email protected]> Signed-off-by: Sander Vrijders <[email protected]>
* ipcpd: Fix some unchecked return valuesDimitri Staessens2022-03-031-7/+10
| | | | | | | Fixes some unchecked and wrongly checked return values. Signed-off-by: Dimitri Staessens <[email protected]> Signed-off-by: Sander Vrijders <[email protected]>
* ipcpd: Refactor sendingflow allocation responseDimitri Staessens2022-02-211-21/+33
| | | | | | | | Small refactor taking the wait for the flow allocation to complete out. Signed-off-by: Dimitri Staessens <[email protected]> Signed-off-by: Sander Vrijders <[email protected]>
* ipcpd: Refactor flow allocator message handlingDimitri Staessens2022-02-211-113/+170
| | | | | | | | This refactors the single long function that handles incoming packets destined for the flow allocator. Signed-off-by: Dimitri Staessens <[email protected]> Signed-off-by: Sander Vrijders <[email protected]>
* ipcpd: Fix hashing and overlapping memcpy in pffDimitri Staessens2022-02-182-12/+4
| | | | | | | | | The pft hash function assumed mem_hash allocates memory, but it does not. There was also a memcpy with potentially overlapping memory regions, which is undefined behaviour. Signed-off-by: Dimitri Staessens <[email protected]> Signed-off-by: Sander Vrijders <[email protected]>
* ipcpd: Fix deadlock in dht_unregDimitri Staessens2022-02-181-8/+3
| | | | | | | | | The dht_del function was called under lock in dht_unreg, and then tried to take the lock again, a 100% deadlock. Also fix uninitialized value in dht_retrieve. Signed-off-by: Dimitri Staessens <[email protected]> Signed-off-by: Sander Vrijders <[email protected]>
* ipcpd: Use random buffer for flat addressDimitri Staessens2022-02-181-15/+4
| | | | | | | Less code, and less chance of a collision. Signed-off-by: Dimitri Staessens <[email protected]> Signed-off-by: Sander Vrijders <[email protected]>
* ipcpd: Fix bounds check on PROG_MAX_FLOWSDimitri Staessens2022-02-181-2/+2
| | | | | | | Off-by-one error in the bounds check. Signed-off-by: Dimitri Staessens <[email protected]> Signed-off-by: Sander Vrijders <[email protected]>
* ipcpd: Fix initialization of hash width in DHTDimitri Staessens2022-02-171-5/+7
| | | | | | | | | | The width of the Kademlia hash function (dht->b) was set only after the ID was created. This should have failed miserably, but the bytes after were fine as they were just a randomized ID in the Kademlia network. Nasty. Signed-off-by: Dimitri Staessens <[email protected]> Signed-off-by: Sander Vrijders <[email protected]>
* ipcpd: Fix free in fail path of readdirDimitri Staessens2022-02-173-3/+3
| | | | | | | | | 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 <[email protected]> Signed-off-by: Sander Vrijders <[email protected]>
* 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 <[email protected]> Signed-off-by: Sander Vrijders <[email protected]>
* 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 <[email protected]> Signed-off-by: Sander Vrijders <[email protected]>
* 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 <[email protected]> Signed-off-by: Sander Vrijders <[email protected]>
* 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 <[email protected]> Signed-off-by: Sander Vrijders <[email protected]>
* 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 <[email protected]> Signed-off-by: Sander Vrijders <[email protected]>
* 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 <[email protected]> Signed-off-by: Sander Vrijders <[email protected]>
* 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 <[email protected]> Signed-off-by: Sander Vrijders <[email protected]>
* 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 <[email protected]> Signed-off-by: Sander Vrijders <[email protected]>
* 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 <[email protected]> Signed-off-by: Sander Vrijders <[email protected]>
* 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 <[email protected]> Signed-off-by: Sander Vrijders <[email protected]>
* 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 <[email protected]> Signed-off-by: Sander Vrijders <[email protected]>
* 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 <[email protected]> Signed-off-by: Sander Vrijders <[email protected]>
* unicast: Fix RIB stats for congestion avoidanceDimitri Staessens2021-07-101-2/+2
| | | | | | | The upstream/downstream stats were switched. Signed-off-by: Dimitri Staessens <[email protected]> Signed-off-by: Sander Vrijders <[email protected]>
* lib: Pass full path for RIB entriesDimitri Staessens2021-06-293-7/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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 <[email protected]> Signed-off-by: Sander Vrijders <[email protected]>
* 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 <[email protected]> Signed-off-by: Sander Vrijders <[email protected]>