Compare commits

..

33 Commits

Author SHA1 Message Date
angt
babe14d544 Quit on tun error 2016-04-25 10:24:42 +00:00
angt
278fc69789 Update mud 2016-04-21 15:35:35 +00:00
angt
99262777fc Update mud 2016-04-17 10:16:13 +00:00
angt
b0f60caab2 Update mud 2016-04-14 20:12:45 +00:00
angt
efd5e0bb36 Remove down-timeout and use timeout for send-timeout 2016-04-08 14:38:07 +00:00
angt
ade4617d53 Update mud 2016-04-08 13:00:52 +00:00
angt
64a5fd8227 Update mud 2016-04-05 14:23:45 +00:00
angt
eba968797c Add {down,send,pong}-timeout and time-tolerance option 2016-04-05 14:17:07 +00:00
angt
d60f28a7fe Update mud 2016-04-05 06:42:03 +00:00
angt
32069eb104 Print tun device on STARTED and STOPPED too 2016-04-04 20:05:33 +00:00
angt
a6adcefc25 Update mud 2016-04-04 16:48:11 +00:00
angt
743b0ee0da Don't check AES-NI 2016-04-01 16:50:04 +00:00
angt
ba06a6fc10 Update mud 2016-04-01 16:37:02 +00:00
Adrien Gallouët
80d4c2814f Update README.md 2016-03-24 18:52:18 +01:00
angt
b0d5007bfb Restore STARTED and STOPPED states 2016-03-24 14:45:15 +00:00
angt
d2046eb00b Revert "Add branch name in version"
This reverts commit 03cd87df1c.
2016-03-09 11:42:51 +00:00
angt
d04acc9c0f Update mud 2016-03-09 10:59:52 +00:00
angt
03cd87df1c Add branch name in version 2016-03-09 10:20:01 +00:00
angt
8e8ad7178d Update mud 2016-03-04 11:32:42 +00:00
angt
0e26b4def7 Update mud 2016-03-04 11:20:15 +00:00
angt
f800985766 Update mud 2016-03-04 11:01:43 +00:00
angt
7b88c28a45 Update mud 2016-03-03 10:49:28 +00:00
angt
194dfe17d3 Update mud 2016-03-02 12:59:33 +00:00
angt
664160e0cc Add bind-port option 2016-03-01 15:11:16 +00:00
angt
1dd760e382 Code cleanup 2016-03-01 08:13:05 +00:00
angt
05219b81f7 Update README.md 2016-02-29 16:14:08 +00:00
angt
0bb7e4f1d0 Update mud 2016-02-29 15:35:57 +00:00
angt
a7fbf806fb Use a list to setup mud_bind() 2016-02-29 15:28:37 +00:00
angt
e750c46665 Update mud 2016-02-25 15:22:47 +00:00
angt
935111cfea Fix Makefile.am 2016-02-04 11:31:02 +01:00
angt
c4b2512df4 Add .gitmodules 2016-02-04 10:44:53 +01:00
angt
27970e24fb Import and use mud 2016-02-04 10:39:36 +01:00
angt
acc3ee3461 Encrypt only one packet at a time 2016-01-26 12:18:00 +01:00
7 changed files with 156 additions and 1269 deletions

3
.gitmodules vendored Normal file
View File

@@ -0,0 +1,3 @@
[submodule "mud"]
path = mud
url = https://github.com/angt/mud.git

View File

@@ -20,6 +20,11 @@ glorytun_SOURCES = \
src/state.c \
src/state.h
glorytun_CFLAGS += -I$(srcdir)/mud
glorytun_SOURCES += \
mud/mud.h \
mud/mud.c
EXTRA_DIST = \
LICENSE \
README.md \

View File

@@ -1,6 +1,6 @@
# π₁(Glorytun)=ℤ²
Small, Simple and Stupid TCP VPN.
Small, Simple and Stupid VPN over [mud](https://github.com/angt/mud).
#### Work In Progress
@@ -8,11 +8,12 @@ This code will probably format your harddisk!
#### Build and Install
Glorytun depends on [libsodium](https://github.com/jedisct1/libsodium) version >= 1.0.4.
Glorytun depends on [libsodium](https://github.com/jedisct1/libsodium) version >= 1.0.4
and needs an AES-NI capable CPU.
To build and install the latest version:
$ git clone https://github.com/angt/glorytun
$ git clone https://github.com/angt/glorytun --recursive --branch mud
$ cd glorytun
$ ./autogen.sh
$ ./configure

1
mud Submodule

Submodule mud added at 04c8495fe6

1286
src/main.c

File diff suppressed because it is too large Load Diff

View File

@@ -7,14 +7,16 @@
#include <fcntl.h>
#include <sys/stat.h>
int state_create (const char *filename)
static int state_fd = -1;
int state_init (const char *filename)
{
if (str_empty(filename))
return -1;
return 0;
int fd = open(filename, O_WRONLY);
state_fd = open(filename, O_WRONLY);
if (fd==-1) {
if (state_fd==-1) {
if (errno!=EINTR)
perror("open");
return -1;
@@ -22,41 +24,38 @@ int state_create (const char *filename)
struct stat st = {0};
if (fstat(fd, &st)==-1) {
if (fstat(state_fd, &st)==-1) {
perror("fstat");
close(fd);
close(state_fd);
state_fd = -1;
return -1;
}
if (!S_ISFIFO(st.st_mode)) {
gt_log("`%s' is not a fifo\n", filename);
close(fd);
close(state_fd);
state_fd = -1;
return -1;
}
return fd;
return 0;
}
void state_send (int fd, const char *state, const char *info)
void state (const char *state, const char *info)
{
if (str_empty(state))
return;
if (fd==-1) {
gt_print("%s %s\n", state, info);
return;
}
const char *strs[] = { state, " ", info, "\n" };
char *str = str_cat(strs, COUNT(strs));
if (!str) {
perror("str_cat");
if (!str)
return;
}
if (write(fd, str, str_len(str))==-1 && errno!=EINTR)
if (state_fd==-1) {
gt_print("%s", str);
} else {
if (write(state_fd, str, str_len(str))==-1 && errno!=EINTR)
perror("write");
free(str);
}
}

View File

@@ -1,4 +1,4 @@
#pragma once
int state_create (const char *);
void state_send (int, const char *, const char *);
int state_init (const char *);
void state (const char *, const char *);