mirror of
https://github.com/yarrick/iodine.git
synced 2024-11-27 12:05:15 +00: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:
|
||||
|
||||
iodine has been tested on Linux (x86 and SPARC64), FreeBSD (x86) and
|
||||
OpenBSD (x86). 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.
|
||||
iodine has been tested on Linux (x86 and SPARC64), FreeBSD (x86), OpenBSD (x86)
|
||||
and MacOS X (10.3, ppc, with http://www-user.rhrk.uni-kl.de/~nissler/tuntap/).
|
||||
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:
|
||||
|
25
dns.c
25
dns.c
@ -19,11 +19,15 @@
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <arpa/nameser.h>
|
||||
#ifdef DARWIN
|
||||
#include <arpa/nameser8_compat.h>
|
||||
#endif
|
||||
#include <netdb.h>
|
||||
#include <time.h>
|
||||
#include <err.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
@ -352,7 +356,6 @@ dns_read(int fd, char *buf, int buflen)
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
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;
|
||||
char *p;
|
||||
char buf[64*1024];
|
||||
short name;
|
||||
HEADER *header;
|
||||
|
||||
memset(buf, 0, sizeof(buf));
|
||||
@ -406,24 +410,21 @@ dnsd_send(int fd, struct query *q, char *data, int datalen)
|
||||
|
||||
p = buf + sizeof(HEADER);
|
||||
|
||||
name = 0xc000 | ((p - buf) & 0x3fff);
|
||||
p += host2dns(q->name, p, strlen(q->name));
|
||||
PUTSHORT(q->type, p);
|
||||
PUTSHORT(C_IN, p);
|
||||
|
||||
p += host2dns(q->name, p, strlen(q->name));
|
||||
PUTSHORT(name, p);
|
||||
PUTSHORT(q->type, p);
|
||||
PUTSHORT(C_IN, p);
|
||||
PUTLONG(0, p);
|
||||
|
||||
q->id = 0;
|
||||
|
||||
if(datalen > 0) {
|
||||
PUTSHORT(datalen, p);
|
||||
memcpy(p, data, datalen);
|
||||
p += datalen;
|
||||
} else {
|
||||
PUTSHORT(0, p);
|
||||
}
|
||||
PUTSHORT(datalen, p);
|
||||
memcpy(p, data, datalen);
|
||||
p += datalen;
|
||||
|
||||
len = p - buf;
|
||||
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);
|
||||
r = recvfrom(fd, packet, sizeof(packet), 0, (struct sockaddr*)&from, &addrlen);
|
||||
|
||||
if(r == -1) {
|
||||
perror("recvfrom");
|
||||
} else {
|
||||
if (r >= sizeof(HEADER)) {
|
||||
header = (HEADER*)packet;
|
||||
|
||||
id = ntohs(header->id);
|
||||
@ -508,6 +507,8 @@ dnsd_read(int fd, struct query *q, char *buf, int buflen)
|
||||
return decodepacket(name, buf, buflen);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
perror("recvfrom");
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
2
iodine.c
2
iodine.c
@ -188,7 +188,7 @@ help() {
|
||||
static void
|
||||
version() {
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -188,7 +188,7 @@ help() {
|
||||
static void
|
||||
version() {
|
||||
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);
|
||||
}
|
||||
|
||||
|
40
tun.c
40
tun.c
@ -57,18 +57,18 @@ open_tun(const char *tun_device)
|
||||
ifreq.ifr_flags = IFF_TUN;
|
||||
|
||||
if (tun_device != NULL) {
|
||||
strncpy(ifreq.ifr_name, tun_device, IFNAMSIZ);
|
||||
strncpy(if_name, tun_device, sizeof(if_name));
|
||||
strncpy(ifreq.ifr_name, tun_device, IFNAMSIZ);
|
||||
strncpy(if_name, tun_device, sizeof(if_name));
|
||||
|
||||
if (ioctl(tun_fd, TUNSETIFF, (void *) &ifreq) != -1) {
|
||||
printf("Opened %s\n", ifreq.ifr_name);
|
||||
return tun_fd;
|
||||
}
|
||||
if (ioctl(tun_fd, TUNSETIFF, (void *) &ifreq) != -1) {
|
||||
printf("Opened %s\n", ifreq.ifr_name);
|
||||
return tun_fd;
|
||||
}
|
||||
|
||||
if (errno != EBUSY) {
|
||||
warn("open_tun: ioctl[TUNSETIFF]: %s", strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
if (errno != EBUSY) {
|
||||
warn("open_tun: ioctl[TUNSETIFF]: %s", strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
} else {
|
||||
for (i = 0; i < TUN_MAX_TRY; i++) {
|
||||
snprintf(ifreq.ifr_name, IFNAMSIZ, "dns%d", i);
|
||||
@ -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;
|
||||
}
|
||||
@ -100,10 +100,16 @@ open_tun(const char *tun_device)
|
||||
char tun_name[50];
|
||||
|
||||
if (tun_device != NULL) {
|
||||
if ((tun_fd = open(tun_device, O_RDWR)) < 0) {
|
||||
warn("open_tun: %s: %s", tun_device, strerror(errno));
|
||||
snprintf(tun_name, sizeof(tun_name), "/dev/%s", tun_device);
|
||||
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;
|
||||
}
|
||||
|
||||
printf("Opened %s\n", tun_name);
|
||||
return tun_fd;
|
||||
} else {
|
||||
for (i = 0; i < TUN_MAX_TRY; i++) {
|
||||
snprintf(tun_name, sizeof(tun_name), "/dev/tun%d", i);
|
||||
@ -118,7 +124,7 @@ open_tun(const char *tun_device)
|
||||
break;
|
||||
}
|
||||
|
||||
warn("open_tun: Failed to open tunneling device.");
|
||||
warn("open_tun: Failed to open tunneling device");
|
||||
}
|
||||
|
||||
return -1;
|
||||
@ -136,10 +142,10 @@ close_tun(int tun_fd)
|
||||
int
|
||||
write_tun(int tun_fd, char *data, int len)
|
||||
{
|
||||
#ifdef FREEBSD
|
||||
#if defined (FREEBSD) || defined (DARWIN)
|
||||
data += 4;
|
||||
len -= 4;
|
||||
#else /* !FREEBSD */
|
||||
#else /* !FREEBSD/DARWIN */
|
||||
#ifdef LINUX
|
||||
data[0] = 0x00;
|
||||
data[1] = 0x00;
|
||||
@ -163,7 +169,7 @@ write_tun(int tun_fd, char *data, int len)
|
||||
int
|
||||
read_tun(int tun_fd, char *buf, int len)
|
||||
{
|
||||
#ifdef FREEBSD
|
||||
#if defined (FREEBSD) || defined (DARWIN)
|
||||
// FreeBSD has no header
|
||||
return read(tun_fd, buf + 4, len - 4) + 4;
|
||||
#else /* !FREEBSD */
|
||||
|
Loading…
Reference in New Issue
Block a user