mirror of
https://github.com/yarrick/iodine.git
synced 2024-12-01 01:16:11 +03:00
Release 0.3.1
This commit is contained in:
parent
fa06d5eea1
commit
1feacfada3
18
CHANGELOG
Normal file
18
CHANGELOG
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
|
||||||
|
iodine - IP over DNS is now easy
|
||||||
|
|
||||||
|
http://code.kryo.se/iodine
|
||||||
|
|
||||||
|
********************************
|
||||||
|
|
||||||
|
CHANGES:
|
||||||
|
|
||||||
|
2006-07-11: 0.3.1
|
||||||
|
- Add Mac OSX support
|
||||||
|
- Add setting device name
|
||||||
|
- Use compression of domain name in reply (should allow setting MTU
|
||||||
|
approx 200 bytes higher)
|
||||||
|
|
||||||
|
2006-06-24: 0.3.0
|
||||||
|
- First public release
|
||||||
|
- Support for Linux, FreeBSD, OpenBSD
|
7
README
7
README
@ -61,9 +61,10 @@ possible to allow maximum throughput.
|
|||||||
|
|
||||||
PORTABILITY:
|
PORTABILITY:
|
||||||
|
|
||||||
iodine has been tested on Linux (x86 and SPARC64), FreeBSD (x86) and
|
iodine has been tested on Linux (x86 and SPARC64), FreeBSD (x86), OpenBSD (x86)
|
||||||
OpenBSD (x86). It should work on other unix-like systems as well that has
|
and MacOS X (10.3, ppc, with http://www-user.rhrk.uni-kl.de/~nissler/tuntap/).
|
||||||
TUN/TAP tunneling support. Let us know if you get it to run on other platforms.
|
It should work on other unix-like systems as well that has TUN/TAP tunneling
|
||||||
|
support. Let us know if you get it to run on other platforms.
|
||||||
|
|
||||||
|
|
||||||
THE NAME:
|
THE NAME:
|
||||||
|
19
dns.c
19
dns.c
@ -19,11 +19,15 @@
|
|||||||
#include <netinet/in.h>
|
#include <netinet/in.h>
|
||||||
#include <arpa/inet.h>
|
#include <arpa/inet.h>
|
||||||
#include <arpa/nameser.h>
|
#include <arpa/nameser.h>
|
||||||
|
#ifdef DARWIN
|
||||||
|
#include <arpa/nameser8_compat.h>
|
||||||
|
#endif
|
||||||
#include <netdb.h>
|
#include <netdb.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <err.h>
|
#include <err.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <stdint.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
@ -352,7 +356,6 @@ dns_read(int fd, char *buf, int buflen)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
host2dns(const char *host, char *buffer, int size)
|
host2dns(const char *host, char *buffer, int size)
|
||||||
{
|
{
|
||||||
@ -386,6 +389,7 @@ dnsd_send(int fd, struct query *q, char *data, int datalen)
|
|||||||
int len;
|
int len;
|
||||||
char *p;
|
char *p;
|
||||||
char buf[64*1024];
|
char buf[64*1024];
|
||||||
|
short name;
|
||||||
HEADER *header;
|
HEADER *header;
|
||||||
|
|
||||||
memset(buf, 0, sizeof(buf));
|
memset(buf, 0, sizeof(buf));
|
||||||
@ -406,24 +410,21 @@ dnsd_send(int fd, struct query *q, char *data, int datalen)
|
|||||||
|
|
||||||
p = buf + sizeof(HEADER);
|
p = buf + sizeof(HEADER);
|
||||||
|
|
||||||
|
name = 0xc000 | ((p - buf) & 0x3fff);
|
||||||
p += host2dns(q->name, p, strlen(q->name));
|
p += host2dns(q->name, p, strlen(q->name));
|
||||||
PUTSHORT(q->type, p);
|
PUTSHORT(q->type, p);
|
||||||
PUTSHORT(C_IN, p);
|
PUTSHORT(C_IN, p);
|
||||||
|
|
||||||
p += host2dns(q->name, p, strlen(q->name));
|
PUTSHORT(name, p);
|
||||||
PUTSHORT(q->type, p);
|
PUTSHORT(q->type, p);
|
||||||
PUTSHORT(C_IN, p);
|
PUTSHORT(C_IN, p);
|
||||||
PUTLONG(0, p);
|
PUTLONG(0, p);
|
||||||
|
|
||||||
q->id = 0;
|
q->id = 0;
|
||||||
|
|
||||||
if(datalen > 0) {
|
|
||||||
PUTSHORT(datalen, p);
|
PUTSHORT(datalen, p);
|
||||||
memcpy(p, data, datalen);
|
memcpy(p, data, datalen);
|
||||||
p += datalen;
|
p += datalen;
|
||||||
} else {
|
|
||||||
PUTSHORT(0, p);
|
|
||||||
}
|
|
||||||
|
|
||||||
len = p - buf;
|
len = p - buf;
|
||||||
sendto(fd, buf, len, 0, (struct sockaddr*)&q->from, q->fromlen);
|
sendto(fd, buf, len, 0, (struct sockaddr*)&q->from, q->fromlen);
|
||||||
@ -481,9 +482,7 @@ dnsd_read(int fd, struct query *q, char *buf, int buflen)
|
|||||||
addrlen = sizeof(struct sockaddr);
|
addrlen = sizeof(struct sockaddr);
|
||||||
r = recvfrom(fd, packet, sizeof(packet), 0, (struct sockaddr*)&from, &addrlen);
|
r = recvfrom(fd, packet, sizeof(packet), 0, (struct sockaddr*)&from, &addrlen);
|
||||||
|
|
||||||
if(r == -1) {
|
if (r >= sizeof(HEADER)) {
|
||||||
perror("recvfrom");
|
|
||||||
} else {
|
|
||||||
header = (HEADER*)packet;
|
header = (HEADER*)packet;
|
||||||
|
|
||||||
id = ntohs(header->id);
|
id = ntohs(header->id);
|
||||||
@ -508,6 +507,8 @@ dnsd_read(int fd, struct query *q, char *buf, int buflen)
|
|||||||
return decodepacket(name, buf, buflen);
|
return decodepacket(name, buf, buflen);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
perror("recvfrom");
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
2
iodine.c
2
iodine.c
@ -188,7 +188,7 @@ help() {
|
|||||||
static void
|
static void
|
||||||
version() {
|
version() {
|
||||||
printf("iodine IP over DNS tunneling client\n");
|
printf("iodine IP over DNS tunneling client\n");
|
||||||
printf("version: 0.3\n");
|
printf("version: 0.3.1 from 2006-07-11\n");
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -188,7 +188,7 @@ help() {
|
|||||||
static void
|
static void
|
||||||
version() {
|
version() {
|
||||||
printf("iodine IP over DNS tunneling server\n");
|
printf("iodine IP over DNS tunneling server\n");
|
||||||
printf("version: 0.3\n");
|
printf("version: 0.3.1 from 2006-07-11\n");
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
20
tun.c
20
tun.c
@ -85,7 +85,7 @@ open_tun(const char *tun_device)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
warn("open_tun: Couldn't set interface name.\n");
|
warn("open_tun: Couldn't set interface name");
|
||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -100,10 +100,16 @@ open_tun(const char *tun_device)
|
|||||||
char tun_name[50];
|
char tun_name[50];
|
||||||
|
|
||||||
if (tun_device != NULL) {
|
if (tun_device != NULL) {
|
||||||
if ((tun_fd = open(tun_device, O_RDWR)) < 0) {
|
snprintf(tun_name, sizeof(tun_name), "/dev/%s", tun_device);
|
||||||
warn("open_tun: %s: %s", tun_device, strerror(errno));
|
strncpy(if_name, tun_device, sizeof(if_name));
|
||||||
|
|
||||||
|
if ((tun_fd = open(tun_name, O_RDWR)) < 0) {
|
||||||
|
warn("open_tun: %s: %s", tun_name, strerror(errno));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
printf("Opened %s\n", tun_name);
|
||||||
|
return tun_fd;
|
||||||
} else {
|
} else {
|
||||||
for (i = 0; i < TUN_MAX_TRY; i++) {
|
for (i = 0; i < TUN_MAX_TRY; i++) {
|
||||||
snprintf(tun_name, sizeof(tun_name), "/dev/tun%d", i);
|
snprintf(tun_name, sizeof(tun_name), "/dev/tun%d", i);
|
||||||
@ -118,7 +124,7 @@ open_tun(const char *tun_device)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
warn("open_tun: Failed to open tunneling device.");
|
warn("open_tun: Failed to open tunneling device");
|
||||||
}
|
}
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
@ -136,10 +142,10 @@ close_tun(int tun_fd)
|
|||||||
int
|
int
|
||||||
write_tun(int tun_fd, char *data, int len)
|
write_tun(int tun_fd, char *data, int len)
|
||||||
{
|
{
|
||||||
#ifdef FREEBSD
|
#if defined (FREEBSD) || defined (DARWIN)
|
||||||
data += 4;
|
data += 4;
|
||||||
len -= 4;
|
len -= 4;
|
||||||
#else /* !FREEBSD */
|
#else /* !FREEBSD/DARWIN */
|
||||||
#ifdef LINUX
|
#ifdef LINUX
|
||||||
data[0] = 0x00;
|
data[0] = 0x00;
|
||||||
data[1] = 0x00;
|
data[1] = 0x00;
|
||||||
@ -163,7 +169,7 @@ write_tun(int tun_fd, char *data, int len)
|
|||||||
int
|
int
|
||||||
read_tun(int tun_fd, char *buf, int len)
|
read_tun(int tun_fd, char *buf, int len)
|
||||||
{
|
{
|
||||||
#ifdef FREEBSD
|
#if defined (FREEBSD) || defined (DARWIN)
|
||||||
// FreeBSD has no header
|
// FreeBSD has no header
|
||||||
return read(tun_fd, buf + 4, len - 4) + 4;
|
return read(tun_fd, buf + 4, len - 4) + 4;
|
||||||
#else /* !FREEBSD */
|
#else /* !FREEBSD */
|
||||||
|
Loading…
Reference in New Issue
Block a user