Compare commits

..

8 Commits

Author SHA1 Message Date
angt
6f36424d12 Code cleanup 2016-04-26 06:18:12 +00:00
angt
fa9301da16 Show tun_name in all states and fix state_send() 2016-04-26 06:13:14 +00:00
angt
c154a00358 Use a bigger timeout when buffers are empty 2016-04-12 14:11:16 +00:00
Adrien Gallouët
4246b510d2 Never trust frank :) 2016-03-30 15:41:53 +02:00
Adrien Gallouët
c71db48ae1 Add a nice geek logo for glorytun 2016-03-23 17:44:40 +01:00
Adrien Gallouët
e3cce8aeb9 AES-NI is no longer mandatory 2016-03-18 21:19:24 +01:00
angt
ad0d205ff3 Add option chacha20
Chacha20 will be automatically used if aesni is not available.
2016-03-18 14:43:30 +00:00
angt
030087cb27 Add mptcp option 2016-02-25 14:38:51 +00:00
7 changed files with 1262 additions and 123 deletions

3
.gitmodules vendored
View File

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

View File

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

1
mud

Submodule mud deleted from 11903da862

1280
src/main.c

File diff suppressed because it is too large Load Diff

View File

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

View File

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