summaryrefslogtreecommitdiff
path: root/src/ipcpd/normal
Commit message (Collapse)AuthorAgeFilesLines
* build: Check for variable length arraysDimitri Staessens2018-05-281-20/+25
| | | | | | | | | | The clang and gcc compilers don't complain about variable length arrays using the -c89 flag unless the flag -Wvla or -Wpedantic is set. This also fixes a memleak and two false positive uninitialized variable warnings reported by the clang static analyzer in graph.c. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
* ipcpd: Use eid in fa protocol instead of fdDimitri Staessens2018-05-271-14/+14
| | | | | | | | | The flow allocator protocol used fd in the message exchange since eids were directly mapped to fds. It's better to name them eid in the protocol to avoid confusion. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
* ipcpd: Fix memleak in DHTDimitri Staessens2018-05-271-9/+5
| | | | | | | | | | This fixes a memleak for the info struct when join thread creation is not needed. Fixes a false positive warning when running the clang static analyzer. Removes a use-after-free warning that is not valid since 0.11.4. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
* lib: Use IPCP name as RIB directoryDimitri Staessens2018-05-151-1/+1
| | | | | | | | This will change the FUSE mountpount to the name of the IPCP instead of a generic name based on its pid. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
* ipcpd: Fix check build for DHT0.11.6Dimitri Staessens2018-05-081-0/+4
| | | | | | | | The DHT test failed on the use of IPCP-specific calls. These calls are now guarded by the correct defition checks. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
* ipcpd: Include ipcp-dev header in DHT0.11.5Dimitri Staessens2018-05-081-1/+1
| | | | | | | | The DHT called ipcp_sdb_release without including ipcp-dev, causing compiler errors on some machines. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
* ipcpd: Fix bad memory handling in LFA policySander Vrijders2018-05-042-7/+8
| | | | | | | | | | | | | The Loop-Free Alternates policy had bad memory management in two places. In the calculation of the LFAs a table was freed in the first iteration of a loop, whereas it was still needed in the other iterations. It is now freed outside of the loop. In the alternate PFF the address structs were not freed upon shutdown, this has been added as well. It also fixes some bad initialization in the LFA calculation function. Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be> Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be>
* ipcpd: Limit number of returned query addresses0.11.4Dimitri Staessens2018-05-031-12/+18
| | | | | | | | | The query returned all addresses where a name was registered, causing some scaling problems. Now it will return at most DHT_RETR_ADDR, which is currently set at 1 (anycast). Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
* ipcpd: Allow wait for dir enrollment on dt connDimitri Staessens2018-05-035-2/+21
| | | | | | | | | This adds the option to wait for the directory (DHT) to enroll on creating a new data transfer connection. This makes scripting network bootstraps more stable. The default setting is OFF. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
* ipcpd: Recalculate PFF upon adding new neighborSander Vrijders2018-05-031-31/+42
| | | | | | | | | | This recalculates the PFF upon adding a new neighbor, so that the network reconverges faster. It is safe to do so since it is only done by the two IPCPs that established the new flow. The PFF is also recalculated every 4 seconds. Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be> Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be>
* ipcpd: Prevent parallel DHT enrollment threadsDimitri Staessens2018-05-031-22/+24
| | | | | | | | | This will prevent quick calls to ipcp conn for dt flows to create multiple join threads in parallel, instead the subsequent calls will wait for the pending join to finish. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
* ipcpd: Don't do lookup with new DT when runningDimitri Staessens2018-05-031-4/+8
| | | | | | | | | | The DHT performed a lookup upon a new DT connection when it was running for efficiency reasons. This lookup somehow cause SEGV under stress (rapid bootstrapping of networks). This will be solved with a full revision of the DHT implementation. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
* ipcpd: Cleanup pending DHT commands on shutdownDimitri Staessens2018-05-031-0/+7
| | | | | | | The list of commands was not cleaned up on shutdown. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
* ipcpd: Remove cookie from DHT lookup at updateDimitri Staessens2018-05-031-1/+4
| | | | | | | | | | The lookup struct uses the cookies to track pending request messages, but they were not removed when a response is processed. Upon reuse of a cookie for the next message, it could update the wrong lookup. This removes the cookie for a lookup when it is looked for. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
* ipcpd: Shut down DHT gracefully during enrollmentDimitri Staessens2018-05-031-0/+10
| | | | | | | | | The DHT has a thread that continued to run during shutdown. The shutdown state is now checked for. It will not try to send messages at shutdown. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
* ipcpd: Create notifier before connmgrDimitri Staessens2018-04-261-9/+9
| | | | | | | | The connmgr requires the notifier, but the notifier was created after and destroyed before the connmgr. This is now fixed. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
* ipcpd: Enable locking threads to a CPU coreDimitri Staessens2018-04-051-1/+4
| | | | | | | | | This adds a function that locks a thread to a random core. This greatly improves performance on multi-cpu systems. There is no portable way to do this, this only implements it for GNU/Linux. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
* lib: Allow disabling partial readDimitri Staessens2018-03-191-2/+6
| | | | | | | | | | | | | | This allows disabling partial reads. It adds a flag FLOWFRNOPART that disables partial reads. Partial read is different from partial delivery (FRCTFPARTIAL), which allows delivery of fragments of an incomplete packet and thus potentially corrupted data. FLOWFRNOPART will never deliver corrupted data (unless FRCTFPARTIAL is also set). If FLOWFRNOPART is set and the buffer provided to flow_read is too small for the SDU, that SDU will be discarded and -EMSGSIZE is returned; Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
* ipcpd: Fix reading LSAs in link-state policy0.10.7Dimitri Staessens2018-03-161-2/+2
| | | | | | | | | | | The read buffer had the exact length of a link-state message. With the partial read implemented, we should then do another read() to check if there are more parts of the message (which will return 0). To avoid the additional read() call every time, the buffer was extended by 1 byte. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
* ipcpd: Fix bytes sent in send statisticsDimitri Staessens2018-03-081-6/+11
| | | | | | | | The number of bytes sent was not counting the data transfer PCI. This is now fixed. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
* lib: Add fccntl operation to get queue lengthsDimitri Staessens2018-02-281-5/+17
| | | | | | | | | | This adds the FLOWGRXQLEN and FLOWGTXQLEN operations to fccntl to get the number of packets that are in the receive and transmit buffers respectively. The flow statistics are updated to show these queue lengths. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
* ipcpd: Fix flow statisticDimitri Staessens2018-02-261-1/+1
| | | | | | | There was a wrong rcv_bytes where it should have been snd_bytes. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
* ipcpd: Fix access to uninitialized valueDimitri Staessens2018-02-261-14/+14
| | | | | | | | | This fixes the access to an uninitialized dt_pci struct when updating flow statistics in the case there is no next hop, which often resulted in a segmentation fault. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
* ipcpd: Fix data race when accessing DHT stateDimitri Staessens2018-02-261-1/+2
| | | | | | | | The dht_get_state() function should be used to get the state of the DHT. This fixes bug #4. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
* ipcpd: Fix malformed sprintf in dt component0.10.2Dimitri Staessens2018-02-241-1/+1
| | | | | | | | The sprintf was missing a format string. Some compilers did not complain about this. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
* ipcpd: Fix missing free in graph implementationSander Vrijders2018-02-241-0/+2
| | | | | | | | There was a missing free in case the address was not found in the routing table when trying to add an LFA for a certain address. Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be> Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be>
* ipcpd: Fix cleanup of sdu schedulerDimitri Staessens2018-02-241-7/+7
| | | | | | | | | | Not all threads were cancelled on exit. This fixes (the rather cryptic) error message "The futex facility returned an unexpected error code" when running the stack with the address sanitizer. Also fixes possible double frees when a pthread_create would fail. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
* ipcpd: Print establishment time in flow statsDimitri Staessens2018-02-231-22/+35
| | | | | | | | | | The time of establishment will be printed as part of the flow statistics (it is the same as the modification time of the file in the FUSE filesystem). Some output was reordered and the length of the sizes is updated to be sufficient for 64-bit values. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
* ipcpd: Print endpoint in flow statisticsDimitri Staessens2018-02-234-14/+30
| | | | | | | | | | The flow statistics will now print the endpoint of the flow. If it's a local endpoint for the IPCP, it will print the component (e.g. "flow-allocator"). For remote flows, it will print the address of the IPCP. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
* ipcpd: Reset flow statistics on reuseDimitri Staessens2018-02-231-0/+2
| | | | | | | | The flow statistics were not reset when a new connection was created, resulting in wrong statistics. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
* ipcpd: Fix locking issues in flow statisticsDimitri Staessens2018-02-231-12/+59
| | | | | | | | | The locks were not initialised correctly due to a misspelled define and the fail_write was trying to lock a bad mutex (sometimes -1 out of array). This also fixes the statistics gathered. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
* ipcpd: Fix double definition of ipcp configDimitri Staessens2018-02-233-43/+2
| | | | | | | | | | The import of the IPCP config protobuf message in the enrollment message caused a double definition. The enroll.proto file is deprecated and the definition of the enrollment message is moved to the library to avoid this. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
* ipcpd: Fix missing lock in link-state policyDimitri Staessens2018-02-231-0/+27
| | | | | | | | The replication of the database was missing a lock. Now the database is first copied under lock and then sent. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
* ipcpd: Export flow statistics to RIBDimitri Staessens2018-02-202-20/+397
| | | | | | | | | | This adds flow statistics for the data transfer (DT) component to the RIB. The DT component will keep track of the traffic on each flow. This feature can be enabled or disabled by setting the IPCP_FLOW_STATS variable in the build system. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
* lib: Get RIB attributes from componentDimitri Staessens2018-02-201-29/+80
| | | | | | | | | | | | This revises the RIB so it gets the complete file attribute list from the component instead of setting some attributes in the library. This will allow setting read/write access later on in the component itself. The time of last change of lsdb entries in the file system is now set to the time of the last received Link State Update for that entry. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
* ipcpd: Revise Data Transfer component0.10.0Dimitri Staessens2018-02-1317-237/+228
| | | | | | | | | | | This makes the TTL non-optional and allows the maximum (initial) value of the TTL to be specified at bootstrap (the default is set to 60). The fd in the DT PCI is now called EID (Endpoint ID). The names "dif" and "ae" have been replaced by "layer" and "component" respectively in all sources. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
* ipcpd: Revise lookup tracking in DHTDimitri Staessens2018-02-102-54/+88
| | | | | | | | | | The lookups now track the responses by cookie instead of just counting the remaining number of responses. This is needed because simultaneous lookups for the same hash interfere with eachother and lead to missed responses. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
* build: Use GNUInstallDirs instead of hardcoded values0.9.9Sander Vrijders2018-02-061-1/+1
| | | | | | | | This changes the build to use GNUInstallDirs instead of hardcoded values. Package maintainers can then override these defaults by passing the correct value to cmake on the command line. Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
* ipcpd: Replicate database on new MGMT flowDimitri Staessens2018-02-061-0/+17
| | | | | | | | This will trigger the existing member to send all entries in its database as LSAs to the new member. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
* ipcpd: Handle LU_DONE state in DHTDimitri Staessens2018-02-061-0/+1
| | | | | | | | The DHT would enter an infinite loop in lookup_wait() because the LU_DONE state was not handled correctly. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
* ipcpd: Wait for DHT_RUNNING state at register/query0.9.4Dimitri Staessens2018-01-251-4/+10
| | | | | | | | | This will make the register and query calls at the DHT wait for a JOIN to complete. This avoids fails when calling register immediately after creating a data transfer connection. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
* ipcpd: Fix lookup handling in DHT0.9.3Dimitri Staessens2018-01-231-5/+2
| | | | | | | | Some responses for a query were missed because the lookup went into LU_COMPLETE state while still having pending requests. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
* include, src: Update copyright to 2018Dimitri Staessens2018-01-0942-42/+42
| | | | | | | Happy New Year, Ouroboros. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
* ipcpd: Use the term "layer" and deprecate "shim"Dimitri Staessens2017-12-192-3/+2
| | | | | | | | | | | | | | This changes the terminology to use layer instead of DIF and deprecate the word "shim" for the IPCPs that attach to Ethernet LLC and UDP .The terminology has not yet been changed in the variable names etc. This reflects the design choices in Ouroboros to make IPCPs pure resource allocators instead of also providing an "IPC service". The Ouroboros IPCPs that attach to Ethernet and UDP implement the allocator and are thus not really shims. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
* ipcpd: Wait for DHT running state before accessDimitri Staessens2017-12-061-12/+13
| | | | | | | | | | The DHT will now wait for the DHT_RUNNING state before handling request messages, ensuring that the parameters are set correctly before they are read and sent at JOIN. Also fixes a re-introduced assertion failure when a JOIN fails. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
* ipcpd: Fix missing bracket in DHTDimitri Staessens2017-12-051-1/+1
| | | | | | | | ca2f47d had a missing bracket after a last-minute update to simplify the logic. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
* ipcpd: Update DHT buckets in JOINING stateDimitri Staessens2017-12-051-7/+31
| | | | | | | | | | The DHT buckets were not updated in JOINING state, which sometimes caused the DHT to miss its first peer update when joining and become isolated. This also checks if a name is already registered to avoid adding it multiple times. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
* ipcpd: Remove protocol buffers from flow allocator0.8Sander Vrijders2017-12-043-117/+54
| | | | | | | | This will remove google protocol buffers from the flow allocator component in the normal IPCP. It now uses packed structs, as supported by the compilers of choice. Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
* ipcpd: Remove protocol buffers from link stateSander Vrijders2017-12-043-66/+24
| | | | | | | | | This will remove google protocol buffers from the link state routing algorithm in the normal IPCP. It now uses packed structs, as supported by the compilers of choice. Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be> Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be>
* lib, tools: Rename application process and instanceDimitri Staessens2017-12-024-12/+12
| | | | | | | | | | | This refactors ouroboros to use "program" instead of "application process" and "process" instead of "application process instance" to align with current naming in current Operating Systems courses instead of the ISO nomenclature adopted by RINA. This change permeates through the entire implementation. Also contains some minor other refactors. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>