The worker process receives the client's IPs from the main process.

That eliminates the need to read the IP address from the tun device
(which can be quite tricky to implement in a clean portable way).
This commit is contained in:
Nikos Mavrogiannopoulos
2014-01-31 20:53:45 +01:00
parent f715cf08f0
commit 28e5d62f3f
12 changed files with 172 additions and 275 deletions
+11 -3
View File
@@ -157,7 +157,16 @@ unsigned j;
fprintf(stderr, "Configuration option %s is mandatory.\n", name); \
exit(1); \
}
#define READ_STATIC_STRING(name, s_name) \
val = get_option(name, &mand); \
if (val != NULL && val->valType == OPARG_TYPE_STRING) \
snprintf(s_name, sizeof(s_name), "%s", val->v.strVal); \
else if (mand != 0) { \
fprintf(stderr, "Configuration option %s is mandatory.\n", name); \
exit(1); \
}
#define READ_TF(name, s_name, def) \
{ char* tmp_tf = NULL; \
READ_STRING(name, tmp_tf); \
@@ -383,7 +392,7 @@ unsigned force_cert_auth;
config->gid = grp->gr_gid;
}
READ_STRING("device", config->network.name);
READ_STATIC_STRING("device", config->network.name);
READ_STRING("cgroup", config->cgroup);
READ_STRING("ipv4-network", config->network.ipv4);
@@ -560,7 +569,6 @@ unsigned i;
DEL(config->connect_script);
DEL(config->disconnect_script);
DEL(config->network.name);
DEL(config->network.ipv4);
DEL(config->network.ipv4_netmask);
DEL(config->network.ipv4_dns);