summaryrefslogtreecommitdiff
path: root/src/irmd/main.c
Commit message (Collapse)AuthorAgeFilesLines
* build: Update copyright to 20200.16.0Dimitri Staessens2020-01-021-1/+1
| | | | | Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
* irmd: Check if entry actually existsSander Vrijders2019-10-061-0/+5
| | | | | | | | | The prog table was consulted for a name of a program, which may not exist, thus prog_entry_del_name potentially got a NULL reference passed. Signed-off-by: Sander Vrijders <sander@ouroboros.rocks> Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks>
* irmd, lib: Improve libgcrypt initDimitri Staessens2019-07-291-4/+13
| | | | | | | | | | The proper initialization of libgrypt requires a call to gcry_check_version. The library initialization should first run a check if the application (or some other library) hasn't already initialized libgcrypt before attempting to initialize libgcrypt. Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
* build: Refactor normal to unicastDimitri Staessens2019-07-291-2/+2
| | | | | | | | This completes the renaming of the normal IPCP to the unicast IPCP in the sources, to get everything consistent with the documentation. Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
* irmd: Don't destroy shm_flow_set from IRMdDimitri Staessens2019-03-121-5/+0
| | | | | | | | | The shm_flow_set for the processes are now created and destroyed together with the irm_flow objects. This old code causes stack overflows in some (rare) conditions and must be removed. Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
* build: Update copyright to 2019Dimitri Staessens2019-02-051-1/+1
| | | | | | | 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>
* include: Add a flow_join operation for broadcastDimitri Staessens2018-12-271-9/+47
| | | | | | | | | | | | 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: Add broadcast IPCPDimitri Staessens2018-10-241-1/+1
| | | | | | | | | | 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-191-3/+5
| | | | | | | | | 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, irmd: Handle signal in main threadDimitri Staessens2018-10-181-73/+43
| | | | | | | | | 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>
* irmd: Don't warn if server leavesDimitri Staessens2018-10-121-3/+1
| | | | | | | | | The irmd would log a warning when a server application quits during an accept call, but this is just a normal event. This removes the warning log. 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-051-61/+61
| | | | | | | 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-051-1/+1
| | | | | | | | 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-051-9/+13
| | | | | | | | | | | | 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>
* irmd: Add missing unlocks and avoid NULL dereferenceSander Vrijders2018-09-271-22/+24
| | | | | | | | There were missing unlocks in certain error conditions and some NULL pointers were passed to strcmp which is undefined behavior. 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-271-2/+5
| | | | | | | | 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>
* irmd: Remove shm_sanitizer threadDimitri Staessens2018-06-081-46/+0
| | | | | | | | | | 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>
* irmd: Retry bind for live processesDimitri Staessens2018-06-061-5/+20
| | | | | | | | | If bind was called before the process registered with the IRMd, the bind operation would fail. The IRMd will now wait for a short period until the process is registered or exits. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
* irmd: Fix comparison of uninitialized valueDimitri Staessens2018-05-271-0/+1
| | | | | | | The result value was not set in the case of an unknown message code. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
* irmd: Fix use-after-free in mainloopDimitri Staessens2018-05-071-75/+50
| | | | | | | | | | The ret_msg struct was free'd but its result could be accessed after a failed write. Fixed by storing the results of the commands in a temporary variable and accessing this upon write failure. Also simplifies some other code. 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-2/+2
| | | | | | | | | | 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>
* irmd: Shut down IPCPs before IRMd internalsDimitri Staessens2018-04-261-18/+20
| | | | | | | | | This will shut down IPCPs before destroying IRMd internals. This fixes warnings from IPCPs trying to send messages and send packets upon IRM shutdown. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
* irmd: Fix unreachable statement0.11.1Dimitri Staessens2018-03-281-1/+0
| | | | | | | The unreachable statement was missed by some compilers. 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-15/+9
| | | | | | | | | 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-221-368/+401
| | | | | | | | | | | | | | | | | | | | 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>
* 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.