mirror of
https://github.com/yarrick/iodine.git
synced 2025-04-11 21:10:56 +00:00
Iodine: IPv6
This commit is contained in:
parent
b4f007a929
commit
5d51b2d00a
1 changed files with 35 additions and 10 deletions
|
@ -187,7 +187,6 @@ send_raw(int fd, char *buf, int buflen, int user, int cmd, struct query *q)
|
||||||
sendto(fd, packet, len, 0, &q->from.v4, q->fromlen);
|
sendto(fd, packet, len, 0, &q->from.v4, q->fromlen);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
start_new_outpacket(int userid, char *data, int datalen)
|
start_new_outpacket(int userid, char *data, int datalen)
|
||||||
/* Copies data to .outpacket and resets all counters.
|
/* Copies data to .outpacket and resets all counters.
|
||||||
|
@ -2231,9 +2230,9 @@ usage() {
|
||||||
extern char *__progname;
|
extern char *__progname;
|
||||||
|
|
||||||
#ifdef LINUX
|
#ifdef LINUX
|
||||||
fprintf(stderr, "Usage: %s [-v] [-h] [-c] [-s] [-f] [-D] [-6] [-u user] "
|
fprintf(stderr, "Usage: %s [-v] [-h] [-c] [-s] [-f] [-D] [-6] [-7] [-u user] "
|
||||||
"[-t chrootdir] [-d device] [-m mtu] [-z context] "
|
"[-t chrootdir] [-d device] [-m mtu] [-z context] "
|
||||||
"[-l ip address to listen on] [-p port] [-n external ip] "
|
"[-l ip address to listen on] [-r ipv6 address to listen on] [-p port] [-n external ip] "
|
||||||
"[-b dnsport] [-P password] [-F pidfile] "
|
"[-b dnsport] [-P password] [-F pidfile] "
|
||||||
"tunnel_ip[/netmask] [tunnel_net6/netmask6] topdomain\n", __progname);
|
"tunnel_ip[/netmask] [tunnel_net6/netmask6] topdomain\n", __progname);
|
||||||
#else
|
#else
|
||||||
|
@ -2252,9 +2251,9 @@ help() {
|
||||||
|
|
||||||
fprintf(stderr, "iodine IP over DNS tunneling server\n");
|
fprintf(stderr, "iodine IP over DNS tunneling server\n");
|
||||||
#ifdef LINUX
|
#ifdef LINUX
|
||||||
fprintf(stderr, "Usage: %s [-v] [-h] [-c] [-s] [-f] [-D] [-6] [-u user] "
|
fprintf(stderr, "Usage: %s [-v] [-h] [-c] [-s] [-f] [-D] [-6] [-7] [-u user] "
|
||||||
"[-t chrootdir] [-d device] [-m mtu] [-z context] "
|
"[-t chrootdir] [-d device] [-m mtu] [-z context] "
|
||||||
"[-l ip address to listen on] [-p port] [-n external ip] [-b dnsport] [-P password] "
|
"[-l ip address to listen on] [-r ipv6 address to listen on] [-p port] [-n external ip] [-b dnsport] [-P password] "
|
||||||
"[-F pidfile] tunnel_ip[/netmask] [tunnel_net6/netmask6] topdomain\n", __progname);
|
"[-F pidfile] tunnel_ip[/netmask] [tunnel_net6/netmask6] topdomain\n", __progname);
|
||||||
#else
|
#else
|
||||||
fprintf(stderr, "Usage: %s [-v] [-h] [-c] [-s] [-f] [-D] [-u user] "
|
fprintf(stderr, "Usage: %s [-v] [-h] [-c] [-s] [-f] [-D] [-u user] "
|
||||||
|
@ -2271,7 +2270,8 @@ help() {
|
||||||
fprintf(stderr, " -D to increase debug level\n");
|
fprintf(stderr, " -D to increase debug level\n");
|
||||||
fprintf(stderr, " (using -DD in UTF-8 terminal: \"LC_ALL=C luit iodined -DD ...\")\n");
|
fprintf(stderr, " (using -DD in UTF-8 terminal: \"LC_ALL=C luit iodined -DD ...\")\n");
|
||||||
#ifdef LINUX
|
#ifdef LINUX
|
||||||
fprintf(stderr, " -6 use IPv6 (make sure to use this option consistently on client and server)\n");
|
fprintf(stderr, " -6 use IPv6 inside the tunnel (make sure to use this option consistently on client and server)\n");
|
||||||
|
fprintf(stderr, " -7 enable IPv6 outside the tunnel\n");
|
||||||
#endif
|
#endif
|
||||||
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");
|
||||||
|
@ -2280,6 +2280,10 @@ help() {
|
||||||
fprintf(stderr, " -z context to apply SELinux context after initialization\n");
|
fprintf(stderr, " -z context to apply SELinux context after initialization\n");
|
||||||
fprintf(stderr, " -l ip address to listen on for incoming dns traffic "
|
fprintf(stderr, " -l ip address to listen on for incoming dns traffic "
|
||||||
"(default 0.0.0.0)\n");
|
"(default 0.0.0.0)\n");
|
||||||
|
#ifdef LINUX
|
||||||
|
fprintf(stderr, " -r ipv6 address to listen on for incoming dns traffic "
|
||||||
|
"(default in6addr_any)\n");
|
||||||
|
#endif
|
||||||
fprintf(stderr, " -p port to listen on for incoming dns traffic (default 53)\n");
|
fprintf(stderr, " -p port to listen on for incoming dns traffic (default 53)\n");
|
||||||
fprintf(stderr, " -n ip to respond with to NS queries\n");
|
fprintf(stderr, " -n ip to respond with to NS queries\n");
|
||||||
fprintf(stderr, " -b port to forward normal DNS queries to (on localhost)\n");
|
fprintf(stderr, " -b port to forward normal DNS queries to (on localhost)\n");
|
||||||
|
@ -2307,6 +2311,9 @@ main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
extern char *__progname;
|
extern char *__progname;
|
||||||
in_addr_t listen_ip;
|
in_addr_t listen_ip;
|
||||||
|
#ifdef LINUX
|
||||||
|
struct in6_addr listen_ip6;
|
||||||
|
#endif
|
||||||
#ifndef WINDOWS32
|
#ifndef WINDOWS32
|
||||||
struct passwd *pw;
|
struct passwd *pw;
|
||||||
#endif
|
#endif
|
||||||
|
@ -2319,7 +2326,6 @@ main(int argc, char **argv)
|
||||||
int dnsd_fd;
|
int dnsd_fd;
|
||||||
int tun_fd;
|
int tun_fd;
|
||||||
|
|
||||||
|
|
||||||
/* settings for forwarding normal DNS to
|
/* settings for forwarding normal DNS to
|
||||||
* local real DNS server */
|
* local real DNS server */
|
||||||
int bind_fd;
|
int bind_fd;
|
||||||
|
@ -2346,6 +2352,7 @@ main(int argc, char **argv)
|
||||||
mtu = 1130; /* Very many relays give fragsize 1150 or slightly
|
mtu = 1130; /* Very many relays give fragsize 1150 or slightly
|
||||||
higher for NULL; tun/zlib adds ~17 bytes. */
|
higher for NULL; tun/zlib adds ~17 bytes. */
|
||||||
listen_ip = INADDR_ANY;
|
listen_ip = INADDR_ANY;
|
||||||
|
listen_ip6 = in6addr_any;
|
||||||
port = 53;
|
port = 53;
|
||||||
ns_ip = INADDR_ANY;
|
ns_ip = INADDR_ANY;
|
||||||
check_ip = 1;
|
check_ip = 1;
|
||||||
|
@ -2355,7 +2362,7 @@ main(int argc, char **argv)
|
||||||
pidfile = NULL;
|
pidfile = NULL;
|
||||||
#ifdef LINUX
|
#ifdef LINUX
|
||||||
v6 = 0;
|
v6 = 0;
|
||||||
v6_listen = 1;
|
v6_listen = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
b32 = get_base32_encoder();
|
b32 = get_base32_encoder();
|
||||||
|
@ -2382,7 +2389,7 @@ main(int argc, char **argv)
|
||||||
fw_query_init();
|
fw_query_init();
|
||||||
|
|
||||||
#ifdef LINUX
|
#ifdef LINUX
|
||||||
while ((choice = getopt(argc, argv, "6vcsfhDu:t:d:m:l:p:n:b:P:z:F:")) != -1) {
|
while ((choice = getopt(argc, argv, "67vcsfhDu:t:d:m:l:r:p:n:b:P:z:F:")) != -1) {
|
||||||
#else
|
#else
|
||||||
while ((choice = getopt(argc, argv, "vcsfhDu:t:d:m:l:p:n:b:P:z:F:")) != -1) {
|
while ((choice = getopt(argc, argv, "vcsfhDu:t:d:m:l:p:n:b:P:z:F:")) != -1) {
|
||||||
#endif
|
#endif
|
||||||
|
@ -2420,6 +2427,14 @@ main(int argc, char **argv)
|
||||||
case 'l':
|
case 'l':
|
||||||
listen_ip = inet_addr(optarg);
|
listen_ip = inet_addr(optarg);
|
||||||
break;
|
break;
|
||||||
|
#ifdef LINUX
|
||||||
|
case 'r':
|
||||||
|
if (inet_pton(AF_INET6, optarg, &listen_ip6) != 1) {
|
||||||
|
warnx("Bad IP address to listen on.");
|
||||||
|
usage();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
case 'p':
|
case 'p':
|
||||||
port = atoi(optarg);
|
port = atoi(optarg);
|
||||||
break;
|
break;
|
||||||
|
@ -2447,6 +2462,9 @@ main(int argc, char **argv)
|
||||||
case '6':
|
case '6':
|
||||||
v6 = 1;
|
v6 = 1;
|
||||||
break;
|
break;
|
||||||
|
case '7':
|
||||||
|
v6_listen = 1;
|
||||||
|
break;
|
||||||
#endif
|
#endif
|
||||||
default:
|
default:
|
||||||
usage();
|
usage();
|
||||||
|
@ -2557,6 +2575,9 @@ main(int argc, char **argv)
|
||||||
usage();
|
usage();
|
||||||
/* NOTREACHED */
|
/* NOTREACHED */
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Todo: IPv6
|
||||||
|
*/
|
||||||
fprintf(stderr, "Requests for domains outside of %s will be forwarded to port %d\n",
|
fprintf(stderr, "Requests for domains outside of %s will be forwarded to port %d\n",
|
||||||
topdomain, bind_port);
|
topdomain, bind_port);
|
||||||
}
|
}
|
||||||
|
@ -2624,7 +2645,11 @@ main(int argc, char **argv)
|
||||||
#endif
|
#endif
|
||||||
free((void*) other_ip);
|
free((void*) other_ip);
|
||||||
}
|
}
|
||||||
if ((dnsd_fd = v6_listen ? open_dns_ipv6(port, in6addr_any) : open_dns(port, listen_ip)) == -1) {
|
#ifdef LINUX
|
||||||
|
if ((dnsd_fd = v6_listen ? open_dns_ipv6(port, listen_ip6) : open_dns(port, listen_ip)) == -1) {
|
||||||
|
#else
|
||||||
|
if ((dnsd_fd = open_dns(port, listen_ip)) == -1) {
|
||||||
|
#endif
|
||||||
retval = 1;
|
retval = 1;
|
||||||
goto cleanup2;
|
goto cleanup2;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue