ipt2socks: bump to 1.1.2 fix udp relay bug

This commit is contained in:
coolsnowwolf 2020-05-27 12:46:18 +08:00 committed by CN_SZTL
parent cf7b1a729a
commit 7bad61c59d
No known key found for this signature in database
GPG Key ID: 6850B6345C862176
2 changed files with 52 additions and 3 deletions

View File

@ -0,0 +1,49 @@
--- a/ipt2socks.c
+++ b/ipt2socks.c
@@ -28,6 +28,36 @@
#define IPT2SOCKS_VERSION "ipt2socks v1.1.2 <https://github.com/zfl9/ipt2socks>"
+#ifdef __MUSL__
+#include <unistd.h>
+#include <sys/syscall.h>
+
+ssize_t splice(int __fdin, __off64_t *__offin, int __fdout,
+ __off64_t *__offout, size_t __len, unsigned int __flags) {
+#ifdef __NR_splice
+ return syscall(__NR_splice, __fdin, __offin, __fdout, __offout, __len, __flags);
+#else
+ (void)__fdin;
+ (void)__offin;
+ (void)__fdout;
+ (void)__offout;
+ (void)__len;
+ (void)__flags;
+ errno = ENOSYS;
+ return -1;
+#endif
+}
+
+#undef SPLICE_F_MOVE
+#undef SPLICE_F_NONBLOCK
+#undef SPLICE_F_MORE
+
+#define SPLICE_F_MOVE 1
+#define SPLICE_F_NONBLOCK 2
+#define SPLICE_F_MORE 4
+
+#endif /* __MUSL__ */
+
enum {
OPT_ENABLE_TCP = 0x01 << 0, // enable tcp proxy
OPT_ENABLE_UDP = 0x01 << 1, // enable udp proxy
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,5 @@
CC = gcc
-CFLAGS = -std=c99 -Wall -Wextra -O2 -pthread
+CFLAGS = -std=c99 -Wall -Wextra -O2 -pthread -D __MUSL__
LIBS = -lm
SRCS = ipt2socks.c logutils.c lrucache.c netutils.c protocol.c
OBJS = $(SRCS:.c=.o)

View File

@ -8,12 +8,12 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=ipt2socks
PKG_VERSION:=1.0.2
PKG_RELEASE:=5
PKG_VERSION:=1.1.2
PKG_RELEASE:=1
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://github.com/zfl9/ipt2socks.git
PKG_SOURCE_VERSION:=aebd43819d5eb63253c6df2610089188c194c3e3
PKG_SOURCE_VERSION:=cfbc2189356aba7fcafb0bc961a95419f313d8a7
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION)
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)/$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION)