X-Git-Url: https://tinc-vpn.org/git/browse?a=blobdiff_plain;f=src%2Fsubnet.c;h=4fefda6ff8f47996c380eabf2165da7d72b1aa9f;hb=refs%2Fheads%2F1.1;hp=fe7d23efb980f4f93daff30c8f5d26a1e3aecb2f;hpb=6debc6c79ba385d35f646e0958f84ace5b8f4b4d;p=tinc diff --git a/src/subnet.c b/src/subnet.c index fe7d23ef..94000cc0 100644 --- a/src/subnet.c +++ b/src/subnet.c @@ -1,6 +1,6 @@ /* subnet.c -- handle subnet lookups and lists - Copyright (C) 2000-2017 Guus Sliepen , + Copyright (C) 2000-2022 Guus Sliepen , 2000-2005 Ivo Timmermans This program is free software; you can redistribute it and/or modify @@ -31,6 +31,7 @@ #include "script.h" #include "subnet.h" #include "xalloc.h" +#include "sandbox.h" /* lists type of subnet */ uint32_t hash_seed; @@ -162,7 +163,7 @@ void subnet_cache_flush_tables(void) { hash_clear(mac_t, &mac_cache); } -void subnet_cache_flush(subnet_t *subnet) { +static void subnet_cache_flush(subnet_t *subnet) { switch(subnet->type) { case SUBNET_IPV4: if(subnet->net.ipv4.prefixlength == 32) { @@ -321,8 +322,12 @@ subnet_t *lookup_subnet_ipv6(const ipv6_t *address) { } void subnet_update(node_t *owner, subnet_t *subnet, bool up) { + if(!sandbox_can(START_PROCESSES, RIGHT_NOW)) { + return; + } + char netstr[MAXNETSTR]; - char *name, *address, *port; + char *address, *port; char empty[] = ""; // Prepare environment variables to be passed to the script @@ -342,7 +347,7 @@ void subnet_update(node_t *owner, subnet_t *subnet, bool up) { int env_subnet = environment_add(&env, NULL); int env_weight = environment_add(&env, NULL); - name = up ? "subnet-up" : "subnet-down"; + const char *name = up ? "subnet-up" : "subnet-down"; if(!subnet) { for splay_each(subnet_t, subnet, &owner->subnet_tree) {