summaryrefslogtreecommitdiff
path: root/src/ipcpd/ipcp.c
Commit message (Collapse)AuthorAgeFilesLines
...
* ipcpd: Fix potential memleaksdimitri staessens2016-08-211-2/+8
|
* irmd, lib: Rebuild the IRMd data modeldimitri staessens2016-08-211-1/+1
| | | | | | | | | | | | | | | | | | | | | | 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.
* ipcpd: normal: Handle enrollment repliesSander Vrijders2016-08-191-1/+5
| | | | | | | | This adds a condition variable with a timeout to the CDAP request so that we can respond correctly to the answer from the remote. It also adds a timeout to the condition variable waiting on completion of enrollment. Furthermore, for every CDAP callback a new thread is now spawned, to avoid deadlocking in case a callback is stuck.
* ipcpd: Fix bootstrap with api_binddimitri staessens2016-08-121-1/+7
| | | | | Calling api_bind during bootstrap caused the IRMd to lock up. api_bind is now called after the normal completes bootstrapping.
* ipcpd: Add condition variable to IPCP stateSander Vrijders2016-08-111-1/+12
| | | | | | | 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.
* ipcpd: Fix deep copy of dif_configdimitri staessens2016-08-111-2/+2
| | | | | conf->dif_name was not copied from the dif_config gpb message. Fixes some logs.
* lib, irmd, ipcp: Add socket timeoutSander Vrijders2016-08-101-0/+7
| | | | | | 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.
* ipcpd: Correct cleanup of filedescriptordimitri staessens2016-08-091-2/+2
|
* ipcpd: Fix missing close of lsockfddimitri staessens2016-08-081-0/+3
|
* irmd: Fix destroying allocated flowsdimitri staessens2016-08-041-1/+1
| | | | | 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-10/+18
| | | | ipcp-data was not correctly destroyed.
* ipcpd: Fix incorrect cleanup of fddimitri staessens2016-08-041-2/+7
| | | | The cleanup was trying to close a pointer to the file descriptor.
* lib: Remove N-1 DIF param from enroll operationSander Vrijders2016-07-121-2/+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.
* ipcpd: Deprecate ipcp_reg/ipcp_unregdimitri staessens2016-07-081-21/+0
|
* lib, irmd, ipcpd: Provide the feature to write to logsSander Vrijders2016-07-061-5/+34
| | | | | | | | | | 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: 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.
* lib, irmd, ipcpd: Change pid to apiSander Vrijders2016-06-281-3/+3
| | | | Changes the variable name as well to API instead of PID.
* lib, irmd, ipcpd: Change of IRM APISander Vrijders2016-06-281-5/+1
| | | | | | | | | | | | | | 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
* lib: Change DA header to NSMSander Vrijders2016-06-221-1/+1
| | | | | | Functionality that was previously thought to be part of the DIF Allocator is actually namespace management. Hence the file has been renamed and the API updated.
* lib, irmd, ipcp: robust mutexesdimitri staessens2016-06-211-1/+1
| | | | | | | | 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.
* Merge remote-tracking branch 'upstream/be' into be-llcSander Vrijders2016-06-141-1/+0
|\
| * lib, irmd, tools, ipcpd: updates to dev API.dimitri staessens2016-06-131-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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: Adds a shim over IEEE 802.2 over IEEE 802.3Sander Vrijders2016-06-141-0/+4
|/ | | | | This adds a shim over LLC over Ethernet. It uses the raw socket API to send messages directly over an interface.
* ipcpd: Cleanup handler for main message loopSander Vrijders2016-05-261-0/+5
| | | | | This adds a cleanup handler for the main message loop, which closes the socket upon pthread_cancel so that the ipcp can exit cleanly.
* Implementation of a full flow allocator for the shim UDP.dimitri staessens2016-05-181-4/+4
| | | | | | | | | It uses UDP port 0x0D1F on all hosts to send and receive flow allocation messages. It supports communication between server and client AP over a single shim IPCP. Implementation of full flow deallocation is pending. Both the client and the server still have to call flow_dealloc();
* Merged in sandervrijders/ouroboros/be (pull request #84)dimitri staessens2016-05-141-1/+1
|\ | | | | | | lib, ipcpd, irmd: Add QoS cube definition
| * lib, ipcpd, irmd: Add QoS cube definitionSander Vrijders2016-05-141-1/+1
| | | | | | | | | | | | | | | | | | | | This adds the QoS cube definition, which is an enum to select which QoS is needed in the IPCP. An application has to use the qos_spec in qos.h to define what it needs. The IRMd will map this unto a qos cube definition. Some headers are now also no longer installed on the system, since they are only to be used within the irmd and ipcps.
* | ipcpd: shim-udp: complete lockingdimitri staessens2016-05-141-5/+29
|/ | | | | | | Added necessary locks for the shim-udp. This PR also improves thread management, the main thread now starts a mainloop thread, which spawns sdu handler threads when it the IPCP is enrolled. If the IPCP exits the enrolled state, the sdu loop is cancelled.
* irmd: flow allocation and fast pathdimitri staessens2016-05-071-8/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit has a first implementation of flow allocation (the "slow path") and read/write (the "fast path") for ouroboros. It provides basic but unstable communications over the shared memory. It required a lot of changes all over the stack, and fixes a number of previously undetected issues. This PR still need heavy revision regarding data model, locking and cleanup. lib/dev: modifications to the API. It now uses an ap_init() call to set the AP name and sets the Instance ID to the pid of the process. It also binds the AP to the shared memory and creates tables for mappings in the fast path. A call to ap_fini() releases the resources. lib/shm_ap_rbuff: added ring buffer for data exchange between processes in the fast path. It passes an index in the shm_du_map. lib/shm_du_map: rewrote API to work with calls from dev.c. Garbage collector added. Tests updated to new API. ipcpd/ipcp-data: removed everything related to flows, as these are universal for all ap's and kept in ap_data (dev.c), or similar structs for shim ipcps. shim-udp: added flow allocator and read/write functions and shm elements. irmd: revised data model and structures necessary for flow allocation. tools: echo updated to new dev.h API. messaging system was updated to comply with new flow allocation messages. All exchanges use pid and port_id to bootstrap the fast path.
* ipcpd: Hide IRMd messages and fix formattingSander Vrijders2016-04-271-20/+20
| | | | | This abstracts away the IRMd messages by calling the functions from ipcp.h in the ouroboros library. It also fixes some formatting issues.
* lib: instance ID's are now set to the process PIDdimitri staessens2016-04-261-2/+1
| | | | | | | | All instance-id's in ouroboros will be set by the system to the pid of the process associated with this application process instance. This means that the user has no way to choose the instance id's. Function calls that assumed manually defined instance id's have been replaced throughout the system.
* irmd: reg/unreg whatevercast namesdimitri staessens2016-04-221-11/+11
| | | | | | | | | | | | Unregistering ap's now works. An AP now registers/unregisters its AP-I by sending its AP name and its pid to the IRMd. The IPCPs register whatevercast names. An AP name is currently mapped on a whatevercast name represented by the same string literal. The IRMd allows registration of only one AP-I per AP. A Name Space Management system is needed in the processing system so we can resolve this completely. Changing the stack to register whatevercast names required some changes all over the ipcpd implemented and in the library.
* shim-udp: flow allocation addeddimitri staessens2016-04-191-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This implements the API for flow allocation. The shims currently does the following. The shim IPCP binds to an interface (IP address) and listens for flow allocation requests on UDP port 0x0D1F (3359), referenced as the listen port (lp). It will treat any datagram received on lp as a flow allocation request. Upon receiving an allocation request IRM_MSG_CODE__IPCP_FLOW_ALLOC from the IRMd, the shim IPCP will bind a UDP socket to a port (cp) allocated by the host OS. From that port it will send a UDP packet containing the destination ap_name to server_host:lp and wait for a response. Upon reception of a packet on server_host:lp, the shim_IPCP creates a UDP socket for the flow with a port set by the host os (sp), binds to it and echoes the received datagram back from server_host:sp to client_host:cp. It will also notify the IRMd of an incoming flow allocation request IRM_MSG_CODE__IPCP_FLOW_REQ_ARR, with as src_ap_name ("John Day"). It will get the port_id as a return value of that message and create a flow with status FLOW_PENDING with that port_id. If the server responds negatively to the flow allocation request (i.e. the shim IPCP on the server side receives a IRM_MSG_CODE__IPCP_FLOW_ALLOC_RESPONSE with a response != 0, it will delete the pending flow. If response == 0, it will set the status to FLOW_ALLOCATED. On the client machine the IPCP will learn sp upon reception of the echoed datagram. It will then create a flow with the port_id it received with the message from the IRMd and set it to ALLOCATED. Pending implementation: DNS support, this PR only supports local flows on the loopback adapter 127.0.0.1. A thread to listen for the echoed message, to avoid the entire IPCP to block when the echoed message is lost. This PR compiles but is untested pending necessary implementations elsewhere in the stack.
* ipcpd: added checksdimitri staessens2016-04-191-16/+57
| | | | | added missing NULL checks common argument check function for ipcps
* ipcpd: initial IPC processesdimitri staessens2016-04-181-0/+195
Basic functions for implementation of IPC processes, and implementation of core functions of the shim IPCP over UDP. Updates to the build system to compile these IPC processes, as well as some fixes in the irmd (rudimentary capturing exit signals) and some fixes in the library, mainly relating to the messaging. Basic implementation of creation / bootstrapping / deletion of the shim UDP. Placeholders for other functions.