summaryrefslogtreecommitdiff
path: root/src/ipcpd
Commit message (Collapse)AuthorAgeFilesLines
* lib, tools: Rename application process and instanceDimitri Staessens2017-12-0210-36/+35
| | | | | | | | | | | This refactors ouroboros to use "program" instead of "application process" and "process" instead of "application process instance" to align with current naming in current Operating Systems courses instead of the ISO nomenclature adopted by RINA. This change permeates through the entire implementation. Also contains some minor other refactors. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
* ipcpd: Don't read commands under lockDimitri Staessens2017-11-301-3/+3
| | | | | | | | | The commands were read under a mutex. Since the cmd struct was just malloc'd, this is not needed. Also fixes closing the socket if the malloc fails. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
* build: Remove unnecessary linker directivesDimitri Staessens2017-11-292-3/+3
| | | | | | | The ouroboros-dev library links against ouroboros-common. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
* ipcpd: Don't bind from the IPCPDimitri Staessens2017-11-292-11/+1
| | | | | | | | | | The binding of the normal IPCP to its name is moved from the source code to the irm tool introducing the "autobind" option for the bootstrap and enroll commands. With this option, the IPCP will be bound to the IPCP name and the DIF name automatically. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
* ipcpd: Only update DHT buckets in running stateDimitri Staessens2017-11-281-1/+2
| | | | | | | This fixes accessing buckets when a DHT join fails. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
* build: Unset SHIM_ETH_LLC_TARGETDimitri Staessens2017-11-191-0/+1
| | | | | | | | This fixes the IRMd thinking a shim-eth-llc is available after it is disabled by configuring Ouroboros using ccmake. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
* build: Define HAVE_LIBGCRYPT for IPCPsDimitri Staessens2017-11-181-0/+2
| | | | | | | | The HAVE_LIBGCRYPT variable was not defined for IPCPs, causing them to call the gcrypt functions with the wrong values for the enum. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
* build: Fix setting configuration definitionsDimitri Staessens2017-11-182-2/+9
| | | | | | | | Variable in cache need to be explicitly unset else they will remain in the cache and still be defined by #cmakedefine. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
* ipcpd: Add return statement in eth-llc loopDimitri Staessens2017-11-151-0/+2
| | | | | | | | Some compiler versions complained about a missing return in non-void function. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
* ipcpd: Reset *dist on graph_routing_table failDimitri Staessens2017-11-151-0/+1
| | | | | | | | | | The *dist pointer was not reset on failure, causing the caller to try to free an unmalloced or already freed pointer. Reported-by: Nick Aerts <nick.aerts@ugent.be> Tested-by: Nick Aerts <nick.aerts@ugent.be> Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
* build: Add options for debug builds with sanitizerDimitri Staessens2017-11-144-8/+8
| | | | | | | | | This adds three build types, DebugASan, DebugTSan and DebugLSan that enable the Address, Thread and Leak Sanitizer by setting the fsanitize flag to the compiler. This option is supported by both gcc and clang. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
* ipcpd: Fix unused label with netmap for LLC shimDimitri Staessens2017-11-101-1/+3
| | | | | | | | When the netmap driver is used for the LLC shim, the label fail_device: was never used, resulting in a compiler error. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
* ipcpd: List adjacencies in link-state databaseDimitri Staessens2017-11-071-4/+27
| | | | | | | The lsdb will now list management and data transfer adjacencies. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
* ipcpd: Create new SDUs for DHT join retriesDimitri Staessens2017-11-071-15/+15
| | | | | | | | | | The DHT join operation left an SDU in the rdrbuff for a couple of seconds during retries, which may cause the system to block if there is heavy traffic. This patch releases the sdb when the write fails and creates a new packet for every retry. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
* lib: Deprecate ouroboros_init and ourboros_finidimitri staessens2017-10-1413-33/+16
| | | | | | | | | | | | | | This commit deprecates ouroboros_init and ouroboros_fini and adds them as a constructor or destructor, causing these function to be run automatically when a program that links to the library calls and exits main(). For this to fully work, the library had to be split so that we can avoid the irmd calling these functions (the IRMd has to create the shm structures on which these calls depend). The library is split in 3 parts: libouroboros-dev, libouroboros-irm and libouroboros-common. The latter is linked to the other two so that including libouroboros-dev or libouroboros-irm will also link libouroboros-common.
* ipcpd: Fix unreachable code in shim-eth-llcdimitri staessens2017-10-111-1/+9
| | | | | Closing the file descriptor after a while(true) loop led to clang compiler errors. This is fixed by adding a cleanup handler.
* ipcpd: Handle cancellation while writing LSAsdimitri staessens2017-10-071-1/+4
| | | | | | | | | | This adds a cleanup handler to ensure the lock is released in the event that the thread is cancelled during a write. An alternative solution could be to make the flow write in a non-blocking way (only the blocking write contains an execution path that has a cancellation point). Fixes #55
* lib: Cancel tpm threads instead of marking exitdimitri staessens2017-09-302-78/+94
| | | | | | | | | This makes the threadpool use pthread_cancel instead of setting an exit flag that threadpool managed threads check periodically. This drastically reduces CPU consumption in the irmd when running a lot of applications. It requires cancellation handlers in the ipcp and irmd to be implemented to ensure safe cancellation during operation and shutdown.
* ipcpd: normal: React to flow events in link state policySander Vrijders2017-09-293-4/+56
| | | | | | This will let the link state policy react to flow up and down events by notifying the PFFs of the routing instances of this event so they can take an appropriate action.
* ipcpd: normal: Add Loop-Free Alternates routingSander Vrijders2017-09-296-32/+199
| | | | | | This adds the Loop-Free Alternates (LFA) policy. In case a link goes down a LFA may be selected to route the SDUs on without causing loops instead of the main hop that just went down.
* Merged in sandervrijders/ouroboros/be-routing (pull request #617)Sander Vrijders2017-09-264-189/+288
|\ | | | | | | Be routing
| * ipcpd: normal: Add refcount to graph edgesSander Vrijders2017-09-263-22/+53
| | | | | | | | | | This adds a refcount to the graph edges so that it is only included in the calculation if both sides announced it.
| * ipcpd: normal: Keep index in vertex structSander Vrijders2017-09-252-27/+24
| | | | | | | | | | This keeps the index in the vertex struct so that is more easily available during Dijkstra.
| * ipcpd: normal: Simplify Dijkstra implementationSander Vrijders2017-09-251-25/+17
| | | | | | | | | | | | This simplifies the Dijkstra implementation by immediately setting the correct next hop during Dijkstra instead of looping through the list of predecessors afterwards.
| * ipcpd: normal: Simplify internal graph functionsSander Vrijders2017-09-251-38/+26
| | | | | | | | | | This simplifies several internal graph functions by passing an array of bools instead of an array of vertices.
| * ipcpd: normal: Return list as routing tableSander Vrijders2017-09-254-106/+197
| | | | | | | | | | | | This returns a list as routing table instead of a pointer to a pointer to a pointer, which simplifies the looping through the routing table and makes it more extensible for future additions.
* | Merged in sandervrijders/ouroboros/be-dht-fix (pull request #618)Sander Vrijders2017-09-261-3/+3
|\ \ | | | | | | | | | ipcpd: normal: Set clock to realtime clock
| * | ipcpd: normal: Set clock to realtime clockSander Vrijders2017-09-261-3/+3
| |/ | | | | | | | | | | A pthread_cond_wait was using the pthread_cond_clock and thereby timing out constantly, consuming 100% CPU. This changes it to use the realtime clock.
* / ipcpd: Add multiplier to scale scheduler threadsdimitri staessens2017-09-253-10/+14
|/
* ipcpd: Fix deadlock in DHTdimitri staessens2017-09-241-27/+41
| | | | | | | | | | | | | The lookup_update was waiting for the LU_INIT state to resolve under dht->lock which prevented that update. This PR fixes this bug, but leaves a (very rare) bug when the lookup_destroy is called while the lookup_update is waiting for the LU_INIT state to resolve. The solution also is a (harmless) lock inversion, but this is also not the best. Fixes #51 Fixes #52
* ipcpd: Add threadpool manager to DHTdimitri staessens2017-09-243-185/+262
| | | | | | | | | | | This adds a threadpool manager to the DHT. This was needed because the detached thread could cause a data race on shutdown. The threadpool manager is revised to allow multiple instances in a single program. The irmd and ipcp now store commands in a buffer (list) instead of a single buffer before passing it to handler threads.
* Merged in dstaesse/ouroboros/be-bugfixes (pull request #614)dimitri staessens2017-09-231-30/+85
|\ | | | | | | Some bugfixes
| * ipcpd: Don't publish DHT entries under lockdimitri staessens2017-09-231-30/+85
| |
* | Merged in dstaesse/ouroboros/be-bugfixes (pull request #613)dimitri staessens2017-09-232-9/+17
|\| | | | | | | Some bugfixes
| * ipcpd: Lock dht before reading parametersdimitri staessens2017-09-231-7/+14
| |
| * ipcpd: Fix data race in shim-udpdimitri staessens2017-09-231-2/+3
| | | | | | | | | | This fixes a data race in the shim-udp where the alloc_lock was released before the ipcpi.alloc_id was set.
* | ipcpd: Fix DHT recursive lookupdimitri staessens2017-09-221-1/+4
|/
* ipcpd: Mark len parameter as unused in simple_pffdimitri staessens2017-09-211-0/+4
|
* Merged in dstaesse/ouroboros/be-cancel (pull request #609)dimitri staessens2017-09-213-72/+85
|\ | | | | | | ipcpd: Cancel threads in IPCPs
| * ipcpd: Cancel threads in IPCPsdimitri staessens2017-09-213-72/+85
| | | | | | | | | | | | This reduces CPU consumption and shutdown times. Invalidates #43
* | Merged in sandervrijders/ouroboros/be-lfa-pff (pull request #607)Sander Vrijders2017-09-217-13/+482
|\ \ | |/ |/| | | ipcpd: normal: Add alternate hop PFF
| * ipcpd: normal: Add alternate hop PFFSander Vrijders2017-09-217-13/+482
| | | | | | | | | | This adds a PFF that returns an alternate hop as next hop in case the hop that would have been returned is down.
* | ipcpd: Use the kernel scheduler for QoSdimitri staessens2017-09-213-61/+106
|/ | | | | | | | | This revises the sdu_scheduler of the normal IPCP to create a scheduler thread per QoS cube and let the kernel scheduler schedule them based on a priority. Priorities can be set at build time in a range of 0-100, which will be mapped onto a suitable priority for the kernel scheduler. The current scheduler policy is fixed to SCHED_RR since it is the most suitable scheduler defined by POSIX.
* lib: Pass the fuse struct to the handling threaddimitri staessens2017-09-211-1/+1
| | | | This avoids potential data races on rib.fuse.
* Merged in dstaesse/ouroboros/be-dht-revision (pull request #605)dimitri staessens2017-09-211-15/+58
|\ | | | | | | ipcpd: Handle DHT SDUs in different thread
| * ipcpd: Handle DHT SDUs in different threaddimitri staessens2017-09-201-15/+58
| | | | | | | | | | | | | | The DHT will now spawn a thread when receiving SDUs to avoid starvation of sdu scheduler threads. Also fixes some locking issues.
* | ipcpd: normal: Make PFF policy-basedSander Vrijders2017-09-2015-135/+399
|/ | | | | This turns the PDU Forwarding Function of the IPCP into a policy. For now only the simple PFF policy is available.
* Merged in dstaesse/ouroboros/be-dht-query-refuse (pull request #601)dimitri staessens2017-09-191-0/+3
|\ | | | | | | ipcpd: Refuse query when DHT not in running state
| * ipcpd: Refuse query when DHT not in running statedimitri staessens2017-09-191-0/+3
| |
* | ipcpd: Fix contact list in DHTdimitri staessens2017-09-191-3/+3
|/