]> git.meshlink.io Git - meshlink/blobdiff - src/graph.c
Remove support for calling external scripts.
[meshlink] / src / graph.c
index 7079f93efc5e98513541b47de14d823211874b30..67fe99f7f9bc393350621108cf34230308e7fc0e 100644 (file)
@@ -44,9 +44,7 @@
 
 #include "system.h"
 
-#include "config.h"
 #include "connection.h"
-#include "device.h"
 #include "edge.h"
 #include "graph.h"
 #include "list.h"
@@ -54,9 +52,7 @@
 #include "names.h"
 #include "netutl.h"
 #include "node.h"
-#include "process.h"
 #include "protocol.h"
-#include "subnet.h"
 #include "utils.h"
 #include "xalloc.h"
 #include "graph.h"
@@ -204,7 +200,7 @@ static void check_reachability(void) {
        for splay_each(node_t, n, node_tree) {
                if(n->status.visited != n->status.reachable) {
                        n->status.reachable = !n->status.reachable;
-                       n->last_state_change = time(NULL);
+                       n->last_state_change = now.tv_sec;
 
                        if(n->status.reachable) {
                                logger(DEBUG_TRAFFIC, LOG_DEBUG, "Node %s (%s) became reachable",
@@ -233,33 +229,7 @@ static void check_reachability(void) {
 
                        timeout_del(&n->mtutimeout);
 
-                       char *name;
-                       char *address;
-                       char *port;
-                       char *envp[7];
-
-                       xasprintf(&envp[0], "NETNAME=%s", netname ? : "");
-                       xasprintf(&envp[1], "DEVICE=%s", device ? : "");
-                       xasprintf(&envp[2], "INTERFACE=%s", iface ? : "");
-                       xasprintf(&envp[3], "NODE=%s", n->name);
-                       sockaddr2str(&n->address, &address, &port);
-                       xasprintf(&envp[4], "REMOTEADDRESS=%s", address);
-                       xasprintf(&envp[5], "REMOTEPORT=%s", port);
-                       envp[6] = NULL;
-
-                       execute_script(n->status.reachable ? "host-up" : "host-down", envp);
-
-                       xasprintf(&name, n->status.reachable ? "hosts/%s-up" : "hosts/%s-down", n->name);
-                       execute_script(name, envp);
-
-                       free(name);
-                       free(address);
-                       free(port);
-
-                       for(int i = 0; i < 6; i++)
-                               free(envp[i]);
-
-                       subnet_update(n, NULL, n->status.reachable);
+                       //TODO: callback to application to inform of this node going up/down
 
                        if(!n->status.reachable) {
                                update_node_udp(n, NULL);
@@ -278,7 +248,6 @@ static void check_reachability(void) {
 }
 
 void graph(void) {
-       subnet_cache_flush();
        sssp_bfs();
        check_reachability();
        mst_kruskal();