summaryrefslogtreecommitdiff
path: root/src/irmd/main.c
Commit message (Collapse)AuthorAgeFilesLines
* irmd: Remove obsolete layer to name mappingsDimitri Staessens2018-03-211-10/+0
| | | | | | | | The IRMd kept a mapping from layer names to registered names, but this is obsolete since the introduction of the query functionality. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
* irmd: Cleanup flow datastructures on exit0.10.3Dimitri Staessens2018-02-241-5/+12
| | | | | | | | | The irmd was not cleaning up non-deallocated flows upon exit. This bug was probably introduced with the introduction of the threadpool managers. Also fixes a missing rwlock_destroy(). Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
* irmd: Remove dead variable assignmentsSander Vrijders2018-02-241-2/+0
| | | | | | | | This removes two useless variable assignments from the IRMd, which were remnants from when the pending flow was being deallocated. Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be> Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be>
* irmd: Replace fork and execv with posix_spawnSander Vrijders2018-02-231-15/+10
| | | | | | | | | This replaces the fork and execv calls with posix_spawn since it is supported on more platforms, and is more efficient. Also fixes some bad indentation. Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be> Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be>
* ipcpd: Revise Data Transfer component0.10.0Dimitri Staessens2018-02-131-41/+41
| | | | | | | | | | | This makes the TTL non-optional and allows the maximum (initial) value of the TTL to be specified at bootstrap (the default is set to 60). The fd in the DT PCI is now called EID (Endpoint ID). The names "dif" and "ae" have been replaced by "layer" and "component" respectively in all sources. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
* irmd: Fix lookup of program for autoexecution0.9.8Dimitri Staessens2018-02-051-2/+2
| | | | | | | | Autoexecution failed because the lookup for the program was for the wrong field of the progtable. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
* include: Add version header0.9.0Dimitri Staessens2018-01-101-0/+1
| | | | | | | | This moves the version definition for Ouroboros into its own header file, which is generated by CMake and installed on the system. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
* build: Add patchlevel to versionDimitri Staessens2018-01-101-2/+3
| | | | | | | This adds a patchlevel to the Ouroboros version. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
* include, src: Update copyright to 2018Dimitri Staessens2018-01-091-1/+1
| | | | | | | Happy New Year, Ouroboros. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
* ipcpd: Use the term "layer" and deprecate "shim"Dimitri Staessens2017-12-191-3/+3
| | | | | | | | | | | | | | This changes the terminology to use layer instead of DIF and deprecate the word "shim" for the IPCPs that attach to Ethernet LLC and UDP .The terminology has not yet been changed in the variable names etc. This reflects the design choices in Ouroboros to make IPCPs pure resource allocators instead of also providing an "IPC service". The Ouroboros IPCPs that attach to Ethernet and UDP implement the allocator and are thus not really shims. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
* lib, tools: Rename application process and instanceDimitri Staessens2017-12-021-300/+303
| | | | | | | | | | | 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>
* irmd: 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>
* ipcpd, irmd: Bugfix for failed accept() callsDimitri Staessens2017-11-291-3/+0
| | | | | | | | | The ipcp will not have the rx_rb set for a pending flow, so it should not call shm_rbuff_fini. The irmd should not call ipcp_flow_dealloc for flows that are still pending flow allocation. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
* irmd: Don't access entry after unlockDimitri Staessens2017-11-141-1/+1
| | | | | | | | When bootstrapping an IPCP entry->api variable was accessed after the registry was unlocked for printing and info message. 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-141-1/+0
| | | | | | | | | | | | | | 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.
* irmd: Add option to print versiondimitri staessens2017-10-061-9/+16
| | | | | | | | | This adds the --version option to the IRMd. With this option it will print the version of Ouroboros to stdout and exit. Checking the version does not require root privileges. Also fixes calling log functions before log_init() and after log_fini().
* irmd: Don't destroy flows before IPCPsdimitri staessens2017-10-041-22/+1
| | | | | | This allows the IPCPs to call ouroboros_fini() and clean up their buffers and drastically reduce chances of getting an assertion error that some rbuffs are not empty when shutting down the irmd.
* lib: Cancel tpm threads instead of marking exitdimitri staessens2017-09-301-54/+32
| | | | | | | | | 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: Add threadpool manager to DHTdimitri staessens2017-09-241-49/+55
| | | | | | | | | | | 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.
* irmd: Init libgcrypt before using itdimitri staessens2017-09-201-0/+16
|
* lib: Provide RIB API to export internals via fusedimitri staessens2017-09-181-1/+11
| | | | | | | This adds a virtual RIB that is accessible as a filesystem that is accessed through a fuse mountpoint (configurable , default is /tmp/ouroboros). Currently, each IPCP will export its link state database.
* irmd: Fix deleting corrupt shm fileSander Vrijders2017-08-291-1/+1
| | | | | This will delete the rdrbuff also when it has been corrupted before. Otherwise the irmd won't start, as experienced on my desktop.
* ipcpd: Fix state in dht lookup at lookup_waitdimitri staessens2017-08-291-24/+48
| | | | | | | | | | | The correct state was returned but not set internally in the lookup_struct, causing lookup_wait to return a lookup in LU_PENDING if the wait timedout. This also unlocks the IRMd during register calls and fixes some cleanup if lookup_wait gets interrupted. Fixes #48
* lib, ipcpd, irmd: Fix bugs reported by static analysisSander Vrijders2017-08-291-0/+11
| | | | This fixes several bugs as reported by the clang static analyzer.
* tools: Add tool to connect IPCP componentsdimitri staessens2017-08-281-0/+82
| | | | | | | | | | | | This enables user-written tools to instruct IPCPs to establish and tear down connections (a.k.a. adjacencies) between its internal components (Management and Data Transfer). For more info, do "irm ipcp connect" or "irm ipcp disconnect" on the command line. This commit exposes a deletion bug in the RIB where FSO's fail to unpack/parse. This will be fixed when the RIB is deprecated.
* irmd: Don't warn on failed write to terminated IPCPdimitri staessens2017-08-251-1/+2
|
* lib, ipcpd, irmd: Fix several memleaksSander Vrijders2017-08-231-4/+2
| | | | | This fixes several memleaks as reported by valgrind. It also fixes some calls to close() with -1.
* Merge branch 'testing' into beSander Vrijders2017-08-231-3/+5
|\
| * irmd: Fix potential data race in irmdSander Vrijders2017-08-231-3/+5
| | | | | | | | | | If the IPCP was not created, the printing of the log may use a variable that was already freed.
* | Merged in dstaesse/ouroboros/be-build (pull request #557)dimitri staessens2017-08-211-2/+6
|\ \ | |/ |/| | | build: Revise the build system
| * build: Revise the build systemdimitri staessens2017-08-211-2/+6
| | | | | | | | | | | | | | | | | | | | This revises the build system to have configuration per system component. System settings can now be set using cmake. The standard compliance defines were removed from configuration header and are set in the sources where needed. Also some small code refactors, such as moving the data for shims out of the ipcp structure to the respective shims were performed.
* | ipcpd, irmd: Fix data racesdimitri staessens2017-08-191-16/+32
|/ | | | | | Fixes a data race in the IRMd when IPCPs bail immediately after being created (e.g. due to an error). Fixes a race between the acceptor threads and the threads managed by threadpool manager upon shutdown.
* irmd: Handle IPCP creation fails gracefullydimitri staessens2017-08-171-6/+28
|
* irmd, ipcpd: Signal acceptor onlydimitri staessens2017-08-161-3/+13
| | | | | This adds an extra condvar so the mainloops can signal the acceptor thread without waking up all mainloops.
* irmd, ipcpd: Listen on a dedicated accept() threaddimitri staessens2017-08-161-70/+177
| | | | | | | | | | | The IRMd and IPCPs will now call accept on their command sockets from a single thread that will dispatch work to the other threads. This solves a problem on OS X and FreeBSD where accept() doesn't time out when setting SO_RCVTIMEO on the socket. Calling kqueue or select() on that socket to wait for events before calling accept() didn't solve it since select() or kqueue() might wake up multiple threads, with the non-working threads again blocked on the accept() on shutdown.
* build: Replace fsf snail mail with contact URLdimitri staessens2017-08-131-1/+1
|
* irmd: Fix mainloop timeout on OS Xdimitri staessens2017-08-111-2/+2
|
* build, lib, ipcpd, irmd: Add support for libgcryptdimitri staessens2017-08-091-21/+8
| | | | | | | | | | | | | | | | This adds support for libgcrypt. If at least version 1.7.0 of libgcrypt is present, it may be used for secure random number generation and is used for hashing in the irmd/ipcp. The hash definitions are moved to the internal hash.h header, and defined independently of the hashes that are defined as part of the directory policy for the normal IPCP. The translation is moved from the IRMd to ipcpd/ipcp.h. The bootstrap call from the IRMd expects the IPCP to return the correct hash algorithm with a dif_info struct, which is in line with the behavior of the enroll call. This also improves how some platform checks in the build system are handled.
* irmd: Don't self-query an IPCPDimitri Staessens2017-08-051-4/+5
| | | | | | Upon flow_allocation, the IRMd queries IPCPs for the destination name. After this commit, when an IPCP allocates a flow, the IRMd won't query that IPCP.
* irmd: Don't call ipcp_flow_dealloc under lockDimitri Staessens2017-08-051-3/+13
| | | | | | | | | | When a process was killed, ipcp_flow_dealloc was called under a lock, causing a deadlock in the IRMd because handling the IPCP response also needs to take the same lock (the IPCP calls flow_dealloc to finalize this). This deadlock also resulted in the IPCP always reporting that it failed to send a reply message as the deadlock effectively blocks the IRMd until its socket timeout expired and thus the IPCP was always responding to an already closed socket.
* Merge branch 'testing' into beSander Vrijders2017-08-041-8/+16
|\
| * irmd: Release lock before ipcp_querydimitri staessens2017-08-041-8/+16
| | | | | | | | | | | | The blocking ipcp_query call was called under reg_lock, causing flow_allocs over the shim-eth-llc to block the irmd for prolonged timespans.
* | lib: Add threadpool managerdimitri staessens2017-07-261-183/+26
| | | | | | | | | | | | | | | | This adds a threadpool manager component in the library that is used in the IRMd and IPCPs. The threadpool manager now doesn't detach threads but does a join when they exit. This solves a data race in the previous implementation where some threads were not completely finished upon release of some resources.
* | irmd: Fix order of IPCPsSander Vrijders2017-07-181-1/+1
|/ | | | | This fixes the order of the IPCPs in the IRMd, so that the right type is queried first on flow allocation.
* ipcpd, lib, irmd: Hardcode shim hash algorithmsSander Vrijders2017-07-121-2/+16
| | | | | | | This will hardcode the shim hash algorithms as they don't have an enrollment phase. Fixes #44
* irmd: Shutdown sanitizer without cancellationdimitri staessens2017-07-121-6/+3
|
* Merged in dstaesse/ouroboros/be-macro (pull request #514)dimitri staessens2017-06-051-1/+1
|\ | | | | | | include: Fix macro for printing hash
| * include: Fix macro for printing hashdimitri staessens2017-06-041-1/+1
| |
* | lib, irmd: Handle case fallthrough in gcc 7dimitri staessens2017-06-041-0/+1
|/
* ipcpd: Allow specifying fixed syntaxdimitri staessens2017-05-151-4/+4
| | | | | | This commits adds the functions and messages to specify a fixed protocol syntax during CACEP. It also revises the messages for specifying the DT protocol syntax from the irm tool.