summaryrefslogtreecommitdiff
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
* build: Fix running make check standaloneSander Vrijders2018-05-301-2/+2
| | | | | | | | | In the current build an error would happen if a user simply runs make check after running cmake, since the kademlia protocol buffer file was not generated yet. This simply regenerates the file for the test. Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be> Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be>
* ipcpd: Include string for memset in graph.c0.11.8Dimitri Staessens2018-05-291-0/+1
| | | | | | | | The memset function was used without including <string.h>, which some compilers complain about. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
* build: Update default values0.11.7Sander Vrijders2018-05-293-3/+3
| | | | | | | | | | | This sets updated default values for the default build. A higher connect timeout until we have asynchronous local IPC. Disabled SWIG since the lastest gcc reports an error. IPCP flow stats enabled by default since their impact on the performance is very limited. Waiting for the directory to enroll before returning to increase stability. Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be> Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be>
* ipcpd: Add address to DT directory name in RIBDimitri Staessens2018-05-291-1/+3
| | | | | | | This adds the address to the DT directory name in the RIB. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
* ipcpd: Avoid false positive use-after-free in DHTDimitri Staessens2018-05-281-0/+1
| | | | | | | | | The static analyzer misses the linked list logic. An assertion is added that indicates that the pointer was changed indirectly by the previous element. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
* build: Check for variable length arraysDimitri Staessens2018-05-282-24/+57
| | | | | | | | | | 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: Fix potential memleak in rdrbuffDimitri Staessens2018-05-271-2/+4
| | | | | | | | The rdrb struct should be freed when destroying the rdrbuff, even when the actual shared memory is not unlinked. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
* ipcpd: Fix false positive incompatible malloc typeDimitri Staessens2018-05-271-6/+4
| | | | | | | | | A malloc was performed with a mgmt_msg type and converted to a uint8_t buffer for serialization, which triggers a false positive warning with the clang static analyzer. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
* irmd: Fix comparison of uninitialized valueDimitri Staessens2018-05-271-0/+1
| | | | | | | The result value was not set in the case of an unknown message code. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
* tools: Fix memleaks as reported by cppcheckSander Vrijders2018-05-252-2/+6
| | | | | | | This fixes two memleaks which were reported by cppcheck. Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be> Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be>
* lib: Use IPCP name as RIB directoryDimitri Staessens2018-05-152-3/+3
| | | | | | | | 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>
* lib: Add event types to fqueueDimitri Staessens2018-05-142-37/+53
| | | | | | | | | | | The event type of the current event in the fqueue can now be requested using the fqueue_type() command. Currently events for packets (FLOW_PKT), flows (FLOW_UP, FLOW_DOWN) and allocation (FLOW_ALLOC, FLOW_DEALLOC) are specified. The implementation only tracks FLOW_PKT at this point. 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 setting MTU for eth-llcDimitri Staessens2018-05-081-3/+12
| | | | | | | | The MTU was not correctly set for the eth-llc ipcp. This also fixes a missing definition of ETH_MAX_MTU, which was introduced in kernel v4.10. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
* ipcpd: Fix parameter in debug logDimitri Staessens2018-05-081-2/+2
| | | | | | | | The cpu was a size_t but printed as an unsigned long, giving compilation errors on 32 bit machines. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
* tools: Disable partial reads in opingDimitri Staessens2018-05-072-3/+6
| | | | | | | | | The oping tool was using a 1500 byte buffer, but didn't account for partial reads when sending 1500 byte packets. This disables the partial reads. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
* ipcpd: Use correct MTU for eth-dixDimitri Staessens2018-05-071-4/+24
| | | | | | | | The eth-dix IPCP was using a hardcoded MTU of 1500 bytes, but could support higher MTUs. Now jumbo frames are supported. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
* irmd: Fix use-after-free in mainloopDimitri Staessens2018-05-071-75/+50
| | | | | | | | | | The ret_msg struct was free'd but its result could be accessed after a failed write. Fixed by storing the results of the commands in a temporary variable and accessing this upon write failure. Also simplifies some other code. 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-037-2/+24
| | | | | | | | | 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>
* lib: Make UNIX socket buffer size configurable0.11.3Sander Vrijders2018-05-034-10/+17
| | | | | | | | | | This makes the buffer size used by the UNIX sockets configurable. In case of a lot of IPCPs in the system it might become too small with the default value, resulting in irm command failures. The user can now easily configure it with an adequate value. Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be> Signed-off-by: Dimitri Staessens <dimitri.staessens@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>
* lib: Shut rx buffer down before cleanup and exitDimitri Staessens2018-04-261-0/+1
| | | | | | | | | | If a program exits, it cleans its read buffer. However, another process could still write a packet in that buffer, which would cause the IPCP or IRMd to run into an assertion failure on shutdown. Setting the rbuff to ACL_FLOWDOWN prevents this. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
* irmd: Shut down IPCPs before IRMd internalsDimitri Staessens2018-04-261-18/+20
| | | | | | | | | This will shut down IPCPs before destroying IRMd internals. This fixes warnings from IPCPs trying to send messages and send packets upon IRM shutdown. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
* lib: Unmount stale FUSE mountpointsDimitri Staessens2018-04-261-1/+10
| | | | | | | | This will unmount a stale FUSE mountpoint (an IPCP with the same pid exited ungracefully on the system) before trying to create it. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
* lib: Fix bad unlinking of old shared memorySander Vrijders2018-04-251-5/+1
| | | | | | | | | | A previous commit tried to stat the shared memory file in case it was already there, but stat does not seem to work for shared memory files. This simply omits the O_EXCL attribute upon creation of the shared memory file, since pids are unique anyway. Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be> Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be>
* tools: Add check for irm ipcp listSander Vrijders2018-04-251-2/+9
| | | | | | | | | This adds a check in the irm ipcp list command to see if irm_list_ipcps returned an error or not. Before it was only checking if there were zero IPCPs in the system. Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be> Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be>
* lib: Unlink old flow set shared memorySander Vrijders2018-04-251-0/+4
| | | | | | | | | This unlinks previously allocated flow set shared memory. It could be lingering in case an application with the same pid was SIGKILLED, and didn't clean up its flow set shared memory. Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be> Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be>
* tools: Fix type check when bootstrapping ipcpsDimitri Staessens2018-04-201-14/+16
| | | | | | | | The type check failed incorrectly if the type was specified because the specified type was not set. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
* tools: Fix help information for irm ipcpSander Vrijders2018-04-172-3/+8
| | | | | | | | The new command 'irm ipcp list' was not being printed upon printing the usage of 'irm ipcp'. It also fixes an unchecked return value. Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be> Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be>
* ipcpd: Fix truncate of small packetsDimitri Staessens2018-04-051-1/+1
| | | | | | | | The truncate was setting the length to the frame length, instead of the actual payload length to be delivered to the N+1. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
* ipcpd: Add ethertype checkDimitri Staessens2018-04-051-1/+7
| | | | | | | | An ethertype check was missing for the DIX ethernet IPCP, causing crashes if there is other traffic on the network. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
* ipcpd: Avoid unnecessary copy in eth writerDimitri Staessens2018-04-051-25/+45
| | | | | | | | | This writes into the Ethernet device directly from the rdrbuff to avoid a copy on the write side in the Ethernet IPCPs. This does not work for the netmap device. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
* ipcpd: Avoid unnecessary copy in eth readerDimitri Staessens2018-04-052-32/+71
| | | | | | | | | This reads from the Ethernet device directly into the rdrbuff to avoid a copy on the read side in the Ethernet IPCPs. This does not work for the netmap device. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
* ipcpd: Remove signal handler from ipcp.hDimitri Staessens2018-04-052-9/+4
| | | | | | | | The signal handler is completely embedded in the source file. There was no more need to call it from elsewhere. 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-058-2/+49
| | | | | | | | | 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>
* tools: Fix hash algorithm in ipcp_bootstrap0.11.2Dimitri Staessens2018-04-051-1/+1
| | | | | | | A bad check caused failure to set the hash algorithm for IPCPs. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
* ipcpd: Fix frame buffer in eth ipcpsDimitri Staessens2018-04-051-2/+2
| | | | | | | | The packets were being sent and read into a buffer that had the payload length instead of the frame length. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
* irmd: Fix unreachable statement0.11.1Dimitri Staessens2018-03-281-1/+0
| | | | | | | The unreachable statement was missed by some compilers. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
* tools: Increase read buffer in ocbr serverDimitri Staessens2018-03-253-5/+16
| | | | | | | | | | | | The ocbr server had a 1500 byte read buffer, which caused it to perform partial reads on larger SDUs, slowing it down considerably when sendin large packets. The buffer has been increased to 512KB, partial reads disabled, and the client will give an error when larger frames are sent. It will also warn if the size overflows (avoiding a SEGV). Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>