summaryrefslogtreecommitdiff
path: root/src/lib
Commit message (Collapse)AuthorAgeFilesLines
* lib: Disable CRC by defaultDimitri Staessens2018-10-111-1/+1
| | | | | | | | This sets the CRC check to be disabled by default, since it greatly hampers performance and is almost never needed. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
* lib: Initialize libgcrypt before useDimitri Staessens2018-10-111-1/+4
| | | | | | | | This initializes libgcrypt before use in the library. This fixes the "called in non-operational state" error when CRC checking is enabled. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
* lib: Fix padding in rdrbuff0.12.2Dimitri Staessens2018-10-091-15/+4
| | | | | | | | Multiblock writes that require wrapping will now correctly pad unuseable space at the end of the rdrbuff. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
* lib: Define QoS specs inside header file0.12.1Sander Vrijders2018-10-092-89/+0
| | | | | | | | | The QoS specs were defined in the source file instead of in the header file, which resulted in uninitialized structs being used, which gave rise to weird behavior in the library. Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be> Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be>
* lib: Keep track of highest delivered seqnoDimitri Staessens2018-10-061-14/+13
| | | | | | | | | | | | The FRCT kept only a left window edge in the receiver connection window, however, it needs to keep track of the left window edge (highest ACK'd sequence number) and the highest delivered sequence number, so it can delay ACKs that cannot be piggybacked. TCP recommends at most 500 ms for delayed ACKs (probably good to keep it near half of RTO). Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
* lib: Split error checking from FRCTDimitri Staessens2018-10-054-44/+58
| | | | | | | | This splits off the CRC from FRCT so it can be set independently. Ouroboros now allows raw flows with error checking. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
* lib: Rename port_id to flow_idDimitri Staessens2018-10-057-84/+84
| | | | | | | Renames port_id to flow_id according to updated nomenclature. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
* ipcpd, lib, irmd, tools: Change SDU to packetSander Vrijders2018-10-057-17/+17
| | | | | | | | This will change SDU (Service Data Unit) to packet everywhere. SDU is OSI terminology, whereas packet is Ouroboros terminology. Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be> Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be>
* lib: Pass qosspec at flow allocationDimitri Staessens2018-10-059-130/+167
| | | | | | | | | | | | The flow allocator now passes the full qos specification to the endpoint, instead of just a cube. This is a more flexible architecture, as it makes QoS cubes internal to the layers. Adds endianness transforms for the flow allocator protocol in the normal IPCP. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
* lib: Check return values init functionsSander Vrijders2018-09-286-31/+58
| | | | | | | | | This will check the return values of init functions so that the code is more robust. It also removes a duplicate init in the timerwheel, checks for buffer overflows in the RIB and checks string lengths. Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be> Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be>
* lib: Remove configuration from FRCTDimitri Staessens2018-09-272-64/+17
| | | | | | | | This removes configuration from the FRCT protocol to send it during flow allocation. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
* include: Remove _DEFAULT_SOURCE in endian.hDimitri Staessens2018-09-276-1/+26
| | | | | | | | This removes the _DEFAULT_SOURCE definition in the endian header as it should not be there. This avoids double and conflicting definitions. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
* ipcpd: React to flow events activelySander Vrijders2018-07-041-3/+17
| | | | | | | | This adds the infrastructure to actively react to flow up, down and deallocated events. Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be> Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be>
* ipcpd: Change connection down to flow downSander Vrijders2018-06-191-13/+15
| | | | | | | | | | The DT component was flagging a connection as down and passing the fd that was down. Of course the other components expect a connection instead of just a fd. Now the connection manager will listen to flow up and down events, and flag the connection up or down if needed. Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be> Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be>
* Merge branch 'testing' into beSander Vrijders2018-06-151-2/+6
|\
| * lib: Mark flows down on finiDimitri Staessens2018-06-151-2/+6
| | | | | | | | | | | | | | This will mark flows down when they are finalized. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
* | Merge branch 'testing' into beSander Vrijders2018-06-133-146/+1
|\|
| * lib: Use macros for all time utility functions0.11.9Dimitri Staessens2018-06-132-145/+0
| | | | | | | | | | | | | | | | | | This replaces the time utility functions with macros. This avoids using library functions in the tools and also slightly speeds up the implementation. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
| * lib: Change prefix to mountpt in RIBSander Vrijders2018-06-131-1/+1
| | | | | | | | | | | | | | | | The build failed if FUSE was disabled, since instead of voiding mountpt, prefix, an unexisting variable, was voided. Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be> Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be>
* | Merge branch 'testing' into beSander Vrijders2018-06-081-90/+40
|\|
| * irmd: Remove shm_sanitizer threadDimitri Staessens2018-06-081-90/+40
| | | | | | | | | | | | | | | | | | | | This removes the sanitizer thread in the IRMd to avoid the IRMd eating the CPU when the buffer is full. The processes will clean the head PDU if there is a broken lock in the rdrbuff. Chances for a lingering tail PDU are slim. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
* | lib: Fix bad bounds calculation in frctDimitri Staessens2018-06-081-1/+1
| | | | | | | | | | | | | | | | | | Since the seqno is further ahead than the lwe (this was checked before), we can safely use seqno - lwe in unsigned arithmetic as the distance in the sequence number space. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
* | lib: Add a data qos cubeDimitri Staessens2018-06-084-12/+34
|/ | | | | | | | This adds a data qos cube that is reliable. Reliable qos can be selected by setting the loss parameter of the qosspec to 0. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
* lib: Remove unused #define in rdrbuffDimitri Staessens2018-06-081-3/+0
| | | | | | | This removes a #define that was not used anymore Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
* lib: Fix rollover and return value in FRCTDimitri Staessens2018-06-081-4/+6
| | | | | | | | | The __frct_rcv should return -EAGAIN if there is no packet for the application, but 0 was always returned. Also fixes sequence number rollover. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
* lib: Define default qosspecs in qos sourcesDimitri Staessens2018-06-052-32/+33
| | | | | | | | | This moves the definition of the predefined qosspecs to qos.h and qos.c. This allows applications to select them using qos_best_effort etc. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
* lib: Add a QOS_RAW QoS cubeDimitri Staessens2018-06-052-14/+34
| | | | | | | | | This adds a QoS cube that allows sending packets directly over a raw flow, without an FRCT state machine. Flow allocation with a NULL qosspec will now default to such raw flows. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
* lib: Simplify delta-t logicDimitri Staessens2018-06-051-54/+55
| | | | | | | | | | This revises the delta-t implementation to align with Watson's timer specifications. FRCT will never deliver out-of-order packets. A raw flow (without delta-t state machine) will be able to provide such a service. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
* lib: Remove rq testsDimitri Staessens2018-06-042-116/+0
| | | | | | | The rq was removed in a previous commit. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
* lib: Fix memleak in hashtable testDimitri Staessens2018-06-041-0/+1
| | | | | | | The element was not freed if insertion failed. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
* lib: Revise FRCT reorderingDimitri Staessens2018-06-045-249/+47
| | | | | | | | The reordering queue is replaced by a fixed ring buffer for speed and simplicity. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
* lib: Mark flows as down on ipcp_flow_fini()Dimitri Staessens2018-05-301-34/+35
| | | | | | | | | | The flow_fini() function was marking flows as wronly (so rdonly for the application) when the flow was deallocated. With the recent addition of the flowdown state, we can now mark them as down. Also fixes some bounds checks and alignment. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
* lib: Fix potential memleak in rdrbuffDimitri Staessens2018-05-271-2/+4
| | | | | | | | The rdrb struct should be freed when destroying the rdrbuff, even when the actual shared memory is not unlinked. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
* lib: Use IPCP name as RIB directoryDimitri Staessens2018-05-151-2/+2
| | | | | | | | This will change the FUSE mountpount to the name of the IPCP instead of a generic name based on its pid. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
* lib: Add event types to fqueueDimitri Staessens2018-05-142-37/+53
| | | | | | | | | | | The event type of the current event in the fqueue can now be requested using the fqueue_type() command. Currently events for packets (FLOW_PKT), flows (FLOW_UP, FLOW_DOWN) and allocation (FLOW_ALLOC, FLOW_DEALLOC) are specified. The implementation only tracks FLOW_PKT at this point. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
* lib: Make UNIX socket buffer size configurable0.11.3Sander Vrijders2018-05-031-4/+11
| | | | | | | | | | This makes the buffer size used by the UNIX sockets configurable. In case of a lot of IPCPs in the system it might become too small with the default value, resulting in irm command failures. The user can now easily configure it with an adequate value. Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be> Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be>
* lib: Shut rx buffer down before cleanup and exitDimitri Staessens2018-04-261-0/+1
| | | | | | | | | | If a program exits, it cleans its read buffer. However, another process could still write a packet in that buffer, which would cause the IPCP or IRMd to run into an assertion failure on shutdown. Setting the rbuff to ACL_FLOWDOWN prevents this. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
* lib: Unmount stale FUSE mountpointsDimitri Staessens2018-04-261-1/+10
| | | | | | | | This will unmount a stale FUSE mountpoint (an IPCP with the same pid exited ungracefully on the system) before trying to create it. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
* lib: Fix bad unlinking of old shared memorySander Vrijders2018-04-251-5/+1
| | | | | | | | | | A previous commit tried to stat the shared memory file in case it was already there, but stat does not seem to work for shared memory files. This simply omits the O_EXCL attribute upon creation of the shared memory file, since pids are unique anyway. Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be> Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be>
* lib: Unlink old flow set shared memorySander Vrijders2018-04-251-0/+4
| | | | | | | | | This unlinks previously allocated flow set shared memory. It could be lingering in case an application with the same pid was SIGKILLED, and didn't clean up its flow set shared memory. Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be> Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be>
* ipcpd: Avoid unnecessary copy in eth readerDimitri Staessens2018-04-051-1/+1
| | | | | | | | | This reads from the Ethernet device directly into the rdrbuff to avoid a copy on the read side in the Ethernet IPCPs. This does not work for the netmap device. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
* irmd: Fix memleak when failing to list ipcpsDimitri Staessens2018-03-221-10/+10
| | | | | | | | | The list_ipcps call had a memleak in the failure case. Also fixes a compiler warning for a possible uninitialized variable and renumbers the gpb ipcpd message fields. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
* lib: Simplify reg/unreg APIDimitri Staessens2018-03-224-94/+95
| | | | | | | | | | | | | | | | | | | | The reg/unreg API is simplified to registering and unregistering a single name with a single IPCP. The functionality associated with registering names was moved from the IRMd to the irm tool. The function to list IPCPs was simplified to return all IPCPs in the system with their basic properties needed for management. The above changes led to some needed changes in the irm tool and the management functions that were depending on the previous behaviour of list_ipcps. Command line functionality to list IPCPs in the system is also added to the irm tool. Some older code was refactored. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
* lib: Allow disabling partial readDimitri Staessens2018-03-191-6/+14
| | | | | | | | | | | | | | This allows disabling partial reads. It adds a flag FLOWFRNOPART that disables partial reads. Partial read is different from partial delivery (FRCTFPARTIAL), which allows delivery of fragments of an incomplete packet and thus potentially corrupted data. FLOWFRNOPART will never deliver corrupted data (unless FRCTFPARTIAL is also set). If FLOWFRNOPART is set and the buffer provided to flow_read is too small for the SDU, that SDU will be discarded and -EMSGSIZE is returned; Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
* lib: Simplify some code in rdrbuffDimitri Staessens2018-03-161-8/+2
| | | | | | | This simplifies some functions in the rdrbuff. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
* lib: Use sequenced datagrams with UNIX socketsSander Vrijders2018-03-131-2/+2
| | | | | | | | The UNIX sockets were using SOCK_STREAM, which does not preserve the message boundaries. This switches to SOCK_SEQPACKET. Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be> Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be>
* lib: Allow partial readDimitri Staessens2018-03-121-20/+39
| | | | | | | | | | | | | This implements partial read of packets if the buffer supplied to flow_read() is smaller than the packet in the buffer. If the number of bytes returned by flow_read equals the size of the buffer, the next read() will deliver the next bytes of the packet (or 0 if the packet was exactly the size of the buffer on the previous read). Implements #7. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
* lib: Implement timeout on blocking writeDimitri Staessens2018-03-122-34/+57
| | | | | | | | | | This completes the implementation of the SNDTIMEO for a blocking write. Fixes #6. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
* ipcpd: Add IPCP over DIX EthernetDimitri Staessens2018-03-102-3/+10
| | | | | | | | | | | | | | | | | | This adds an IPC Process that uses DIX Ethernet with an Ethertype that is configurable at bootstrap. This allows parallel DIX layers over the same Ethernet network with different Ethertypes (and one LLC layer). It allows jumbo frames in the future, and should avoid the problems we have with some routers not handling LLC traffic very well. The destination endpoint ID is sent as a 16 bit integer, so the maximum payload is 1498 bytes in standard Ethernet, and 8998 bytes when Jumbo frames are used. The implementation is very similar to the Ethernet LLC IPCP, so it is implemented using preprocessor macros in the single source instead of duplicating code. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
* lib: Use PTHREAD_COND_CLOCK for blocking reads0.10.6Dimitri Staessens2018-03-101-1/+1
| | | | | | | | | | | The rbuff uses the PTHREAD_COND_CLOCK for its condition variables, but the flow_read was passing a time it got from the CLOCK_REALTIME_COARSE clock. This causes the blocking reads not to timeout correctly. The oping was updated to detect server timeouts and finish gracefully. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>