summaryrefslogtreecommitdiff
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
* ipcpd: Move RIB configuration to common headerdimitri staessens2017-02-1711-26/+59
| | | | | Moves the definitions of paths in the RIB for the normal IPCP to a header ribconfig.h to avoid repetition.
* irmd: Fix bad lockdimitri staessens2017-02-161-4/+4
|
* lib: Revise endian header and SHA3Sander Vrijders2017-02-163-141/+40
| | | | | | | | This revises the endian header to let the build time checks of endianness be performed by the standard libraries. We just check for the OS that is being used and provide the endian functions from OpenBSD to everyone. It also updates the SHA3 sources to use this new header. The byte order header is removed.
* ipcpd: Add lock to tx_ring datadimitri staessens2017-02-131-1/+49
| | | | Also fixes another lock.
* ipcpd: Fix build on FreeBSDdimitri staessens2017-02-131-1/+1
| | | | | Use labs for absolute value of a long, and defines bswap_64 as the FreeBSD function bswap64.
* ipcpd: Increase threadpool sizeSander Vrijders2017-02-132-2/+1
| | | | | | This increases the threadpool size for the IPCP main loop. Starvation was happening due to a lot of back and forth interactions between the normal IPCPd and the IRMd.
* ipcpd: Fix timeout in ipcp_wait_statedimitri staessens2017-02-121-2/+2
|
* include: Use width in endian naming conventiondimitri staessens2017-02-121-4/+4
| | | | | ntohll and ntohl have been renamed ntoh64 and ntoh32, htonll and htonl have been renamed hton64 and hton32.
* irmd: Allow time for AP to call flow_accept()dimitri staessens2017-02-124-47/+153
| | | | | | | | When there is a burst of successive flow allocations for a certain name, each such request will block a thread in the IRMD for IRMD_REQ_ARR_TIMEOUT ms to allow the application some time to respond. This refactors some parts of the IRMd.
* ipcpd: Prevent access to directory before initdimitri staessens2017-02-111-4/+14
| | | | | | | Doing a directory query before the IPCP is has bootstrapped or is enrolled will result in an assertion failure as the directory is not yet ready. This fixes flow allocation over the LLC shim (which triggers a directory query from the IRMd) with a normal IPCP present.
* ipcpd: Compare timestamp upon enrollmentdimitri staessens2017-02-111-1/+52
| | | | | | The enrollment procedure will ask for a timestamp of the IPCP it is enrolling with. It will (taking into account the RTT of the request) issue a warning if the offset is larger than RIB_WARN_TIME_OFFSET ms.
* cdap: Take void * for send operationsdimitri staessens2017-02-101-11/+15
| | | | This facilitates sending arbitrary variables over CDAP.
* ipcpd: Silent shutdown of normaldimitri staessens2017-02-103-3/+9
| | | | | The acceptor will not log disconnects with IRMd. Unexpected disconnects will be reported and handled by management components.
* include: Add header for endiannessdimitri staessens2017-02-101-88/+1
| | | | | | | | | This adds a header for dealing with endianness in ouroboros. It is extracted from the byte_order header in the library (which now includes this header). It also exposes the functions ntohl, ntohll, htonl and htonll, necessary for converting 32 and 64 bit values for storage and retrieval from the RIB (which should store multi-byte values in network byte order).
* Merged in sandervrijders/ouroboros/be-ipcpd-logs (pull request #370)Sander Vrijders2017-02-105-7/+1
|\ | | | | | | ipcpd: Remove logging if not initialized yet
| * ipcpd: Remove logging if not initialized yetSander Vrijders2017-02-105-7/+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.
* | ipcpd: Fix leaking name in cacep_infodimitri staessens2017-02-102-0/+3
|/
* lib: Fix bad lock in ribdimitri staessens2017-02-101-1/+1
|
* lib, ipcp: Correctly init condvarsdimitri staessens2017-02-093-12/+23
| | | | | The timerwheel and RIB use timedwaits. The condition variables are now correctly initialised to use the configuration defined clock.
* ipcpd: Print size_t and uint64_t in portable waydimitri staessens2017-02-092-6/+7
| | | | | | On 32-bit systems size_t is different than on 64 bit systems. The correct way to print a size_t is with %z. uint64_t is printed portably with the PRIu64 macro.
* lib: Fix bug in rib_testdimitri staessens2017-02-091-1/+1
|
* lib, tools, ipcpd: Fix compilation on FreeBSDdimitri staessens2017-02-093-3/+7
| | | | | | | | | | | | FreeBSD defines its own bswap64 in the <sys/endian.h> header, which is now included correctly. POSIX requires XSI or RTS extensions to be enabled for the sa_sigaction field to be visible. Linux doesn't do the check correctly, but FreeBSD does. Removes the LOG_MISSING call which was deprecated with the last revision of the logging system.
* ipcpd, lib: Report IPCP creation failuredimitri staessens2017-02-099-88/+151
| | | | | | | | The IPCP will now respond with an ipcp_create_r message when it fails, informing the IRMd. Also adds some const qualifiers in the public headers and fixes some formatting in dev.c.
* ipcpd: Add cleanup handler to gamdimitri staessens2017-02-081-1/+4
|
* ipcpd: Fix boot order of normaldimitri staessens2017-02-081-4/+10
| | | | | | irm_bind has to be called after ipcp_init() since it targets the AP-I and needs the pid to be registered with the IRMd. Also fixes missing unbinding of the AP-I.
* lib, ipcpd: Comply to pedantic C99Sander Vrijders2017-02-081-1/+4
| | | | | | With the changes in this commit Ouroboros will compile with the pedantic flag on when the standard is C99. The main problem was the used of unnamed structs and unions, which is C11.
* lib: Log to the logging systemdimitri staessens2017-02-0823-653/+599
| | | | | | | | | | 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-079-141/+161
| | | | | | | | | 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: Revise PCI manipulation in normaldimitri staessens2017-02-074-148/+98
| | | | | | | | | | | The pci function will store offsets to avoid having to recalculate them every time. TTL handling is removed from the fmgr, the TTL is automatically decreased when deserializing the PCI (or set to 1 if there is no TTL present so the PDU will be forwarded). The deserialisation function now takes a pointer to a struct pci as input to avoid memory allocation and release each time a PDU is processed. Some checks have been replaced with assert() and return values replaced with void where it makes sense.
* ipcpd, lib: Revise normal IPCPdimitri staessens2017-02-0629-2547/+1033
| | | | | | | | | | 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.
* lib: Fix memleak in cacepdimitri staessens2017-02-061-0/+1
|
* irmd: Handle death of IPCP gracefullydimitri staessens2017-02-043-12/+30
| | | | | | | If an IPCP SEGVs abruptly, the sanitizer in the IRMd would also cause a SEGV because of looping over a registry linked list inside another safe loop over the same list. A function is added to the registry to avoid this.
* lib: Handle receiving CDAP reply before waitdimitri staessens2017-02-041-1/+9
| | | | | | In extreme cases, the response to a CDAP request can arrive before the AE doing the request has called cdap_request_wait. This PR handles it by waiting for the state to move away from INIT before responding.
* ipcpd: Remove strdup() from ipcp main loopdimitri staessens2017-02-035-11/+26
|
* irmd: Fix memleak in registrydimitri staessens2017-02-031-0/+1
|
* lib: Retrieve number of children of a RIB nodedimitri staessens2017-02-031-3/+10
|
* lib: Fix insertion order in RIBdimitri staessens2017-02-021-8/+13
| | | | | | | | The new element must be added before the larger element (list_add_tail, since it's a circular list). Also fixes a bug and improves the locking in rib_pack (rib must be locked until the subtree is fully packed in the buffer).
* lib: Add packing and unpacking RIBdimitri staessens2017-01-314-30/+325
| | | | | | | | | | | | | | | | | | | The rib_pack function allows packing a subtree of the RIB for dissemination. The options PACK_HASH_ROOT and PACK_HASH_ALL will add the hashes for the root object of the packed subtree or every object to the packed message respectively. Checking of the hashes is currently only performed at the top level object, verifying the complete operation. The rib_unpack function unpacks a packed message and inserts its contents in the RIB. The option UNPACK_CREATE flags that the unpack operation is allowed to create new objects, else it will only update existing objects. More advanced options could be added in the future. The packed message structure uses Google Protocol Buffers, as defined in ro.proto. It adds tests for these functions to the rib_test.
* irmd: Fix memleak attempting double bootstrapdimitri staessens2017-01-291-8/+6
| | | | | | When trying to double bootstrap, the entry name was strdup'd before the bootstrap leaking the previous name. Now it bootstraps first and sets the name after a successful bootstrap only.
* lib: Add function to get children of node in RIBdimitri staessens2017-01-292-0/+91
| | | | | Returns the names of the nodes (not the full paths). The function allocates memory to the children pointer that should be freed.
* ipcpd: Fix unused parameter in local IPCPdimitri staessens2017-01-291-0/+2
|
* ipcpd: Don't strdup() the dif_name in main loopdimitri staessens2017-01-295-14/+8
|
* lib: Fix reading from non-blocking flowsdimitri staessens2017-01-241-4/+3
| | | | | The -EAGAIN from a failed non-blocking flow read would trigger the assertion. This snuck in somehow (we need some unit tests for dev.c).
* lib: Add new version of Resource Information Basedimitri staessens2017-01-214-0/+1321
| | | | | | | | | | | | The new RIB is implemented as a tree with doubly linked nodes (parents keep a link to each child, each child keeps a link to its parent). An index is kept in a btree using CRC32 hashes of the path name in the RIB. Nodes keep an SHA3-256 hash value that is unique for the entire subtree. This allows quick checks to see if two RIB subtrees are in sync. The event system for the RIB is based on the event system for flows (fqueue), but implemented completely in dynamic memory using linked lists. An initial test is performed for the RIB. This PR does not modify existing code to use the new RIB.
* lib: Add move operation for listsdimitri staessens2017-01-201-0/+11
| | | | | Allows moving the elements of one linked list to another. Re-initializes the source list.
* lib: Fix return value and typo in fqueuedimitri staessens2017-01-201-1/+1
|
* lib: Add B-tree implementationdimitri staessens2017-01-165-0/+609
| | | | | Adds an implementation of B-trees of order k (k children, min fill is k/2, max fill k - 1). Useful to implement indexes for faster lookups.
* lib: Add test for crc32 functiondimitri staessens2017-01-152-0/+72
|
* lib: Move CRC32 implementation to librarydimitri staessens2017-01-145-45/+18
| | | | The CRC32 implementation will be used to ID objects in the RIB.
* ipcpd: Fix timerwheel testdimitri staessens2017-01-131-1/+5
| | | | | | | | Sometimes the timerwheel test could fail because of scheduler timings (an issue more apparent in Virtual Machines). When the first check fails, the test will wait for another complete round of the timerwheel. The maximum number of slots in the test is reduced to reduce the test time.