mirror of
https://github.com/yarrick/iodine.git
synced 2024-11-29 01:11:27 +00:00
return 1 if opening tun fails and args are correct
This commit is contained in:
parent
da50020f5b
commit
196b37c402
|
@ -1053,6 +1053,7 @@ main(int argc, char **argv)
|
||||||
int mtu;
|
int mtu;
|
||||||
int skipipconfig;
|
int skipipconfig;
|
||||||
char *netsize;
|
char *netsize;
|
||||||
|
int retval;
|
||||||
|
|
||||||
username = NULL;
|
username = NULL;
|
||||||
newroot = NULL;
|
newroot = NULL;
|
||||||
|
@ -1071,6 +1072,8 @@ main(int argc, char **argv)
|
||||||
|
|
||||||
b32 = get_base32_encoder();
|
b32 = get_base32_encoder();
|
||||||
|
|
||||||
|
retval = 0;
|
||||||
|
|
||||||
#ifdef WINDOWS32
|
#ifdef WINDOWS32
|
||||||
WSAStartup(req_version, &wsa_data);
|
WSAStartup(req_version, &wsa_data);
|
||||||
#endif
|
#endif
|
||||||
|
@ -1235,16 +1238,26 @@ main(int argc, char **argv)
|
||||||
if (strlen(password) == 0)
|
if (strlen(password) == 0)
|
||||||
read_password(password, sizeof(password));
|
read_password(password, sizeof(password));
|
||||||
|
|
||||||
if ((tun_fd = open_tun(device)) == -1)
|
if ((tun_fd = open_tun(device)) == -1) {
|
||||||
|
retval = 1;
|
||||||
goto cleanup0;
|
goto cleanup0;
|
||||||
if (!skipipconfig)
|
}
|
||||||
if (tun_setip(argv[0], netmask) != 0 || tun_setmtu(mtu) != 0)
|
if (!skipipconfig) {
|
||||||
|
if (tun_setip(argv[0], netmask) != 0 || tun_setmtu(mtu) != 0) {
|
||||||
|
retval = 1;
|
||||||
goto cleanup1;
|
goto cleanup1;
|
||||||
if ((dnsd_fd = open_dns(port, listen_ip)) == -1)
|
}
|
||||||
|
}
|
||||||
|
if ((dnsd_fd = open_dns(port, listen_ip)) == -1) {
|
||||||
|
retval = 1;
|
||||||
goto cleanup2;
|
goto cleanup2;
|
||||||
if (bind_enable)
|
}
|
||||||
if ((bind_fd = open_dns(0, INADDR_ANY)) == -1)
|
if (bind_enable) {
|
||||||
|
if ((bind_fd = open_dns(0, INADDR_ANY)) == -1) {
|
||||||
|
retval = 1;
|
||||||
goto cleanup3;
|
goto cleanup3;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
my_mtu = mtu;
|
my_mtu = mtu;
|
||||||
|
|
||||||
|
@ -1290,5 +1303,5 @@ cleanup1:
|
||||||
close_tun(tun_fd);
|
close_tun(tun_fd);
|
||||||
cleanup0:
|
cleanup0:
|
||||||
|
|
||||||
return 0;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue