summaryrefslogtreecommitdiff
path: root/src/ipcpd/ipcp.c
Commit message (Collapse)AuthorAgeFilesLines
* build: Revise the build systemdimitri staessens2017-08-211-14/+5
| | | | | | | | | | 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.
* irmd, ipcpd: Signal acceptor onlydimitri staessens2017-08-161-2/+10
| | | | | 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-61/+138
| | | | | | | | | | | 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
|
* lib, ipcpd, tools: Fix enum assignmentsSander Vrijders2017-08-101-5/+0
| | | | This fixes several assignments to the wrong enum type.
* build, lib, ipcpd, irmd: Add support for libgcryptdimitri staessens2017-08-091-9/+44
| | | | | | | | | | | | | | | | 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.
* lib: Simplify initializing flowsSander Vrijders2017-08-011-1/+3
| | | | | This refactors dev.c to have a common function called init_flow that is called whenever a flow is allocated in dev.c
* lib: Add threadpool managerdimitri staessens2017-07-261-160/+21
| | | | | | | | 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.
* Merged in dstaesse/ouroboros/be-dht (pull request #529)dimitri staessens2017-07-181-1/+0
|\ | | | | | | ipcpd: Add DHT as directory in normal IPCP
| * ipcpd: Add DHT as directory in normal IPCPdimitri staessens2017-07-181-1/+0
| | | | | | | | | | | | | | | | | | This implements a Distributed Hash Table (DHT) based on the Kademlia protocol, with default parameters set as used in the BitTorrent Mainline DHT. This initial implementation is almost feature complete, except for some things to be done after a testing period: caching and stale peer bumping, and setting the expiration timeout via the IRM tool.
* | ipcpd: Log exit status before log_fini()dimitri staessens2017-07-161-2/+2
|/
* ipcpd, lib, irmd: Hardcode shim hash algorithmsSander Vrijders2017-07-121-2/+4
| | | | | | | This will hardcode the shim hash algorithms as they don't have an enrollment phase. Fixes #44
* ipcpd: Fix routing type configurationdimitri staessens2017-06-051-5/+6
|
* ipcpd: Allow specifying fixed syntaxdimitri staessens2017-05-151-25/+20
| | | | | | 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.
* ipcpd: Add capability reportingdimitri staessens2017-04-271-2/+10
| | | | | | | | The IPCP will now report the DIF name and the hash value to the IRMd as a dif_info struct. This can later be extended to add further capability reporting. Some bugfixes in normal. Fixes #24
* Merged in dstaesse/ouroboros/be-hashing (pull request #484)dimitri staessens2017-04-161-9/+9
|\ | | | | | | Be hashing
| * ipcpd: Allow specifying the hash algorithm to usedimitri staessens2017-04-161-9/+9
| | | | | | | | Currently CRC32, MD5, and SHA3 (224, 256, 384 and 512 bit) are supported.
* | irmd, ipcpd: Include socket in select() for FreeBSDdimitri staessens2017-04-161-1/+1
|/ | | | Fixes #41
* include, lib: Rename ap_init/ap_finidimitri staessens2017-04-131-4/+4
| | | | Fixes #35
* lib, ipcpd, irmd: Register hash instead of namedimitri staessens2017-04-131-46/+165
| | | | | | | | | All information passed over the IRMd/IPCP boundary for using IPC services (flow allocation, registration) is now hashed. This effectively fixes the shared namespace between DIFs and the IRMDs. This PR also fixes some API issues (adding const identifiers), shuffles the include headers a bit and some small bugs.
* ipcpd: Fix race condition with concurrent allocsdimitri staessens2017-04-061-2/+11
|
* lib, irmd: Implement flow allocation timeoutdimitri staessens2017-04-061-1/+3
| | | | | | Setting the timeouts on flow_alloc and flow_accept will now work. This makes some changes to the UNIX sockets used for management communication between the APs, IRMd and IPCPs.
* ipcpd: Add lock for allocation requestsSander Vrijders2017-04-051-87/+61
| | | | | This adds a lock to prevent a race condition between flow_req_arr and flow_alloc_resp.
* ipcpd, irmd: Fix cleanup of thread resourcesdimitri staessens2017-04-041-23/+16
|
* ipcpd: Add dynamic threadpooling for IPCPsdimitri staessens2017-04-021-26/+244
|
* Change email addresses to ugent.beSander Vrijders2017-03-031-1/+2
| | | | | | | Our mailserver was migrated from intec.ugent.be to the central ugent.be emailserver. This PR updates the header files to reflect this change as well. Some header files were also homogenized if the parameters within the functions were badly aligned.
* lib: Remove application entity nameSander Vrijders2017-02-241-1/+0
| | | | | The AE name should not be passed over the layer boundaries. If an application has more than one AE it should exchange this in CACEP.
* ipcpd: Fix timeout in ipcp_wait_statedimitri staessens2017-02-121-2/+2
|
* ipcpd: Remove logging if not initialized yetSander Vrijders2017-02-101-3/+1
| | | | | | This removes the logs that would print to stdout if the IPCP fails to initialize. If the user had asked that logs would be printed to the syslog this would be unwanted behaviour.
* lib: Log to the logging systemdimitri staessens2017-02-081-65/+72
| | | | | | | | | | This removes the logfile and outputs log messages to the logging system. The creation of the logfiles (as well as the ap_init() call) were moved into ipcp_init() to simplify the IPCP creation and shutdown. Fixes #25 Fixes #27
* ipcpd: Refactor ipcpi structdimitri staessens2017-02-071-14/+18
| | | | | | | | | The ipcp-ops header was removed and merged into ipcp.h. The common components dif_name and ipcp_type have been moved to the main ipcp struct. After this move, ipcp_data only contained shim information, so it was renamed to shim_data. The ipcp_init() function checks the type and will only include the shim_data if the type is not an IPCP_NORMAL. All ipcps have been adapted to this change in API.
* ipcpd, lib: Revise normal IPCPdimitri staessens2017-02-061-1/+1
| | | | | | | | | | This PR updates the normal IPCP to use the new RIB. The old ribmgr is removed and replaced by a stub that needs to be implemented. All components (dir, fmgr, frct) were adapted to the new RIB API. A lot of functionality was moved outside of the ribmgr, such as the addr_auth, which is now a component of the IPCP. The address is also stored to the ipcpi struct. The irm tool has an option to set the gam policy of the rib manager.
* ipcpd: Remove strdup() from ipcp main loopdimitri staessens2017-02-031-6/+1
|
* ipcpd: Don't strdup() the dif_name in main loopdimitri staessens2017-01-291-3/+1
|
* ipcpd: normal: Create policies for GAMSander Vrijders2017-01-121-0/+1
| | | | | This allows the selection of a policy for the graph adjacency manager. Currently we only support constructing a complete graph.
* ipcpd: Let IPCPs bind a nameSander Vrijders2017-01-091-6/+10
| | | | | | | This allows IPCPs to bind a name, so that they can announce their name to neighbors which can then allocate a flow to them. Registering of the name happens by an administrator. It also moves the irmd_api to common ground, since it is used by all IPCPs.
* ipcpd: Fix state in ipcp_bootdimitri staessens2017-01-041-2/+3
| | | | | | The state must be set to IPCP_INIT before the main_loop threads are started or else they will exit if they reach the check earlier than the state is set.
* ipcpd: Add boot and shutdown operationsdimitri staessens2017-01-041-7/+27
| | | | | | | These operations separe the starting and joining of the main ipcp threads into ipcp_boot() and ipcp_shutdown() operations. This allows the proper cleanup of user data and user threads after the IPCP is requested to shut down.
* Merged in dstaesse/ouroboros/be-normal-refactor (pull request #331)Sander Vrijders2017-01-041-2/+5
|\ | | | | | | ipcpd: Refactor normal ipcp, initial commit
| * ipcpd: Refactor of normal IPCPdimitri staessens2017-01-041-2/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Reorganizes the normal IPCP a bit to make sure internal components do not need to access the state of the IPCP. The IPCP has now a thread calling accept and delegating it to the correct component based on the AE name (this used to be in the fmgr). Internal components are initialized upon enrollment or bootstrap of the IPCP. If a step fails, the IPCP goes back to the INIT state, if all components boot correctly, it goes to the operational state. RIB synchronization is still done by sending a CDAP start/stop and syncing with a ribmgr state, but needs revision later on.
* | lib, ipcpd, irmd: Proof of concept QoSdimitri staessens2017-01-031-1/+1
|/ | | | | | | | | | Now correctly relays the qoscube end-to-end in the stack. A simple function specifying the cube in the spec is used for initial testing. The translation is now done in dev.c, but it could be moved elsewhere when qos cabability matures and the need arises.
* ipcpd: Hide the IPCP mainloopdimitri staessens2016-12-271-169/+169
| | | | | | Since the mainloop threadpool is created on ipcp_init and all threads waited for on ipcp_fini, there is no need for it to be accessible from elsewhere.
* ipcpd: Simplify ipcp_wait_state implementationdimitri staessens2016-12-271-11/+7
|
* ouroboros: Correct license statementsdimitri staessens2016-12-241-3/+2
| | | | | This corrects the license statements on all files. Installed headers are LGPLv2.1, the rest of the code is GPLv2.
* irmd, ipcp: Call select on FreeBSDdimitri staessens2016-12-081-1/+11
| | | | | | *BSD accept() doesn't timeout on the timeval set by setsockopt SO_RCVTIMEO. The irmd and ipcp will now call select on the irmd fd with the same timeout.
* Merged in sandervrijders/ouroboros/be-addr-auth (pull request #296)dimitri staessens2016-11-011-0/+1
|\ | | | | | | ipcpd: normal: Add policy for obtaining a flat address
| * ipcpd: normal: Add policy for obtaining a flat addressSander Vrijders2016-11-011-0/+1
| | | | | | | | | | | | This adds a policy for obtaining a flat address, and thus also the infrastructure for policies in the IPCP. The IPCP should check if the address is available; this is currently not there yet.
* | lib, ipcpd: Improve flow allocationdimitri staessens2016-10-311-11/+5
| | | | | | | | | | | | | | All calls for opening rbuffs are now concentrated on the dev side. This allows some simplifications in the np1 calls. The ipcp_fini call will not destroy the mutex associated with the state, since the final state needs to be checked before shutting down an IPCP.
* | ipcpd: Clean shutdown when bootstrap failsdimitri staessens2016-10-311-2/+4
|/ | | | | Fixes a double free (conf->dif_name) and the handling of non-created threads when the bootstrap of an IPCP fails
* ipcpd: Add threadpool for main loopSander Vrijders2016-10-261-30/+46
| | | | | | | This adds a threadpool for the main loop of the IPCPs. Before there was a single thread handling each request, which could result in starvation since performing name queries at the same time as enrolling a normal IPCP was impossible.