diff options
-rw-r--r-- | .gitignore | 8 | ||||
-rw-r--r-- | ChangeLog | 1 | ||||
-rw-r--r-- | README | 6 | ||||
-rw-r--r-- | doc/uanytun.8 | 4 | ||||
-rw-r--r-- | src/bsd/tun.c | 8 | ||||
-rwxr-xr-x | src/configure | 13 | ||||
-rw-r--r-- | src/options.c | 6 | ||||
-rw-r--r-- | src/sig_handler.c | 8 | ||||
-rw-r--r-- | src/uanytun.c | 14 | ||||
-rw-r--r-- | src/udp.c | 4 |
10 files changed, 51 insertions, 21 deletions
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..5efe091 --- /dev/null +++ b/.gitignore @@ -0,0 +1,8 @@ +doc/uanytun.8.xml +src/*.o +src/*.d +src/*.d.* +src/tun.c +src/include.mk +src/version.h +src/uanytun @@ -1,6 +1,7 @@ 201?.??.?? -- Version 0.?.? * added RAIL mode +* moved to GIT 2014.06.21 -- Version 0.3.5 @@ -59,10 +59,10 @@ if you want to rebuild the manpage: Installation ============ -Getting the source via subversion: ----------------------------------- +Getting the source via GIT: +--------------------------- -svn co http://svn.anytun.org/uanytun/trunk uanytun +git clone https://git.spreadspace.org/anytun/uanytun.git cd uanytun Building from source diff --git a/doc/uanytun.8 b/doc/uanytun.8 index 615be1e..7881569 100644 --- a/doc/uanytun.8 +++ b/doc/uanytun.8 @@ -2,12 +2,12 @@ .\" Title: uanytun .\" Author: [see the "AUTHORS" section] .\" Generator: DocBook XSL Stylesheets v1.78.1 <http://docbook.sf.net/> -.\" Date: 02/24/2014 +.\" Date: 06/08/2014 .\" Manual: \ \& .\" Source: \ \& .\" Language: English .\" -.TH "UANYTUN" "8" "02/24/2014" "\ \&" "\ \&" +.TH "UANYTUN" "8" "06/08/2014" "\ \&" "\ \&" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/src/bsd/tun.c b/src/bsd/tun.c index a469c58..ceb54a1 100644 --- a/src/bsd/tun.c +++ b/src/bsd/tun.c @@ -46,14 +46,15 @@ * files in the program, then also delete it here. */ +#define _GNU_SOURCE +#include <stdio.h> + #include "datatypes.h" #include "tun.h" #include "tun_helper.h" -#include "log.h" - #include <fcntl.h> #include <unistd.h> #include <errno.h> @@ -69,6 +70,9 @@ #include <netinet/ip.h> #define DEVICE_FILE_MAX 255 +#include "log.h" +#include "sysexec.h" + int tun_init(tun_device_t* dev, const char* dev_name, const char* dev_type, const char* ifcfg_addr, u_int16_t ifcfg_prefix) { if(!dev) diff --git a/src/configure b/src/configure index 16d5cc7..3b7b1b4 100755 --- a/src/configure +++ b/src/configure @@ -239,7 +239,7 @@ LDFLAGS := $LDFLAGS STRIP := strip INSTALL := install -PREFIX := $PREFIX +prefix := $PREFIX SBINDIR := $SBINDIR ETCDIR := $ETCDIR EOF @@ -263,12 +263,13 @@ else fi VERSION=`cat ../version` -if which svn >/dev/null; then - SVN_REV=`svn info 2> /dev/null | grep "^Revision: " | awk '{print($2)}'` - if [ -n "$SVN_REV" ]; then - VERSION="$VERSION (svn$SVN_REV)" - fi +if which git >/dev/null; then + GIT_HASH=`git rev-parse HEAD 2> /dev/null` + if [ -n "$GIT_HASH" ]; then + VERSION="$VERSION (git $GIT_HASH)" + fi fi + HOSTNAME=`hostname` DATE=`date +"%d.%m.%Y %H:%M:%S %Z"` diff --git a/src/options.c b/src/options.c index f12eb1b..015a9a5 100644 --- a/src/options.c +++ b/src/options.c @@ -484,7 +484,13 @@ void options_print_usage() void options_print_version() { printf("%s\n", VERSION_STRING_0); +#if defined(__clang__) + printf("%s, using CLANG %s\n", VERSION_STRING_1, __clang_version__); +#elif defined(__GNUC__) + printf("%s, using GCC %d.%d.%d\n", VERSION_STRING_1, __GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__); +#else printf("%s\n", VERSION_STRING_1); +#endif } void options_print(options_t* opt) diff --git a/src/sig_handler.c b/src/sig_handler.c index 5de168e..f23d070 100644 --- a/src/sig_handler.c +++ b/src/sig_handler.c @@ -139,10 +139,10 @@ int signal_handle() for(sig=1; sig < NSIG; ++sig) { if(sigismember(&set, sig)) { switch(sig) { - case SIGINT: log_printf(NOTICE, "SIG-Int caught, exitting"); return_value = 1; break; - case SIGQUIT: log_printf(NOTICE, "SIG-Quit caught, exitting"); return_value = 1; break; - case SIGTERM: log_printf(NOTICE, "SIG-Term caught, exitting"); return_value = 1; break; - case SIGHUP: log_printf(NOTICE, "SIG-Hup caught"); return_value = 2; break; + case SIGINT: log_printf(NOTICE, "SIG-Int caught, exitting"); return_value = SIGINT; break; + case SIGQUIT: log_printf(NOTICE, "SIG-Quit caught, exitting"); return_value = SIGQUIT; break; + case SIGTERM: log_printf(NOTICE, "SIG-Term caught, exitting"); return_value = SIGTERM; break; + case SIGHUP: log_printf(NOTICE, "SIG-Hup caught"); return_value = SIGHUP; break; case SIGUSR1: log_printf(NOTICE, "SIG-Usr1 caught"); break; case SIGUSR2: log_printf(NOTICE, "SIG-Usr2 caught"); break; default: log_printf(WARNING, "unknown signal %d caught, ignoring", sig); break; diff --git a/src/uanytun.c b/src/uanytun.c index 93ddf63..c5d6291 100644 --- a/src/uanytun.c +++ b/src/uanytun.c @@ -52,6 +52,10 @@ #include <stdio.h> #include <string.h> #include <errno.h> +#include <sys/select.h> +#include <sys/types.h> +#include <unistd.h> +#include <signal.h> #include "log.h" #include "sig_handler.h" @@ -263,9 +267,8 @@ int main_loop(tun_device_t* dev, udp_t* sock, options_t* opt) if(FD_ISSET(sig_fd, &readyfds)) { return_value = signal_handle(); - if(return_value == 1) - break; - else if(return_value == 2) { + if(return_value == SIGINT || return_value == SIGQUIT || return_value == SIGTERM) break; + else if(return_value == SIGHUP) { seq_win_clear(&seq_win); seq_nr = 0; log_printf(NOTICE, "sequence window cleared"); @@ -452,8 +455,11 @@ int main(int argc, char* argv[]) log_printf(NOTICE, "normal shutdown"); else if(ret < 0) log_printf(NOTICE, "shutdown after error"); - else + else { log_printf(NOTICE, "shutdown after signal"); + log_close(); + kill(getpid(), ret); + } log_close(); @@ -65,6 +65,10 @@ #include <arpa/inet.h> #include <netinet/in.h> +#ifndef AI_ADDRCONFIG +#define AI_ADDRCONFIG 0 +#endif + static int udp_resolv_local(udp_t* sock, const char* local_addr, const char* port, resolv_addr_type_t resolv_type, unsigned int* idx) { struct addrinfo hints, *res; |