Compare commits

..

25 Commits

Author SHA1 Message Date
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 131 additions and 1262 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.c \
src/state.h src/state.h
glorytun_CFLAGS += -I$(srcdir)/mud
glorytun_SOURCES += \
mud/mud.h \
mud/mud.c
EXTRA_DIST = \ EXTRA_DIST = \
LICENSE \ LICENSE \
README.md \ README.md \

View File

@@ -1,6 +1,6 @@
# π₁(Glorytun)=ℤ² # π₁(Glorytun)=ℤ²
Small, Simple and Stupid TCP VPN. Small, Simple and Stupid VPN over [mud](https://github.com/angt/mud).
#### Work In Progress #### Work In Progress
@@ -8,11 +8,12 @@ This code will probably format your harddisk!
#### Build and Install #### 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: 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 $ cd glorytun
$ ./autogen.sh $ ./autogen.sh
$ ./configure $ ./configure

1
mud Submodule

Submodule mud added at 104bc68266

1306
src/main.c

File diff suppressed because it is too large Load Diff

View File

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

View File

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