summaryrefslogtreecommitdiff
path: root/src/ipcpd
Commit message (Collapse)AuthorAgeFilesLines
* ipcpd: Fix use after free and uninitalized valueSander Vrijders2019-06-211-1/+1
| | | | | | | | | | This fixes a use after free in an error condition, and makes sure that pid is set in the flow_set early on, so flow_set_destroy won't create a prefix with an uninitialized pid in case of an error in shm_flow_set_create. Signed-off-by: Sander Vrijders <sander@ouroboros.rocks> Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks>
* ipcpd: Give max priority to flow allocatorDimitri Staessens2019-03-281-2/+31
| | | | | | | | | | | The flow allocator thread was running on a low priority, causing some delay when handling packets. Usually this isn't a problem, but for congestion control updates, the delay may become problematic. The priority is now set to the maximum allowed by the scheduler policy to improve responsiveness. Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
* ipcpd: Handle local IPCP case when parsing configDimitri Staessens2019-03-281-1/+3
| | | | | | | | | The default case in the configuration parsing prints an erroneous "Unknown IPCP type" message when a local IPCP is bootstrapped. The IPCP_LOCAL type is now handled separately (no action needed). Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
* build: Set specific compiler flags for SWIG target0.15.2Dimitri Staessens2019-03-211-1/+4
| | | | | | | | | | The compiler flags for the SWIG target were added to the global CMAKE_C_FLAGS used for the entire project. This sets the flags uniquely for the SWIG target. The eth has a similar case for the c99 flag. There was a lingering include in dev.c that was removed. Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
* ipcpd: Don't reuse fqueue between threadsDimitri Staessens2019-03-211-10/+17
| | | | | | | | The UDP IPCP was reusing fqueues between threads. This is not supported and lead to bad reads and buffer overflows. Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
* ipcpd: Restrict MTU for Ethernet over loopbackDimitri Staessens2019-03-213-0/+8
| | | | | | | | | | | This restricts the MTU for the Ethernet IPCP over loopback adapters (devices named "lo*") to avoid it allocating 65K buffers per packet and quickly filling the default RDRBUFF space. The restriction is set using the build option IPCP_ETH_LO_MTU, with a default value of 1500 bytes. Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
* ipcpd: Fix strict aliasing warning0.15.1Dimitri Staessens2019-03-181-6/+8
| | | | | | | | | | | | | Some versions of gcc seem to give a positive on the strict aliasing rule. It's absent from newer gcc versions or clang. However, rather than disabling the check for older version, this small rewrite seems to temporarily fix the false positive. Apparently, it's undefined behaviour to simply cast a char/uint8_t buffer to a variable type pointer and then dereference the type. A more elaborate patch to fix the undefined behaviour is needed. Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
* ipcpd: Revise UDP IPCPDimitri Staessens2019-03-184-441/+397
| | | | | | | | | | | The UDP IPCP now uses a fixed server UDP port (default 3435) for all communications. This allows passing firewalls more easily since only a single port needs to be opened. The client port can be fixed as well if needed (default random). It uses an internal eid, so the MTU of the UDP layer is reduced by 4 bytes, similar to the Ethernet IPCPs. Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
* build: Set default number of threads in eth to 1Dimitri Staessens2019-03-051-2/+2
| | | | | | | | | This makes the eth packet handler single-threaded by default, at least until stability issues that seem to be related to multi-threading are fixed. Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
* ipcpd: Refactor create_r and flow_req_arrDimitri Staessens2019-03-046-45/+42
| | | | | | | | | | | The API calls for the IPCP to inform the IRMd of IPCP creation and incoming flow request had the pid_t in the call. This pid_t is removed and the getpid() call is now placed inside the function. Also refactors the cleanup for the main() functions of some of the lower IPCPs. Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
* build: Update copyright to 2019Dimitri Staessens2019-02-0557-57/+57
| | | | | | | Updates the copyright notice in all sources to 2019. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
* lib: Fix deallocating non-initialized np1 flowsDimitri Staessens2018-12-292-3/+4
| | | | | | | | This fixes the deallocation of non-initialized IPCP flows. These can occur when some operations are not implemented. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
* include: Add a flow_join operation for broadcastDimitri Staessens2018-12-278-21/+51
| | | | | | | | | | | | This adds a new flow_join operaiton for broadcast, which is a much safer solution than overloading destination name semantics. The internal API now also has a different IPCP_FLOW_JOIN operation. The IRMd doesn't need to query broadcasts IPCPs for the name, it can just check if an IPCP with the layer name exists. The broadcast IPCP doesn't need to implement the query proxy call anymore. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
* ipcpd: Wait for buffer when writing to Eth deviceDimitri Staessens2018-12-081-1/+13
| | | | | | | | This will cause the Ethernet IPCP to wait for a free buffer when using raw sockets to avoid packet drops when the network is congested. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
* ipcpd: Fix uninitialized value for ECNSander Vrijders2018-11-201-9/+1
| | | | | | | | The ECN value in the packet was not set during write of a new packet. Also removes the outdated abstract syntax enum. Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be> Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be>
* ipcpd: Add Explicit Congestion Notification fieldFriedl Rubrecht2018-11-201-1/+7
| | | | | | | | This adds an extra field to the data transfer PCI which can be used to flag congestion by intermediate routers. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
* ipcpd: Add broadcast IPCPDimitri Staessens2018-10-2411-2/+1788
| | | | | | | | | | This adds a broadcast IPCP that allows us to easily create multicast applications. The broadcast IPCP accepts flows for "<layer_name>.mc". A tool, obc (Ouroboros broadcast), is added that sends and reads a message to a broadcast layer. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
* tools: Specify QoS cube for data transfer flows0.13.0Dimitri Staessens2018-10-194-6/+10
| | | | | | | | | The ipcp connect command can now set a specific qos cube for data transfer flows. For management flows, the tool ignores this and defaults to raw until data flows are stable enough. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
* ipcpd: Check if there are entries to add to pffDimitri Staessens2018-10-191-3/+3
| | | | | | | | The pff didn't check if there were actually entries in the database, causing an assertion failure in some rare cases. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
* ipcpd, irmd: Handle signal in main threadDimitri Staessens2018-10-183-64/+52
| | | | | | | | | The signals are now handled in the main thread instead of an asynchronous signal handler. The acceptloop is now correctly cancelled and the associated timeouts are removed. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
* ipcpd: Send link state message before lsdb update0.12.3Dimitri Staessens2018-10-121-5/+4
| | | | | | | | | | When a new link is added, the link state update will be sent before the database update, so the network is a little bit more quickly aware. This improves odds of the DHT successfully enrolling at its first attempt, reducing bootstrap time of a network. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
* ipcpd: Configure DHT slack timer at build timeDimitri Staessens2018-10-123-1/+9
| | | | | | | This allows configuration of the DHT slack timer at build time. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
* ipcpd: Make Qdisc bypass configurableSander Vrijders2018-10-123-0/+7
| | | | | | | | This will make bypassing the qdisc configurable, as it might be handy for getting fast data rates but is generally needed. Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be> Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be>
* ipcpd: Call send_lsm under read lockSander Vrijders2018-10-111-0/+2
| | | | | | | | send_lsm was being called from the event handler as well as from lsupdate. The first one was not being locked properly. Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be> Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be>
* ipcpd: Take correct lock when updating statsSander Vrijders2018-10-111-2/+4
| | | | | | | | The lock of the wrong fd was taken when updating the stats in the DT component. Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be> Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be>
* ipcpd: Speed up enrolment of DHTDimitri Staessens2018-10-112-62/+68
| | | | | | | | | | | The link-state algorithm will now quickly recalculate for link additions (but not for removals, for stability). Upon notification of a new link, the DHT will wait for a brief moment to enroll. This reduces enrolment for large networks by some orders of magnitude. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
* ipcpd: Decouple flow allocator from dt threadDimitri Staessens2018-10-111-86/+176
| | | | | | | | The flow allocator passed a blocking callback to the forwarding component, which blocks packet processing. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
* ipcpd: Remove stale QoS cubesDimitri Staessens2018-10-103-17/+1
| | | | | | | | There were QoS cubes defined for raw and data flows, which are now run on the best effort cube. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
* ipcpd: Fix SEGV in eth IPCPDimitri Staessens2018-10-101-1/+6
| | | | | | | | The memcpy of the device name was copying a fixed set of bytes (IFNAMSIZ), but the string conf->dev is usually shorter. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
* include: Fix QoS include filesDimitri Staessens2018-10-064-3/+2
| | | | | | | A lot of files were unnecessarily including qoscube.h. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
* ipcpd: Remove dt_const header from normal IPCPSander Vrijders2018-10-051-39/+0
| | | | | | | | The dt_const header is a remnant from an earlier version of the DT PCI. It can be safely removed. Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be> Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be>
* lib: Rename port_id to flow_idDimitri Staessens2018-10-051-8/+8
| | | | | | | 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: Shorten packet_scheduler to pschedSander Vrijders2018-10-055-63/+63
| | | | | | | | This shortens packet_scheduler to psched, which results in more readable code. Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be> Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be>
* ipcpd, lib, irmd, tools: Change SDU to packetSander Vrijders2018-10-0510-196/+198
| | | | | | | | 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>
* ipcpd: Replace SAP with EID in raptor IPCPSander Vrijders2018-10-051-74/+74
| | | | | | | | This replaces Service Access Point with Endpoint Identifier in the raptor IPCP, since it better fits the 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-0510-83/+174
| | | | | | | | | | | | 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>
* ipcpd: Use non-blocking socket in Ethernet IPCPSander Vrijders2018-10-031-3/+17
| | | | | | | | | | Since the Ethernet IPCP now has multiple reader threads it was possible that both exit the select call, which caused one of the two threads to block on the recv call. This makes the socket non-blocking so that the recv call simply fails. Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be> Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be>
* build: Prioritize raw socket API in buildSander Vrijders2018-10-031-15/+18
| | | | | | | | This will change the build to exclusively select one raw socket API in case multiple are present in the sytem, which will simplify the code. Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be> Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be>
* ipcpd: Bypass Qdisc in Ethernet IPCPSander Vrijders2018-10-031-0/+8
| | | | | | | | Since Linux kernel 3.14 there is the option to bypass the kernel Qdisc. This will speed up the Ethernet IPCP. Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be> Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be>
* ipcpd: Fix build for netmap enabled Ethernet IPCPSander Vrijders2018-10-032-7/+9
| | | | | | | | | There were some compilation issues introduced by adding the interface monitor to the Ethernet IPCP. Furthermore it was not possible to select between raw sockets or netmap if both were available. Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be> Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be>
* ipcpd: Fix bad lock in Ethernet IPCPSander Vrijders2018-10-031-1/+1
| | | | | | | | An unlock was called twice instead of a lock/unlock sequence, causing a data race. Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be> Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be>
* ipcpd: Add multithreading to Ethernet IPCPDimitri Staessens2018-10-033-31/+63
| | | | | | | | | This adds multiple reader and writer threads, configurabe via cmake with IPCP_ETH_RD_THR and IPCP_ETH_WR_THR. Improves ethernet IPCP throughput, which looks to be limited by the raw socket calls. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
* ipcpd: Merge dt_pci into dt sourceDimitri Staessens2018-10-026-192/+91
| | | | | | | | This merges the dt_pci code into the dt source. It simplifies the code base, and allows inline compilation. Removes unnecessary includes. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
* ipcpd: Add return value checks to UDP IPCPSander Vrijders2018-09-271-17/+37
| | | | | | | Some return value checks were missing in the UDP IPCP. Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be> Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be>
* ipcpd: Fix test of routing table calculationSander Vrijders2018-09-271-4/+4
| | | | | | | | | A previous commit changes the signature of the function that calculates the routing table. The test was not changed accordingly, making make check fail. Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be> Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be>
* ipcpd: Remove double close in Ethernet IPCPSander Vrijders2018-09-271-2/+1
| | | | | | | | | There was a double close of a fd in the Ethernet IPCP. It also passes the correct max length to a memcpy (a strlen of the source string was used previously). Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be> Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be>
* include: Remove _DEFAULT_SOURCE in endian.hDimitri Staessens2018-09-2716-0/+62
| | | | | | | | 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: Simplify routing algorithm selectionSander Vrijders2018-09-143-89/+85
| | | | | | | | | | Previously there was a separate function per routing algorithm selection, when in fact the algorithms all take as input a graph and output a routing table, making it possible to place them in a single function. Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be> Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be>
* ipcpd: Check if mgmt flow event is FLOW_PKT0.11.12Sander Vrijders2018-07-271-1/+4
| | | | | | | | | The management flows were considering every event to be a FLOW_PKT event, when in fact it could also be a flow down or up event, resulting in indefinite reads. Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be> Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be>
* ipcpd: Fix sequence number check for link state0.11.11Sander Vrijders2018-07-251-11/+11
| | | | | | | | | Commit a3903da659e introduced sequence number for the LSAs to make it more robust, but the check was not done properly, and the seqno was always changed regardless of whether it was an old LSA or not. Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be> Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be>