mirror of
https://github.com/yarrick/iodine.git
synced 2025-04-04 13:53:34 +03:00
Compare commits
25 commits
Author | SHA1 | Date | |
---|---|---|---|
|
2b65972693 | ||
|
ae43de2a8c | ||
|
6299bdbf04 | ||
|
68b0a7b16e | ||
|
55640a0e9a | ||
|
7ec5efeb55 | ||
|
fb7081aba4 | ||
|
2c7940cf77 | ||
|
6be47466f2 | ||
|
ec5c89a368 | ||
|
fc174d5e37 | ||
|
3b1d3a5d4c | ||
|
39c3154a77 | ||
|
8ba813f08e | ||
|
a5d71d0761 | ||
|
b82bc776b3 | ||
|
057be6ce64 | ||
|
3a4a69f50d | ||
|
ba3f0cacb5 | ||
|
d28e8f76ae | ||
|
b20b4f6fae | ||
|
8b78300e99 | ||
|
9262863cae | ||
|
6145eeab73 | ||
|
309a1371e8 |
24 changed files with 146 additions and 46 deletions
28
.github/workflows/freebsd.yml
vendored
Normal file
28
.github/workflows/freebsd.yml
vendored
Normal file
|
@ -0,0 +1,28 @@
|
|||
name: freebsd
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ master ]
|
||||
pull_request:
|
||||
branches: [ master ]
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: make
|
||||
uses: vmactions/freebsd-vm@v1.0.8
|
||||
with:
|
||||
prepare: |
|
||||
pkg install -y \
|
||||
devel/check \
|
||||
devel/git \
|
||||
devel/pkgconf
|
||||
run: |
|
||||
make
|
||||
make test
|
5
.github/workflows/macos.yml
vendored
5
.github/workflows/macos.yml
vendored
|
@ -6,13 +6,16 @@ on:
|
|||
pull_request:
|
||||
branches: [ master ]
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
||||
runs-on: macos-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v4
|
||||
- name: make
|
||||
run: make
|
||||
- name: install check
|
||||
|
|
28
.github/workflows/openbsd.yml
vendored
Normal file
28
.github/workflows/openbsd.yml
vendored
Normal file
|
@ -0,0 +1,28 @@
|
|||
name: openbsd
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ master ]
|
||||
pull_request:
|
||||
branches: [ master ]
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: make
|
||||
uses: vmactions/openbsd-vm@v1.0.8
|
||||
with:
|
||||
prepare: |
|
||||
pkg_add \
|
||||
check \
|
||||
git \
|
||||
pkgconf
|
||||
run: |
|
||||
make
|
||||
make test
|
7
.github/workflows/ubuntu.yml
vendored
7
.github/workflows/ubuntu.yml
vendored
|
@ -6,13 +6,16 @@ on:
|
|||
pull_request:
|
||||
branches: [ master ]
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v4
|
||||
- name: make
|
||||
run: make
|
||||
- name: install check
|
||||
|
@ -25,7 +28,7 @@ jobs:
|
|||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v4
|
||||
- uses: nttld/setup-ndk@v1
|
||||
with:
|
||||
ndk-version: r21e
|
||||
|
|
5
.github/workflows/windows.yml
vendored
5
.github/workflows/windows.yml
vendored
|
@ -6,6 +6,9 @@ on:
|
|||
pull_request:
|
||||
branches: [ master ]
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
||||
|
@ -15,7 +18,7 @@ jobs:
|
|||
shell: msys2 {0}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v4
|
||||
- uses: msys2/setup-msys2@v2
|
||||
with:
|
||||
msystem: MINGW64
|
||||
|
|
|
@ -1,11 +1,16 @@
|
|||
|
||||
iodine - https://code.kryo.se/iodine
|
||||
|
||||
***********************************
|
||||
************************************
|
||||
|
||||
CHANGES:
|
||||
|
||||
master:
|
||||
- Changed deprecated tzsetwall() to tzset() (only used by FreeBSD),
|
||||
patch by Pouria Mousavizadeh Tehrani.
|
||||
- Now builds on macOS even without if_utun.h (pre 10.6).
|
||||
|
||||
2023-04-17: 0.8.0 "Burning Snowman"
|
||||
- Mac OS X: Support native utun VPN devices. Patch by
|
||||
Peter Sagerson, ported from OpenVPN by Catalin Patulea.
|
||||
- Fix compilation failure on kFreeBSD and Hurd, by Gregor Herrmann
|
||||
|
@ -16,7 +21,7 @@ master:
|
|||
- Add support for IPv6 in the server.
|
||||
Raw mode will be with same protocol as used for login.
|
||||
Traffic inside tunnel is still IPv4.
|
||||
- Update android build to support 5.0 (Lollipop) and newer.
|
||||
- Update android build to try to support 5.0 (Lollipop) and newer.
|
||||
- Change external IP lookup to using myip.opendns.com via DNS.
|
||||
- Add option to choose IPv4 listen address from external IP lookup.
|
||||
- Add server support for handling multiple domains via wildcard.
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
.\" groff -man -Tascii iodine.8
|
||||
.TH IODINE 8 "APR 2012" "User Manuals"
|
||||
.TH IODINE 8 "APR 2023" "User Manuals"
|
||||
.SH NAME
|
||||
iodine, iodined \- tunnel IPv4 over DNS
|
||||
.SH SYNOPSIS
|
||||
|
|
10
src/client.c
10
src/client.c
|
@ -103,7 +103,7 @@ static long send_query_recvcnt = 0;
|
|||
static int hostname_maxlen = 0xFF;
|
||||
|
||||
void
|
||||
client_init()
|
||||
client_init(void)
|
||||
{
|
||||
running = 1;
|
||||
rand_seed = ((unsigned int) rand()) & 0xFFFF;
|
||||
|
@ -124,13 +124,13 @@ client_init()
|
|||
}
|
||||
|
||||
void
|
||||
client_stop()
|
||||
client_stop(void)
|
||||
{
|
||||
running = 0;
|
||||
}
|
||||
|
||||
enum connection
|
||||
client_get_conn()
|
||||
client_get_conn(void)
|
||||
{
|
||||
return conn;
|
||||
}
|
||||
|
@ -175,7 +175,7 @@ client_set_qtype(char *qtype)
|
|||
}
|
||||
|
||||
char *
|
||||
client_get_qtype()
|
||||
client_get_qtype(void)
|
||||
{
|
||||
char *c = "UNDEFINED";
|
||||
|
||||
|
@ -225,7 +225,7 @@ client_set_hostname_maxlen(int i)
|
|||
}
|
||||
|
||||
const char *
|
||||
client_get_raw_addr()
|
||||
client_get_raw_addr(void)
|
||||
{
|
||||
return format_addr(&raw_serv, raw_serv_len);
|
||||
}
|
||||
|
|
20
src/common.c
20
src/common.c
|
@ -57,7 +57,7 @@
|
|||
const unsigned char raw_header[RAW_HDR_LEN] = { 0x10, 0xd1, 0x9e, 0x00 };
|
||||
|
||||
/* daemon(3) exists only in 4.4BSD or later, and in GNU libc */
|
||||
#if !defined(ANDROID) && !defined(WINDOWS32) && !(defined(BSD) && (BSD >= 199306)) && !defined(__GLIBC__)
|
||||
#if !defined(ANDROID) && !defined(WINDOWS32) && !(defined(BSD) && (BSD >= 199306)) && !defined(__GLIBC__) && !defined(__HAIKU__)
|
||||
static int daemon(int nochdir, int noclose)
|
||||
{
|
||||
int fd, i;
|
||||
|
@ -142,6 +142,7 @@ get_addr(char *host, int port, int addr_family, int flags, struct sockaddr_stora
|
|||
struct addrinfo hints, *addr;
|
||||
int res;
|
||||
char portnum[8];
|
||||
int addrlen;
|
||||
|
||||
memset(portnum, 0, sizeof(portnum));
|
||||
snprintf(portnum, sizeof(portnum) - 1, "%d", port);
|
||||
|
@ -158,14 +159,15 @@ get_addr(char *host, int port, int addr_family, int flags, struct sockaddr_stora
|
|||
hints.ai_protocol = IPPROTO_UDP;
|
||||
|
||||
res = getaddrinfo(host, portnum, &hints, &addr);
|
||||
if (res == 0) {
|
||||
int addrlen = addr->ai_addrlen;
|
||||
/* Grab first result */
|
||||
memcpy(out, addr->ai_addr, addr->ai_addrlen);
|
||||
freeaddrinfo(addr);
|
||||
return addrlen;
|
||||
if (res != 0) {
|
||||
return -1;
|
||||
}
|
||||
return res;
|
||||
|
||||
addrlen = addr->ai_addrlen;
|
||||
/* Grab first result */
|
||||
memcpy(out, addr->ai_addr, addr->ai_addrlen);
|
||||
freeaddrinfo(addr);
|
||||
return addrlen;
|
||||
}
|
||||
|
||||
int
|
||||
|
@ -276,7 +278,7 @@ do_pidfile(char *pidfile)
|
|||
}
|
||||
|
||||
void
|
||||
do_detach()
|
||||
do_detach(void)
|
||||
{
|
||||
#ifndef WINDOWS32
|
||||
fprintf(stderr, "Detaching from terminal...\n");
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
static struct fw_query fwq[FW_QUERY_CACHE_SIZE];
|
||||
static int fwq_ix;
|
||||
|
||||
void fw_query_init()
|
||||
void fw_query_init(void)
|
||||
{
|
||||
memset(fwq, 0, sizeof(struct fw_query) * FW_QUERY_CACHE_SIZE);
|
||||
fwq_ix = 0;
|
||||
|
|
|
@ -2754,7 +2754,7 @@ main(int argc, char **argv)
|
|||
do_pidfile(pidfile);
|
||||
|
||||
#ifdef FREEBSD
|
||||
tzsetwall();
|
||||
tzset();
|
||||
#endif
|
||||
#ifndef WINDOWS32
|
||||
openlog(__progname, LOG_NDELAY, LOG_DAEMON);
|
||||
|
|
|
@ -13,14 +13,14 @@ link)
|
|||
echo '-lsocket -lbind -lbsd';
|
||||
;;
|
||||
Haiku)
|
||||
echo '-lnetwork';
|
||||
echo '-lnetwork -lbsd';
|
||||
;;
|
||||
windows32)
|
||||
echo '-lws2_32 -liphlpapi';
|
||||
;;
|
||||
Linux)
|
||||
FLAGS="";
|
||||
[ -e /usr/include/selinux/selinux.h ] && FLAGS="$FLAGS -lselinux";
|
||||
"$PKG_CONFIG" --exists libselinux && FLAGS="$FLAGS $($PKG_CONFIG --libs libselinux)";
|
||||
"$PKG_CONFIG" --exists libsystemd-daemon && FLAGS="$FLAGS $($PKG_CONFIG --libs libsystemd-daemon)";
|
||||
"$PKG_CONFIG" --exists libsystemd && FLAGS="$FLAGS $($PKG_CONFIG --libs libsystemd)";
|
||||
echo $FLAGS;
|
||||
|
@ -35,12 +35,15 @@ cflags)
|
|||
BeOS)
|
||||
echo '-Dsocklen_t=int';
|
||||
;;
|
||||
Haiku)
|
||||
echo '-D_DEFAULT_SOURCE';
|
||||
;;
|
||||
Darwin)
|
||||
echo '-D__APPLE_USE_RFC_3542';
|
||||
;;
|
||||
Linux)
|
||||
FLAGS="-D_GNU_SOURCE"
|
||||
[ -e /usr/include/selinux/selinux.h ] && FLAGS="$FLAGS -DHAVE_SETCON";
|
||||
"$PKG_CONFIG" --exists libselinux && FLAGS="$FLAGS -DHAVE_SETCON";
|
||||
"$PKG_CONFIG" --exists libsystemd-daemon && FLAGS="$FLAGS -DHAVE_SYSTEMD";
|
||||
"$PKG_CONFIG" --exists libsystemd && FLAGS="$FLAGS -DHAVE_SYSTEMD";
|
||||
echo $FLAGS;
|
||||
|
|
|
@ -31,7 +31,9 @@
|
|||
#include <sys/kern_control.h>
|
||||
#include <sys/sys_domain.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <net/if_utun.h>
|
||||
/* Inline used parts of if_utun.h to compile without it. */
|
||||
#define UTUN_CONTROL_NAME "com.apple.net.utun_control"
|
||||
#define UTUN_OPT_IFNAME 2
|
||||
#include <netinet/ip.h>
|
||||
#endif
|
||||
|
||||
|
|
|
@ -119,7 +119,7 @@ START_TEST(test_base32_blksize)
|
|||
END_TEST
|
||||
|
||||
TCase *
|
||||
test_base32_create_tests()
|
||||
test_base32_create_tests(void)
|
||||
{
|
||||
TCase *tc;
|
||||
|
||||
|
|
|
@ -132,7 +132,7 @@ START_TEST(test_base64_blksize)
|
|||
END_TEST
|
||||
|
||||
TCase *
|
||||
test_base64_create_tests()
|
||||
test_base64_create_tests(void)
|
||||
{
|
||||
TCase *tc;
|
||||
|
||||
|
|
|
@ -280,8 +280,30 @@ START_TEST(test_parse_format_ipv4_mapped_ipv6)
|
|||
}
|
||||
END_TEST
|
||||
|
||||
START_TEST(test_get_addr_err)
|
||||
{
|
||||
char *host = "192.168.2.10";
|
||||
struct sockaddr_storage addr;
|
||||
int addr_len;
|
||||
int flags = AI_PASSIVE;
|
||||
|
||||
/* Invalid host */
|
||||
addr_len = get_addr(NULL, -1, flags, 0, &addr);
|
||||
ck_assert(addr_len == -1);
|
||||
/* Invalid port */
|
||||
addr_len = get_addr(host, -1, flags, 0, &addr);
|
||||
ck_assert(addr_len == -1);
|
||||
/* Invalid flag */
|
||||
addr_len = get_addr(host, 53, flags | 0xFFF, 0, &addr);
|
||||
ck_assert(addr_len == -1);
|
||||
/* Invalid addr */
|
||||
addr_len = get_addr(host, 53, flags, 0, (struct sockaddr_storage *)NULL);
|
||||
ck_assert(addr_len == -1);
|
||||
}
|
||||
END_TEST
|
||||
|
||||
TCase *
|
||||
test_common_create_tests()
|
||||
test_common_create_tests(void)
|
||||
{
|
||||
TCase *tc;
|
||||
int sock;
|
||||
|
@ -295,6 +317,7 @@ test_common_create_tests()
|
|||
tcase_add_test(tc, test_query_datalen_wild);
|
||||
tcase_add_test(tc, test_parse_format_ipv4);
|
||||
tcase_add_test(tc, test_parse_format_ipv4_listen_all);
|
||||
tcase_add_test(tc, test_get_addr_err);
|
||||
|
||||
/* Tests require IPv6 support */
|
||||
sock = socket(AF_INET6, SOCK_DGRAM, IPPROTO_UDP);
|
||||
|
|
|
@ -250,7 +250,7 @@ dump_packet(char *buf, size_t len)
|
|||
}
|
||||
|
||||
TCase *
|
||||
test_dns_create_tests()
|
||||
test_dns_create_tests(void)
|
||||
{
|
||||
TCase *tc;
|
||||
|
||||
|
|
|
@ -93,7 +93,7 @@ START_TEST(test_build_hostname)
|
|||
END_TEST
|
||||
|
||||
TCase *
|
||||
test_encoding_create_tests()
|
||||
test_encoding_create_tests(void)
|
||||
{
|
||||
TCase *tc;
|
||||
|
||||
|
|
|
@ -76,7 +76,7 @@ START_TEST(test_fw_query_edge)
|
|||
END_TEST
|
||||
|
||||
TCase *
|
||||
test_fw_query_create_tests()
|
||||
test_fw_query_create_tests(void)
|
||||
{
|
||||
TCase *tc;
|
||||
|
||||
|
|
|
@ -59,7 +59,7 @@ START_TEST(test_login_hash_short)
|
|||
END_TEST
|
||||
|
||||
TCase *
|
||||
test_login_create_tests()
|
||||
test_login_create_tests(void)
|
||||
{
|
||||
TCase *tc;
|
||||
|
||||
|
|
|
@ -270,7 +270,7 @@ END_TEST
|
|||
|
||||
|
||||
TCase *
|
||||
test_read_create_tests()
|
||||
test_read_create_tests(void)
|
||||
{
|
||||
TCase *tc;
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
#include "test.h"
|
||||
|
||||
int
|
||||
main()
|
||||
main(void)
|
||||
{
|
||||
SRunner *runner;
|
||||
Suite *iodine;
|
||||
|
|
18
tests/test.h
18
tests/test.h
|
@ -18,15 +18,15 @@
|
|||
#ifndef __TEST_H__
|
||||
#define __TEST_H__
|
||||
|
||||
TCase *test_base32_create_tests();
|
||||
TCase *test_base64_create_tests();
|
||||
TCase *test_common_create_tests();
|
||||
TCase *test_dns_create_tests();
|
||||
TCase *test_encoding_create_tests();
|
||||
TCase *test_read_create_tests();
|
||||
TCase *test_login_create_tests();
|
||||
TCase *test_user_create_tests();
|
||||
TCase *test_fw_query_create_tests();
|
||||
TCase *test_base32_create_tests(void);
|
||||
TCase *test_base64_create_tests(void);
|
||||
TCase *test_common_create_tests(void);
|
||||
TCase *test_dns_create_tests(void);
|
||||
TCase *test_encoding_create_tests(void);
|
||||
TCase *test_read_create_tests(void);
|
||||
TCase *test_login_create_tests(void);
|
||||
TCase *test_user_create_tests(void);
|
||||
TCase *test_fw_query_create_tests(void);
|
||||
|
||||
char *va_str(const char *, ...);
|
||||
|
||||
|
|
|
@ -170,7 +170,7 @@ START_TEST(test_find_available_user_small_net)
|
|||
END_TEST
|
||||
|
||||
TCase *
|
||||
test_user_create_tests()
|
||||
test_user_create_tests(void)
|
||||
{
|
||||
TCase *tc;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue