Skip to content

Commit f14da63

Browse files
caeiesDimitriPapadopoulos
authored andcommitted
Tun: allow the tun option in config file.
1 parent 8a7847e commit f14da63

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

src/config.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,18 @@ int load_config(struct vpn_config *cfg, const char *filename)
296296
} else if (strcmp(key, "realm") == 0) {
297297
strncpy(cfg->realm, val, REALM_SIZE);
298298
cfg->realm[REALM_SIZE] = '\0';
299+
} else if (strcmp(key, "tun") == 0) {
300+
long tun = strtol(val, NULL, 0);
301+
302+
if (tun < 0 || tun > 1) {
303+
log_warn("Bad tun option in configuration file: \"%ld\".\n",
304+
tun);
305+
continue;
306+
}
307+
cfg->tun = tun;
308+
} else if (strcmp(key, "tun-ifname") == 0) {
309+
free(cfg->tun_ifname);
310+
cfg->tun_ifname = strdup(val);
299311
} else if (strcmp(key, "set-dns") == 0) {
300312
int set_dns = strtob(val);
301313

0 commit comments

Comments
 (0)