Don't close control connections when handling a reload command.
authorGuus Sliepen <guus@tinc-vpn.org>
Sun, 26 Feb 2012 15:56:53 +0000 (16:56 +0100)
committerGuus Sliepen <guus@tinc-vpn.org>
Sun, 26 Feb 2012 15:56:53 +0000 (16:56 +0100)
Because this would terminate the connection while the control message
handler was still running, it would lead to a segmentation fault later
on.

src/net.c

index 336bf9eec312bcc381751fd5d2fba8c8306d078a..c743d5981c7ce241189815a508ee05dd0be35cae 100644 (file)
--- a/src/net.c
+++ b/src/net.c
@@ -165,6 +165,9 @@ static void timeout_handler(int fd, short events, void *event) {
                next = node->next;
                c = node->data;
 
+               if(c->status.control)
+                       continue;
+
                if(c->last_ping_time + pingtimeout <= now) {
                        if(c->status.active) {
                                if(c->status.pinged) {
@@ -276,6 +279,9 @@ int reload_configuration(void) {
        for(node = connection_tree->head; node; node = next) {
                c = node->data;
                next = node->next;
+
+               if(c->status.control)
+                       continue;
                
                if(c->outgoing) {
                        free(c->outgoing->name);