mirror of
https://github.com/yarrick/iodine.git
synced 2024-11-25 11:05:15 +00:00
Added client debug output option
This commit is contained in:
parent
c83a52c771
commit
9f6033c4b8
@ -18,6 +18,8 @@
|
|||||||
#ifndef __CLIENT_H__
|
#ifndef __CLIENT_H__
|
||||||
#define __CLIENT_H__
|
#define __CLIENT_H__
|
||||||
|
|
||||||
|
extern int debug;
|
||||||
|
|
||||||
void client_init();
|
void client_init();
|
||||||
void client_stop();
|
void client_stop();
|
||||||
|
|
||||||
@ -33,7 +35,7 @@ char *client_get_qtype();
|
|||||||
void client_set_downenc(char *encoding);
|
void client_set_downenc(char *encoding);
|
||||||
void client_set_selecttimeout(int select_timeout);
|
void client_set_selecttimeout(int select_timeout);
|
||||||
void client_set_lazymode(int lazy_mode);
|
void client_set_lazymode(int lazy_mode);
|
||||||
void client_set_hostname_maxlen(int i);
|
void client_set_hostname_maxlen(size_t i);
|
||||||
|
|
||||||
int client_handshake(int dns_fd, int raw_mode, int autodetect_frag_size, int fragsize);
|
int client_handshake(int dns_fd, int raw_mode, int autodetect_frag_size, int fragsize);
|
||||||
int client_tunnel(int tun_fd, int dns_fd);
|
int client_tunnel(int tun_fd, int dns_fd);
|
||||||
|
15
src/iodine.c
15
src/iodine.c
@ -69,7 +69,7 @@ static void
|
|||||||
usage() {
|
usage() {
|
||||||
extern char *__progname;
|
extern char *__progname;
|
||||||
|
|
||||||
fprintf(stderr, "Usage: %s [-v] [-h] [-f] [-r] [-u user] [-t chrootdir] [-d device] "
|
fprintf(stderr, "Usage: %s [-v] [-h] [-f] [-D] [-r] [-u user] [-t chrootdir] [-d device] "
|
||||||
"[-P password] [-m maxfragsize] [-M maxlen] [-T type] [-O enc] [-L 0|1] [-I sec] "
|
"[-P password] [-m maxfragsize] [-M maxlen] [-T type] [-O enc] [-L 0|1] [-I sec] "
|
||||||
"[-z context] [-F pidfile] topdomain [nameserver ...]\n", __progname);
|
"[-z context] [-F pidfile] topdomain [nameserver ...]\n", __progname);
|
||||||
exit(2);
|
exit(2);
|
||||||
@ -97,6 +97,7 @@ help() {
|
|||||||
fprintf(stderr, " -v to print version info and exit\n");
|
fprintf(stderr, " -v to print version info and exit\n");
|
||||||
fprintf(stderr, " -h to print this help and exit\n");
|
fprintf(stderr, " -h to print this help and exit\n");
|
||||||
fprintf(stderr, " -f to keep running in foreground\n");
|
fprintf(stderr, " -f to keep running in foreground\n");
|
||||||
|
fprintf(stderr, " -D enable debug mode (add more D's to increase debug level)\n");
|
||||||
fprintf(stderr, " -u name to drop privileges and run as user 'name'\n");
|
fprintf(stderr, " -u name to drop privileges and run as user 'name'\n");
|
||||||
fprintf(stderr, " -t dir to chroot to directory dir\n");
|
fprintf(stderr, " -t dir to chroot to directory dir\n");
|
||||||
fprintf(stderr, " -d device to set tunnel device name\n");
|
fprintf(stderr, " -d device to set tunnel device name\n");
|
||||||
@ -169,6 +170,7 @@ main(int argc, char **argv)
|
|||||||
context = NULL;
|
context = NULL;
|
||||||
device = NULL;
|
device = NULL;
|
||||||
pidfile = NULL;
|
pidfile = NULL;
|
||||||
|
debug = 0;
|
||||||
|
|
||||||
autodetect_frag_size = 1;
|
autodetect_frag_size = 1;
|
||||||
max_downstream_frag_size = 3072;
|
max_downstream_frag_size = 3072;
|
||||||
@ -194,7 +196,7 @@ main(int argc, char **argv)
|
|||||||
__progname++;
|
__progname++;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
while ((choice = getopt(argc, argv, "46vfhru:t:d:R:P:m:M:F:T:O:L:I:")) != -1) {
|
while ((choice = getopt(argc, argv, "46vfDhru:t:d:R:P:m:M:F:T:O:L:I:")) != -1) {
|
||||||
switch(choice) {
|
switch(choice) {
|
||||||
case '4':
|
case '4':
|
||||||
nameserv_family = AF_INET;
|
nameserv_family = AF_INET;
|
||||||
@ -209,6 +211,9 @@ main(int argc, char **argv)
|
|||||||
case 'f':
|
case 'f':
|
||||||
foreground = 1;
|
foreground = 1;
|
||||||
break;
|
break;
|
||||||
|
case 'D':
|
||||||
|
debug++;
|
||||||
|
break;
|
||||||
case 'h':
|
case 'h':
|
||||||
help();
|
help();
|
||||||
/* NOTREACHED */
|
/* NOTREACHED */
|
||||||
@ -286,6 +291,12 @@ main(int argc, char **argv)
|
|||||||
argc -= optind;
|
argc -= optind;
|
||||||
argv += optind;
|
argv += optind;
|
||||||
|
|
||||||
|
if (debug) {
|
||||||
|
fprintf(stderr, "Debug level %d enabled, will stay in foreground.\n", debug);
|
||||||
|
fprintf(stderr, "Add more -D switches to set higher debug level.\n");
|
||||||
|
foreground = 1;
|
||||||
|
}
|
||||||
|
|
||||||
nameserv_hosts_len = argc - 1;
|
nameserv_hosts_len = argc - 1;
|
||||||
if (nameserv_hosts_len <= 0)
|
if (nameserv_hosts_len <= 0)
|
||||||
nameserv_hosts_len = 1;
|
nameserv_hosts_len = 1;
|
||||||
|
Loading…
Reference in New Issue
Block a user