summaryrefslogtreecommitdiff
path: root/src/irmd/main.c
Commit message (Collapse)AuthorAgeFilesLines
...
* irmd, lib: Rebuild the IRMd data modeldimitri staessens2016-08-211-272/+496
| | | | | | | | | | | | | | | | | | | | | | The complete data model inside the IRMd has been restructured. The bind operation was revised to allow binding of AP and AP instances and register those names with different DIFs (see "irm bind" for details). Server applications require to call ap_init with a server name argument, client application that do not the be reachable over any DIF can call ap_init(NULL). Calling ap_init for a client with a specified name will not have adverse consequences for the application, but will consume unnecessary resources in the IRMd. Application servers can now be started at any point after the IRMd has been started. Starting servers, binding AP names and registering names in DIFs can be performed in any order that does not defy temporal logic. Supports naming instances by their pid. In case of IPCP Instances created with the IRM tool, the name assigned during "irm ipcp create" can be used. All the changes required updates in the tools.
* Merged in dstaesse/ouroboros/be-api-bind (pull request #203)Sander Vrijders2016-08-101-4/+71
|\ | | | | | | lib, irmd: Bind AP instances to AP_subsets
| * lib, irmd: Bind AP instances to AP_subsetsdimitri staessens2016-08-101-4/+71
| | | | | | | | | | | | | | This call will allow grouping AP instances of a certain AP together which are configured identically. Adds the bind operation to dev and updates the applications to make use of this call. Flow_alloc is now only called with the pid and doesn't send the apn anymore.
* | lib, irmd, ipcp: Add socket timeoutSander Vrijders2016-08-101-7/+10
|/ | | | | | This will add a timeout to the socket so that a process won't be blocked by the actions of the process with which it is communicating over the socket.
* Merge branch 'be' of bitbucket.org:ouroboros-rina/ouroboros into be-bugfixingdimitri staessens2016-08-101-2/+61
|\
| * Merged in sandervrijders/ouroboros/be-create-ipcp (pull request #200)dimitri staessens2016-08-101-2/+48
| |\ | | | | | | | | | ipcp, irmd, lib: Notify IRMd upon IPCP initialization
| | * ipcp, irmd, lib: Notify IRMd upon IPCP initializationSander Vrijders2016-08-101-2/+48
| | | | | | | | | | | | | | | | | | This will notify the IRMd when the IPCP is initialized and ready to receive messages. Previously a bootstrap could fail since the IPCP was not listening to the socket yet.
| * | Merged in sandervrijders/ouroboros/be-bootstrap (pull request #199)dimitri staessens2016-08-101-0/+13
| |\ \ | | | | | | | | | | | | Several small fixes and enhancements
| | * | irmd: Remove IPCP from list upon errorSander Vrijders2016-08-101-0/+13
| | |/ | | | | | | | | | | | | | | | | | | If an IPCP crashes (due to a segfault for instance), it is removed from the spawned apis list. However, if it was an IPCP it should also be removed from the IPCPs list, since else on shutdown, the irmd will try to destroy the IPCP that crashed.
* | / irmd: Graceful shutdowndimitri staessens2016-08-101-51/+43
|/ / | | | | | | | | | | Threads from the threadpool will now check the state of the IRMd and exit gracefully without a need to cancel them. This avoids the unsafe call of pthread_cancel in the signal handler.
* / irmd: Fix lockingdimitri staessens2016-08-091-2/+2
|/ | | | registry_sanitize_apis should be called under write locked reg_lock.
* irmd: Fix some locking issuesdimitri staessens2016-08-091-3/+4
|
* irmd: Close filedescriptor on exitdimitri staessens2016-08-091-8/+10
|
* lib: Various fixesdimitri staessens2016-08-091-3/+13
| | | | | Fix missing set of api upon flow_alloc. Various locking fixes.
* irmd: Refactor and bugfixesdimitri staessens2016-08-081-189/+131
| | | | | | | Refactors the IRMd to extract reg_api and irm_flow structures to their own sources. Fixes some locking bugs.
* irmd: Remove ipcp type from registration messagedimitri staessens2016-08-041-2/+2
|
* tools: oping: Fix division by zerodimitri staessens2016-08-041-4/+4
| | | | | When killing the oping client before it sent an SDU, some bad operations were being performed.
* irmd: Fix potential object access after freedimitri staessens2016-08-041-0/+1
|
* irmd: Fix destroying allocated flowsdimitri staessens2016-08-041-7/+16
| | | | | When a flow was in FLOW_ALLOCATED state, it would not change to NULL state and irm_flow_destroy would hang forever.
* ipcpd: Fix memory leaksdimitri staessens2016-08-041-1/+1
| | | | ipcp-data was not correctly destroyed.
* lib: Portability to FreeBSDdimitri staessens2016-07-291-22/+24
| | | | | | | | | | Various portability fixes for FreeBSD. POSIX requires shm file names to start with a "/" to be portable. lseek(2) can be undefined on POSIX shm, replaced with ftruncate(2). IRMd check on existing lockfile more portable. FreeBSD 11.0 is preferred as it natively supports robust mutexes. Full working LLC implementation pending.
* irmd: Fix allocation resultdimitri staessens2016-07-281-10/+6
| | | | | It was missing the FLOW_PENDING state. All states that are not FLOW_ALLOCATED should return -1. This is now fixed.
* irmd: Fix shutdowndimitri staessens2016-07-271-9/+9
| | | | | | | | When a pending accept is shutdown on irmd exit, there are no more threads running, but it should also change the state to NULL. This is now correctly handled in the cleanup of the cancellation point. Also fixed a busy wait with a condition variable.
* irmd: Revised flow allocationdimitri staessens2016-07-271-419/+393
| | | | | | | | | Flow allocation requests and registered api states revised so all states are tracked with a condition variable. This is a more reliable approach and improves stability of flow allocation. Some other refactoring was also done, such as renaming port_map_entry to irm_flow and hiding some internal structures of the registry.
* irmd: Fix accessing reg_api struct after destroydimitri staessens2016-07-151-0/+30
| | | | | The destroy now only frees after all threads stopped using the object. Also fixes a SEGV when trying to allocate a flow to a remote name.
* irmd: Fix AE name always set to NULLdimitri staessens2016-07-141-5/+6
|
* lib: Remove N-1 DIF param from enroll operationSander Vrijders2016-07-121-13/+1
| | | | | | This removes the parameter N-1 DIF from the enroll operation. IPCPs should just allocate a flow to a DIF name and let the N-1 DIF resolve it.
* irmd: Refactor of registrydimitri staessens2016-07-111-114/+59
| | | | | | Easier names for the functions.The registry now uses a single list to keep track of applications (bindings), moved the auto_exec state per binding.
* irmd: Prioritize local ipcp for local flowsdimitri staessens2016-07-071-44/+84
| | | | | | | | | | For locally registered processes, the IRMd will first look for the local, then the normal, then the shim-udp. It will look for a normal, a shim-eth-llc and ultimately a shim-udp for non-local destinations. It does not yet check if a remote destination is actually known in a DIF. Fixes #18.
* ouroboros: Use ouroboros errno.hdimitri staessens2016-07-071-1/+1
| | | | | All includes of <errno.h> within ouroboros are replaced with the ouroboros errno.
* lib: Add lockfiledimitri staessens2016-07-071-11/+21
| | | | | | | | | | | | The pid of the IRMd is stored in a lockfile in shared memory. This makes checking if the IRMd is running independent of the configuration, as previously the IRMd pid was stored at the end of the shm_du_map, which could not be read by an IRMd that would be compiled with different configuration options. Also corrects some unnecessary includes Fixes #21.
* irmd, ipcps: Close logfile on exitdimitri staessens2016-07-071-3/+5
| | | | | | | IRMd and ipcps will now close the logfile upon exit. Also corrects exit(1) to exit(EXIT_FAILURE) and exit(0) to exit(EXIT_SUCCESS).
* lib:irmd: Fix logs and irm_createdimitri staessens2016-07-061-11/+17
| | | | | | | The irm_create() function called irmd_destroy before some key values were initialized. Logs cleanup was missing.
* Merge branch 'be' of bitbucket.org:ouroboros-rina/ouroboros into be-clean-exitdimitri staessens2016-07-061-1/+66
|\
| * Merge remote-tracking branch 'upstream/be' into beSander Vrijders2016-07-061-36/+109
| |\
| * | lib, irmd, ipcpd: Provide the feature to write to logsSander Vrijders2016-07-061-1/+67
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Writing output to log files is now enabled by default. Logs are written to <INSTALL_PREFIX>/var/log/ouroboros, which is created on install. There is a log file for the irmd and one per IPCP. To still get (colored) output on stdout, provide the --stdout switch when starting the irmd. Fixes #17
* | | lib: shm_du_map: Clean sdus upon exitdimitri staessens2016-07-061-0/+1
| |/ |/| | | | | | | | | | | | | When an application closes the shm_du_map, it will clean all remaining sdu's for that application. Adds a function to clean the shm_du_map on close. Fixes #20.
* | irmd: Collect spawned processesdimitri staessens2016-07-061-28/+101
| | | | | | | | | | | | | | The irmd will now collect terminated child processes (autostarted api's and ipcpd's). Upon exit, all autostarted api's will be killed. Fixes #19.
* | irmd: Rename registry functionsdimitri staessens2016-07-061-7/+8
|/ | | | | Reflects that the functions (dis)associate an application instance from/with a name and not remove it from the registry entirely.
* lib: Change invalid pid to -1dimitri staessens2016-07-051-8/+12
| | | | | | | | The stack used pid 0 (the scheduler) to indicate an invalid process instance, probably as a leftover from the deprecated application process instance id. Using -1 is a better solution. Fixes #16.
* irmd: Move registry to its own sourcesdimitri staessens2016-07-051-632/+22
| | | | | All registry functionality has been extracted from the IRMd to improve modularity and legibility of the code.
* lib, irmd: Fix clang and CI compilation errorsSander Vrijders2016-07-051-1/+1
| | | | | | This commit fixes some errors reported during compilation that were undiscovered by my gcc compiler but found by clang, and errors not found on my system but found by the CI platform.
* Merge remote-tracking branch 'upstream/be' into beSander Vrijders2016-07-051-0/+7
|\
| * lib: irm: search for ap using PATH variabledimitri staessens2016-07-041-0/+7
| | | | | | | | | | | | | | | | | | The bind function will search all directories specified in the PATH variable for the ap fed to the irm bind command and check if it is executable by the uid executing irm bind command. Adds missing info logs for the bind/unbind and unreg operations in the irmd.
* | lib: Provide first implementation of revised CDAPSander Vrijders2016-07-051-4/+4
|/ | | | | | | | This commit introduces a first version of the revised CDAP specification. CACEP (for authentication purposes) has been separated from CDAP. Application developers may use CDAP if they find it useful. Within Ouroboros CDAP will be used to perform operations on the RIB of an IPCP.
* irmd: fix missing gbp messagesdimitri staessens2016-07-031-3/+12
| | | | | When empty, gpb does not send a message. Functions that return null will now send a message with return value set to -1.
* irmd, tools: checks on binarydimitri staessens2016-07-031-1/+13
| | | | | | | The bind tool and the auto_execute function will check if the binary exists and is executable. Return value of auto_execute corrected to pid_t
* lib: robust locking in shared memory and crash recoverydimitri staessens2016-07-021-4/+14
| | | | | | | | | | | | | | This PR enhances the shared memory providing recovery if a process crashes. It adds a SHM_DU_TIMEOUT_MICROS variable, setting an expiration time for SDU's when shared memory is full. If an application doesn't read a blocking SDU within this time, the shared memory will be cleansed of all SDU's for this application and the application's rbuff will be cleared. Some refactoring of the API's. Fixed wrong pthread checks in IRMd. Fixes #13 Fixes #14
* irmd: corrected if( statementsdimitri staessens2016-06-291-4/+4
|
* irmd: fix lockup and skipped cond_signaldimitri staessens2016-06-291-9/+15
|