/*
net_setup.c -- Setup.
Copyright (C) 1998-2005 Ivo Timmermans,
- 2000-2016 Guus Sliepen <guus@tinc-vpn.org>
+ 2000-2017 Guus Sliepen <guus@tinc-vpn.org>
2006 Scott Lamb <slamb@slamb.org>
2010 Brandon Black <blblack@gmail.com>
#endif
char *myport;
-static char *myname;
static io_t device_io;
devops_t devops;
bool device_standby = false;
get_config_bool(lookup_config(config_tree, "DisableBuggyPeers"), &disablebuggypeers);
+ if(!get_config_int(lookup_config(config_tree, "InvitationExpire"), &invitation_lifetime))
+ invitation_lifetime = 604800; // 1 week
+
read_invitation_key();
return true;
/* Run tinc-up script to further initialize the tap interface */
- char *envp[5] = {NULL};
- xasprintf(&envp[0], "NETNAME=%s", netname ? : "");
- xasprintf(&envp[1], "DEVICE=%s", device ? : "");
- xasprintf(&envp[2], "INTERFACE=%s", iface ? : "");
- xasprintf(&envp[3], "NAME=%s", myname);
-
- execute_script("tinc-up", envp);
-
- for(int i = 0; i < 4; i++)
- free(envp[i]);
+ environment_t env;
+ environment_init(&env);
+ execute_script("tinc-up", &env);
+ environment_exit(&env);
}
void device_disable(void) {
- char *envp[5] = {NULL};
- xasprintf(&envp[0], "NETNAME=%s", netname ? : "");
- xasprintf(&envp[1], "DEVICE=%s", device ? : "");
- xasprintf(&envp[2], "INTERFACE=%s", iface ? : "");
- xasprintf(&envp[3], "NAME=%s", myname);
-
- execute_script("tinc-down", envp);
-
- for(int i = 0; i < 4; i++)
- free(envp[i]);
+ environment_t env;
+ environment_init(&env);
+ execute_script("tinc-down", &env);
+ environment_exit(&env);
if (devops.disable)
devops.disable();
exit_control();
- free(myname);
free(scriptextension);
free(scriptinterpreter);