summaryrefslogtreecommitdiff
path: root/src/ipcpd/shim-udp/main.c
Commit message (Collapse)AuthorAgeFilesLines
* ipcpd: shim-udp: Add check for directory entrySander Vrijders2016-10-261-0/+5
| | | | | | A check was missing in the shim UDP if the destination was already present in the directory, in which case no further queries were needed.
* Merged in sandervrijders/ouroboros/be-directory (pull request #280)dimitri staessens2016-10-261-46/+84
|\ | | | | | | lib, irmd, ipcpd: Add name querying to IPCPs
| * lib, irmd, ipcpd: Add name querying to IPCPsSander Vrijders2016-10-261-46/+84
| | | | | | | | | | | | | | | | | | This adds the ability to query IPCPs if a name can be reached through them, e.g. if a name is available in a DIF. This means that in the shim-udp a DNS query is performed, in the shim-eth-llc an ARP-like query has been added, in the local a check is done to see if the name is registered, and in the normal currently no application is reachable through it.
* | ipcpd: Fix memory leaksdimitri staessens2016-10-251-17/+16
|/ | | | | Fixes memory leaks associated with the dif_name (which doesn't need to be maintained in shim DIFs) and the fqueue for the N + 1 flows.
* build: Compile with strict conversiondimitri staessens2016-10-221-12/+15
| | | | | This has the code checked with -Wcast-qual and -Wconversion flags. These flags were removed because SWIG generated code fails.
* build: Comply with -Wextra compiler flagdimitri staessens2016-10-211-0/+4
| | | | | This reduces the risk for some bugs, for instance due to signed/unsigned mismatches and unused variables.
* lib: Demultiplex the fast pathdimitri staessens2016-10-211-23/+61
| | | | | | | | The fast path will now use an incoming ring buffer per flow per process. This necessitated the development of a new method for the asynchronous io call, which is now based on an event queue system for scalability (fqueue). The ipcpd's and tools have been updated to this API.
* lib: Fix flow deallocation logicdimitri staessens2016-10-131-0/+2
| | | | | Both the N and N-1 entity must now call flow_dealloc for the port_id to be released.
* lib: Add non-copy reading from fd for IPCPsdimitri staessens2016-10-071-1/+1
|
* lib, ipcp: Revise fast path and flow interfacesdimitri staessens2016-10-041-673/+307
| | | | | | | | | | | | IPCPs can now use ap_init() to initialize the memory. All flows are accessed using flow descriptors, this greatly simplifies IPCP development. Reverts the fast path to a single ap_rbuff per process. Splits lib/ipcp into irmd/ipcp and lib/ipcp-dev. Adds a lib/shim-dev holding tailored functions for shims. Moves the buffer_t to utils.h. Fixes the shim-eth-llc length field. Removes the flow from shared.h. Fixes #4 Fixes #5
* Merged in dstaesse/ouroboros/be-split-fp (pull request #238)Sander Vrijders2016-09-021-3/+3
|\ | | | | | | lib: Add northbound ringbuffers
| * lib: Add northbound ringbuffersdimitri staessens2016-09-021-3/+3
| | | | | | | | Fast path is split in north and southbound paths.
* | lib: ipcp: Decouple flow_deallocdimitri staessens2016-09-021-1/+1
|/ | | | Sending a dealloc to the irmd moved to its own call.
* lib: Refactor shm_du_map to shm_rdrbuffdimitri staessens2016-08-291-12/+17
| | | | | | | | | | The shm_du_map is renamed to shm_rdrbuff to reflect the Random Deletion Ringbuffer used in the implementation. The close_on_exit call is removed and SDUs are cleaned up by the application in the ap_fini() call. This required a non-blocking peek() operation in the shm_ap_rbuff. Some initial implementation for future support of qos cubes has been added to the shm_rdrbuff.
* ipcpd: Report pid on shutdowndimitri staessens2016-08-261-2/+2
| | | | IPCPs will report their pid on shutdown for faster debugging.
* ipcpd: Revised lockingdimitri staessens2016-08-241-179/+113
| | | | | | The state lock was reverted to an rwlock to avoid interference of management functions with the fast path. IPCPs now close without calling unsafe functions in the signal handler.
* ipcpd: Add condition variable to IPCP stateSander Vrijders2016-08-111-70/+70
| | | | | | | This adds a condition variable to the IPCP state, so that upon state changes any listeners to state changes can be notified. It also replaces the read/write lock with a mutex in order to be able to do so.
* ipcp, irmd, lib: Notify IRMd upon IPCP initializationSander Vrijders2016-08-101-0/+6
| | | | | | 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.
* ipcpd: Fix memleakdimitri staessens2016-08-051-0/+2
| | | | The entry from the ringbuffer was never freed, causing memleak per SDU.
* ipcpd: Fix memory leaksdimitri staessens2016-08-041-1/+1
| | | | ipcp-data was not correctly destroyed.
* ipcpd: Deprecate ipcp_reg/ipcp_unregdimitri staessens2016-07-081-2/+0
|
* irmd, ipcps: Close logfile on exitdimitri staessens2016-07-071-5/+10
| | | | | | | 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).
* Merge branch 'be' of bitbucket.org:ouroboros-rina/ouroboros into be-clean-exitdimitri staessens2016-07-061-3/+3
|\
| * lib, irmd, ipcpd: Provide the feature to write to logsSander Vrijders2016-07-061-3/+3
| | | | | | | | | | | | | | | | | | | | 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-1/+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.
* lib: Change invalid pid to -1dimitri staessens2016-07-051-2/+2
| | | | | | | | 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.
* lib: Provide first implementation of revised CDAPSander Vrijders2016-07-051-3/+3
| | | | | | | | 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.
* lib: robust locking in shared memory and crash recoverydimitri staessens2016-07-021-10/+10
| | | | | | | | | | | | | | 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
* lib, irmd, ipcpd: Change pid to apiSander Vrijders2016-06-281-18/+18
| | | | Changes the variable name as well to API instead of PID.
* lib, irmd, ipcpd: Change of IRM APISander Vrijders2016-06-281-24/+5
| | | | | | | | | | | | | | This changes the IRM API after discussions with Dimitri. The register operation is now split into a bind and register operation. The same for unregister; unbind and unregister. PIDs are now used as the application instance name. A name for a PID is only provided for scriptability in bash. It is therefore also no longer passed down to the IPCP. Every operation on an IPCP through the IRM API has to use the PID. Quering of the PIDs by name is possible. The IRM tool has been updated to use this new API as well. A subcommand 'ipcp' has been added for operations that take effect on IPCPs only. Fixes #12
* ipcpd: fix deadlock in shim-udpdimitri staessens2016-06-281-13/+25
| | | | | shim UDP would deadlock upon a dealloc call. fd_clr cannot be called under wrlock.
* ipcpd: fixes to shim-udpdimitri staessens2016-06-271-48/+60
| | | | | getsockname() can give bad behaviour when haphazardly looping fd's, added check that the fd has a flow. Replaced LOG_DBGF with LOG_DBG.
* lib, irmd, ipcp: robust mutexesdimitri staessens2016-06-211-110/+109
| | | | | | | | Update to POSIX 200112L to allow use of robust mutexes in the shm_du_map. Removed the implementation of the rw_lock in favor of pthread_rwlock_t. Placeholder for the shm_du_map_sanitize function.
* ipcpd: fixed missing unlock in shim UDPdimitri staessens2016-06-161-1/+5
| | | | Unlock missing when compiled without DNS support.
* irmd: clean up stale pending flowsdimitri staessens2016-06-161-1/+1
| | | | | | | Adds a thread that cleans up stale pending flows. Compile time option IRMD_FLOW_TIMEOUT allows setting the timeout period. Default timeout is 5 seconds. The thread wakes up 20 times per period to check the flows.
* ipcpd: fixed locking and cleanupdimitri staessens2016-06-161-0/+1
| | | | | The ipcpds didn't unlock the flows lock when the dst_name is unbeknownst to the IRMd.
* lib, irmd, tools, ipcpd: updates to dev API.dimitri staessens2016-06-131-10/+2
| | | | | | | | | | | | | | | The registration function has been moved to the irm tool, applications now need to be registered by an administrator. Currently only supports one instance per registered name, and an AP can be registered under only one name. The irmd can now start a registered server application on demand. For the full functionality of the tool, execute "irm register". AP name removed from flow allocation. Flow allocation does not send the source ap name as it is quite useless. The accept() call now only returns the AE name.
* ipcpd: fixes shutdown lockup in local and shim-udpdimitri staessens2016-05-291-6/+5
|
* lib: shm_ap_rbuff: sleep when read on empty rbuffdimitri staessens2016-05-281-1/+0
| | | | | When the ring buffer is empty, a read call will sleep. A write call on an empty ring buffer will wake up sleeping readers.
* ipcpd: cleanup of IPC processesdimitri staessens2016-05-281-5/+10
| | | | | | | This stops IPC processes from hanging due to bad locks. It first informs all threads that the IPCP is shutting down, then cancels all threads. Cancellation is still required because threads may be in accept() or receivefrom().
* ipcpd: shim-udp changed to blocking writedimitri staessens2016-05-271-14/+11
| | | | | The shim UDP did a non-blocking write call, causing loss of SDU's. This has been changed to a blocking write call.
* ipcpd: fixed the shim-udp grinding the cpudimitri staessens2016-05-271-3/+4
| | | | | | | | In linux, the select call changes the timeout variable to the time not spent in sleep, causing the timeout to decrease and that loop to grind the cpu. The timeval is now reset to the correct value every loop. Also removed a LOG_ERR message that was hampering performance.
* ipcpd: shim-udp: fixed missing NULL checkdimitri staessens2016-05-221-0/+3
| | | | Conf was not checked on bootstrap.
* lib: removed fd cleaning functiondimitri staessens2016-05-221-3/+4
|
* ipcpd: homogenous debug messages for deallocationdimitri staessens2016-05-211-8/+1
|
* lib, irmd, ipcpd: Flow deallocation over shim UDPdimitri staessens2016-05-211-50/+150
| | | | | | The shim UDP now supports deallocating a flow end-to-end. Contains some stability fixes for flow allocation and some missing close() calls in lib/sockets.
* lib, ipcpd: fixes segfaults in dev.c and shim-udpdimitri staessens2016-05-201-2/+1
|
* ipcpd: shim-udp: read fd on client sidedimitri staessens2016-05-201-0/+13
| | | | | There could be a theoretical race condition that the server sends a message before the FD is set on the client side, which is resolved.
* ipcpd: shim-ipcp: fixed race conditionsdimitri staessens2016-05-201-40/+57
| | | | | | | | | | | There were two race conditions. The first was where client received the response message before the client UDP port was connected to the server UDP port and the first message of the client was sent to the LISTEN port instead of the server application port. This was solved by reordering the operations so the response is sent after the port is correctly connected. The second race condition is that the FD is not added to the set in time at the server side before the first SDU arrives. This was solved by adding a variable proteceted by a mutex.
* ipcpd: shim-udp: removed debug codedimitri staessens2016-05-191-12/+0
| | | | | some debug code for locking and a sleep check are removed from the shim-udp.