]> git.meshlink.io Git - meshlink/blobdiff - src/subnet.c
Remove files not used by MeshLink.
[meshlink] / src / subnet.c
index 12ca03c73135d8e6e80596fba7793b02580ac7af..e45d0045235f59802253d2d2add3bb61586b74eb 100644 (file)
 
 #include "splay_tree.h"
 #include "control_common.h"
-#include "device.h"
 #include "hash.h"
 #include "logger.h"
 #include "names.h"
 #include "net.h"
 #include "netutl.h"
 #include "node.h"
-#include "process.h"
+#include "script.h"
 #include "subnet.h"
 #include "utils.h"
 #include "xalloc.h"
@@ -79,7 +78,7 @@ void free_subnet_tree(splay_tree_t *subnet_tree) {
 /* Allocating and freeing space for subnets */
 
 subnet_t *new_subnet(void) {
-       return xmalloc_and_zero(sizeof(subnet_t));
+       return xzalloc(sizeof(subnet_t));
 }
 
 void free_subnet(subnet_t *subnet) {
@@ -204,10 +203,8 @@ void subnet_update(node_t *owner, subnet_t *subnet, bool up) {
 
        // Prepare environment variables to be passed to the script
 
-       char *envp[9] = {NULL};
+       char *envp[10] = {NULL};
        xasprintf(&envp[0], "NETNAME=%s", netname ? : "");
-       xasprintf(&envp[1], "DEVICE=%s", device ? : "");
-       xasprintf(&envp[2], "INTERFACE=%s", iface ? : "");
        xasprintf(&envp[3], "NODE=%s", owner->name);
 
        if(owner != myself) {
@@ -219,6 +216,8 @@ void subnet_update(node_t *owner, subnet_t *subnet, bool up) {
                free(address);
        }
 
+       xasprintf(&envp[8], "NAME=%s", myself->name);
+
        name = up ? "subnet-up" : "subnet-down";
 
        if(!subnet) {
@@ -260,7 +259,7 @@ void subnet_update(node_t *owner, subnet_t *subnet, bool up) {
                }
        }
 
-       for(int i = 0; envp[i] && i < 8; i++)
+       for(int i = 0; envp[i] && i < 9; i++)
                free(envp[i]);
 }