diff options
-rw-r--r-- | src/bsd/tun.c | 2 | ||||
-rw-r--r-- | src/datatypes.h | 9 | ||||
-rw-r--r-- | src/linux/tun.c | 3 | ||||
-rw-r--r-- | src/options.c | 1 | ||||
-rw-r--r-- | src/sysexec.h | 2 | ||||
-rw-r--r-- | src/udp.c | 8 |
6 files changed, 16 insertions, 9 deletions
diff --git a/src/bsd/tun.c b/src/bsd/tun.c index bc10d5b..d52cf67 100644 --- a/src/bsd/tun.c +++ b/src/bsd/tun.c @@ -58,7 +58,7 @@ 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) - return; + return -1; tun_conf(dev, dev_name, dev_type, ifcfg_addr, ifcfg_prefix, 1400); dev->actual_name_ = NULL; diff --git a/src/datatypes.h b/src/datatypes.h index 5cddbda..a616dfe 100644 --- a/src/datatypes.h +++ b/src/datatypes.h @@ -36,15 +36,16 @@ #define _DATATYPES_H_ #include <stdint.h> +#include <arpa/inet.h> typedef uint8_t u_int8_t; typedef uint16_t u_int16_t; typedef uint32_t u_int32_t; typedef uint64_t u_int64_t; -// typedef int8_t int8_t; -// typedef int16_t int16_t; -// typedef int32_t int32_t; -// typedef int64_t int64_t; +/* typedef int8_t int8_t; */ +/* typedef int16_t int16_t; */ +/* typedef int32_t int32_t; */ +/* typedef int64_t int64_t; */ typedef u_int32_t window_size_t; diff --git a/src/linux/tun.c b/src/linux/tun.c index 385da8d..1faf49d 100644 --- a/src/linux/tun.c +++ b/src/linux/tun.c @@ -41,6 +41,7 @@ #include "tun_helper.h" #include <stdlib.h> +#include <unistd.h> #include <sys/wait.h> #include <fcntl.h> #include <sys/ioctl.h> @@ -56,7 +57,7 @@ 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) - return; + return -1; tun_conf(dev, dev_name, dev_type, ifcfg_addr, ifcfg_prefix, 1400); dev->actual_name_ = NULL; diff --git a/src/options.c b/src/options.c index 0d6943a..6e02649 100644 --- a/src/options.c +++ b/src/options.c @@ -39,6 +39,7 @@ #include <stdlib.h> #include <stdio.h> #include <string.h> +#include <ctype.h> #include "log.h" diff --git a/src/sysexec.h b/src/sysexec.h index 5021392..07cac2c 100644 --- a/src/sysexec.h +++ b/src/sysexec.h @@ -38,7 +38,7 @@ int exec_script(const char* script, const char* ifname) { if(!script || !ifname) - return; + return -1; pid_t pid; pid = fork(); @@ -39,14 +39,18 @@ #include "log.h" #include <stdlib.h> +#include <unistd.h> #include <string.h> #include <netdb.h> +#include <sys/types.h> +#include <sys/socket.h> +#include <arpa/inet.h> #include <netinet/in.h> int udp_init(udp_socket_t* sock, const char* local_addr, const char* port) { if(!sock || !port) - return; + return -1; sock->fd_ = 0; memset(&(sock->local_end_), 0, sizeof(sock->local_end_)); @@ -185,7 +189,7 @@ int udp_read(udp_socket_t* sock, u_int8_t* buf, u_int32_t len, udp_endpoint_t* r if(!sock || !remote_end) return -1; - int socklen = sizeof(*remote_end); + socklen_t socklen = sizeof(*remote_end); return recvfrom(sock->fd_, buf, len, 0, (struct sockaddr *)remote_end, &socklen); } |