ipt2socks: bump to 1.1.2 fix udp relay bug

This commit is contained in:
coolsnowwolf 2020-05-27 12:46:18 +08:00
parent bbe99b4fdf
commit 1be41d9899
2 changed files with 60 additions and 18 deletions

View File

@ -1,46 +1,39 @@
#
# Copyright (C) 2014 OpenWrt-dist
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
PKG_NAME:=ipt2socks
PKG_VERSION:=1.0.2
PKG_VERSION:=1.1.2
PKG_RELEASE:=1
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://github.com/zfl9/ipt2socks.git
PKG_SOURCE_VERSION:=e6c9b60444bfe2f30830619aacbc67d26ee1015e
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)
PKG_BUILD_PARALLEL:=1
PKG_BUILD_DEPENDS:=libuv
PKG_USE_MIPS16:=0
PKG_LICENSE:=GPLv3
PKG_LICENSE_FILES:=LICENSE
include $(INCLUDE_DIR)/package.mk
define Package/ipt2socks
SECTION:=net
CATEGORY:=Network
TITLE:=Utility for converting iptables (REDIRECT/TPROXY) to SOCKS5
URL:=https://github.com/zfl9/ipt2socks.git
URL:=https://github.com/zfl9/ipt2socks
endef
define Package/ipt2socks/description
Utility for converting iptables (REDIRECT/TPROXY) to SOCKS5.
endef
define Package/ipt2socks/conffiles
/etc/config/ipt2socks
endef
MAKE_FLAGS += LIBS="-l:libuv_a.a"
define Package/ipt2socks/install
$(INSTALL_DIR) $(1)/usr/bin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/ipt2socks $(1)/usr/bin
endef
$(eval $(call BuildPackage,ipt2socks))
$(eval $(call BuildPackage,ipt2socks))

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)