mirror of
https://github.com/yarrick/iodine.git
synced 2024-11-24 00:59:19 +02:00
Added debug capability on server
This commit is contained in:
parent
2ab94a7991
commit
9fa70acc69
|
@ -17,6 +17,8 @@ CHANGES:
|
|||
- Fixed bug #21, now only IP address part of each packet is checked.
|
||||
Should remove the need for the -c option and also work with
|
||||
bugfixed DNS servers worldwide.
|
||||
- Added -D option on server to enable debugging. Debug level 1 now prints
|
||||
info about each RX/TX datagram.
|
||||
|
||||
2007-11-30: 0.4.1 "Tea Online"
|
||||
- Introduced encoding API
|
||||
|
|
|
@ -25,7 +25,7 @@ iodine, iodined \- tunnel IPv4 over DNS
|
|||
|
||||
.B iodined [-h]
|
||||
|
||||
.B iodined [-c] [-s] [-f] [-u
|
||||
.B iodined [-c] [-s] [-f] [-D] [-u
|
||||
.I user
|
||||
.B ] [-P
|
||||
.I password
|
||||
|
@ -79,13 +79,15 @@ and otherwise tunX.
|
|||
.SS Server Options:
|
||||
.TP
|
||||
.B -c
|
||||
Disable checks on client IP and port on all incoming requests.
|
||||
This might help if server is behind a NAT firewall.
|
||||
Disable checks on client IP on all incoming requests.
|
||||
.TP
|
||||
.B -s
|
||||
Don't try to configure IP address or MTU. This should only be used if
|
||||
you have already configured the device that will be used.
|
||||
.TP
|
||||
.B -D
|
||||
Increase debug level. Level 1 prints info about each RX/TX packet.
|
||||
.TP
|
||||
.B -m mtu
|
||||
Set 'mtu' as mtu size for the tunnel device. This will be sent to the client
|
||||
on connect, and the client will use the same mtu.
|
||||
|
|
|
@ -57,6 +57,8 @@ static int check_ip;
|
|||
static int my_mtu;
|
||||
static in_addr_t my_ip;
|
||||
|
||||
static int debug;
|
||||
|
||||
#if !defined(BSD) && !defined(__GLIBC__)
|
||||
static char *__progname;
|
||||
#endif
|
||||
|
@ -327,6 +329,12 @@ tunnel_dns(int tun_fd, int dns_fd)
|
|||
|
||||
if ((read = read_dns(dns_fd, &q)) <= 0)
|
||||
return 0;
|
||||
|
||||
if (debug >= 1) {
|
||||
struct sockaddr_in *tempin;
|
||||
tempin = (struct sockaddr_in *) &(q.from);
|
||||
printf("RX: client %s, type %d, name %s\n", inet_ntoa(tempin->sin_addr), q.type, q.name);
|
||||
}
|
||||
|
||||
switch (q.type) {
|
||||
case T_NULL:
|
||||
|
@ -427,6 +435,13 @@ write_dns(int fd, struct query *q, char *data, int datalen)
|
|||
|
||||
len = dns_encode(buf, sizeof(buf), q, QR_ANSWER, data, datalen);
|
||||
|
||||
if (debug >= 1) {
|
||||
struct sockaddr_in *tempin;
|
||||
tempin = (struct sockaddr_in *) &(q->from);
|
||||
printf("TX: client %s, type %d, name %s, %d bytes data\n",
|
||||
inet_ntoa(tempin->sin_addr), q->type, q->name, datalen);
|
||||
}
|
||||
|
||||
sendto(fd, buf, len, 0, (struct sockaddr*)&q->from, q->fromlen);
|
||||
}
|
||||
|
||||
|
@ -499,6 +514,7 @@ main(int argc, char **argv)
|
|||
port = 53;
|
||||
check_ip = 1;
|
||||
skipipconfig = 0;
|
||||
debug = 0;
|
||||
|
||||
b32 = get_base32_encoder();
|
||||
|
||||
|
@ -513,7 +529,7 @@ main(int argc, char **argv)
|
|||
memset(password, 0, sizeof(password));
|
||||
srand(time(NULL));
|
||||
|
||||
while ((choice = getopt(argc, argv, "vcsfhu:t:d:m:l:p:P:")) != -1) {
|
||||
while ((choice = getopt(argc, argv, "vcsfhDu:t:d:m:l:p:P:")) != -1) {
|
||||
switch(choice) {
|
||||
case 'v':
|
||||
version();
|
||||
|
@ -530,6 +546,9 @@ main(int argc, char **argv)
|
|||
case 'h':
|
||||
help();
|
||||
break;
|
||||
case 'D':
|
||||
debug++;
|
||||
break;
|
||||
case 'u':
|
||||
username = optarg;
|
||||
break;
|
||||
|
@ -605,6 +624,12 @@ main(int argc, char **argv)
|
|||
printf("You must manually forward port 53 to port %d for things to work.\n", port);
|
||||
}
|
||||
|
||||
if (debug) {
|
||||
printf("Debug level %d enabled, will stay in foreground.\n", debug);
|
||||
printf("Add more -D switches to set higher debug level.\n");
|
||||
foreground = 1;
|
||||
}
|
||||
|
||||
if (listen_ip == INADDR_NONE) {
|
||||
warnx("Bad IP address to listen on.\n");
|
||||
usage();
|
||||
|
|
Loading…
Reference in New Issue