Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c113724eb0 | ||
|
|
b184ddedaa | ||
|
|
28a978f276 | ||
|
|
e0546ec46a | ||
|
|
50f002b7f8 |
22
Makefile
22
Makefile
@@ -2,31 +2,31 @@ NAME := glorytun
|
||||
VERSION := $(shell ./version.sh)
|
||||
DIST := $(NAME)-$(VERSION)
|
||||
|
||||
CFLAGS ?= -std=c11 -O2 -Wall -fstack-protector-strong
|
||||
FLAGS := $(CFLAGS) $(LDFLAGS) $(CPPFLAGS)
|
||||
|
||||
CC ?= cc
|
||||
prefix ?= /usr
|
||||
Q := @
|
||||
|
||||
CFLAGS := -std=c11 -O2 -Wall -fstack-protector-strong
|
||||
ifneq ($(X),)
|
||||
H = $(X)-
|
||||
FLAGS += -static
|
||||
endif
|
||||
|
||||
FLAGS := $(CFLAGS) $(LDFLAGS) $(CPPFLAGS)
|
||||
FLAGS += -DPACKAGE_NAME=\"$(NAME)\" -DPACKAGE_VERSION=\"$(VERSION)\"
|
||||
|
||||
FLAGS += -I.static/$(CROSS)/libsodium-stable/src/libsodium/include
|
||||
FLAGS += -L.static/$(CROSS)/libsodium-stable/src/libsodium/.libs
|
||||
FLAGS += -I.static/$(X)/libsodium-stable/src/libsodium/include
|
||||
FLAGS += -L.static/$(X)/libsodium-stable/src/libsodium/.libs
|
||||
|
||||
SRC := argz/argz.c mud/mud.c mud/aegis256/aegis256.c $(wildcard src/*.c)
|
||||
HDR := argz/argz.h mud/mud.h mud/aegis256/aegis256.h $(wildcard src/*.h)
|
||||
|
||||
ifneq ($(CROSS),)
|
||||
X = $(CROSS)-
|
||||
endif
|
||||
|
||||
$(NAME): $(SRC) $(HDR)
|
||||
$(Q)$(X)$(CC) $(FLAGS) -o $(NAME) $(SRC) -lsodium
|
||||
$(Q)$(H)$(CC) $(FLAGS) -o $(NAME) $(SRC) -lsodium
|
||||
|
||||
$(NAME)-strip: $(NAME)
|
||||
$(Q)cp $< $@
|
||||
$(Q)$(X)strip -x $@
|
||||
$(Q)$(H)strip -x $@
|
||||
|
||||
.PHONY: install
|
||||
install: $(NAME)-strip
|
||||
|
||||
2
mud
2
mud
Submodule mud updated: bda2c6eaa7...c426cef08b
@@ -12,6 +12,8 @@
|
||||
#include <errno.h>
|
||||
|
||||
#include <arpa/inet.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
|
||||
#ifndef PACKAGE_NAME
|
||||
#define PACKAGE_NAME "glorytun"
|
||||
|
||||
10
src/tun.c
10
src/tun.c
@@ -131,13 +131,21 @@ tun_create_by_name(char *name, size_t len, const char *dev_name)
|
||||
static int
|
||||
tun_create_by_name(char *name, size_t len, const char *dev_name)
|
||||
{
|
||||
int ret = snprintf(name, len, "/dev/%s", dev_name);
|
||||
int ret = snprintf(name, len, "%s", dev_name);
|
||||
|
||||
if (ret <= 0 || (size_t)ret >= len) {
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
char tmp[64];
|
||||
ret = snprintf(tmp, sizeof(tmp), "/dev/%s", dev_name);
|
||||
|
||||
if (ret <= 0 || (size_t)ret >= sizeof(tmp)) {
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
return open(tmp, O_RDWR);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user