From 55cfed9956386d078ae33fc5b814c1c51f2abd15 Mon Sep 17 00:00:00 2001 From: "J. A. Bezemer" Date: Sun, 20 Sep 2009 15:11:15 +0000 Subject: [PATCH] update client code #75 --- src/client.h | 2 ++ src/iodine.c | 16 +++++++++++++--- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/client.h b/src/client.h index 865ae4f..e20c281 100644 --- a/src/client.h +++ b/src/client.h @@ -26,6 +26,8 @@ const char *client_get_raw_addr(); void client_set_nameserver(const char *cp, int port); void client_set_topdomain(const char *cp); void client_set_password(const char *cp); +void set_qtype(char *qtype); +void set_downenc(char *encoding); int client_handshake(int dns_fd, int raw_mode, int autodetect_frag_size, int fragsize); int client_tunnel(int tun_fd, int dns_fd); diff --git a/src/iodine.c b/src/iodine.c index 8d12c04..c5c097f 100644 --- a/src/iodine.c +++ b/src/iodine.c @@ -61,7 +61,7 @@ usage() { extern char *__progname; fprintf(stderr, "Usage: %s [-v] [-h] [-f] [-r] [-u user] [-t chrootdir] [-d device] " - "[-P password] [-m maxfragsize] [-z context] [-F pidfile] " + "[-P password] [-m maxfragsize] [-T type] [-O enc] [-z context] [-F pidfile] " "[nameserver] topdomain\n", __progname); exit(2); } @@ -72,7 +72,7 @@ help() { fprintf(stderr, "iodine IP over DNS tunneling client\n"); fprintf(stderr, "Usage: %s [-v] [-h] [-f] [-r] [-u user] [-t chrootdir] [-d device] " - "[-P password] [-m maxfragsize] [-z context] [-F pidfile] " + "[-P password] [-m maxfragsize] [-T type] [-O enc] [-z context] [-F pidfile] " "[nameserver] topdomain\n", __progname); fprintf(stderr, " -v to print version info and exit\n"); fprintf(stderr, " -h to print this help and exit\n"); @@ -83,6 +83,8 @@ help() { fprintf(stderr, " -d device to set tunnel device name\n"); fprintf(stderr, " -P password used for authentication (max 32 chars will be used)\n"); fprintf(stderr, " -m maxfragsize, to limit size of downstream packets\n"); + fprintf(stderr, " -T dns type: NULL (default, fastest), TXT, CNAME, A (CNAME answer), MX\n"); + fprintf(stderr, " -O downstream encoding (!NULL): Base32(default), Base64, or Raw (only TXT)\n"); fprintf(stderr, " -z context, to apply specified SELinux context after initialization\n"); fprintf(stderr, " -F pidfile to write pid to a file\n"); fprintf(stderr, "nameserver is the IP number of the relaying nameserver, if absent /etc/resolv.conf is used\n"); @@ -133,6 +135,7 @@ main(int argc, char **argv) #endif username = NULL; memset(password, 0, 33); + srand(time(NULL)); foreground = 0; newroot = NULL; context = NULL; @@ -159,7 +162,7 @@ main(int argc, char **argv) __progname++; #endif - while ((choice = getopt(argc, argv, "vfhru:t:d:P:m:F:")) != -1) { + while ((choice = getopt(argc, argv, "vfhru:t:d:P:m:F:T:O:")) != -1) { switch(choice) { case 'v': version(); @@ -200,6 +203,12 @@ main(int argc, char **argv) case 'F': pidfile = optarg; break; + case 'T': + set_qtype(optarg); + break; + case 'O': /* not -D, is Debug in server */ + set_downenc(optarg); + break; default: usage(); /* NOTREACHED */ @@ -234,6 +243,7 @@ main(int argc, char **argv) if (nameserv_addr) { client_set_nameserver(nameserv_addr, DNS_PORT); } else { + warnx("No nameserver found - not connected to any network?\n"); usage(); /* NOTREACHED */ }