From 61b5229263db0d349bcab8b95bffa907f1668da1 Mon Sep 17 00:00:00 2001 From: zfl9 Date: Sat, 30 May 2020 11:45:29 +0800 Subject: [PATCH] splice undeclared patch (need test) --- ipt2socks.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/ipt2socks.c b/ipt2socks.c index a45c3e3..472bc96 100644 --- a/ipt2socks.c +++ b/ipt2socks.c @@ -28,6 +28,20 @@ #define IPT2SOCKS_VERSION "ipt2socks v1.1.2 " +#ifndef SPLICE_F_MOVE + #include + + #undef SPLICE_F_MOVE + #define SPLICE_F_MOVE 1 + + #undef SPLICE_F_NONBLOCK + #define SPLICE_F_NONBLOCK 2 + + ssize_t splice(int fdin, __off64_t *offin, int fdout, __off64_t *offout, size_t len, unsigned int flags) { + return syscall(__NR_splice, fdin, offin, fdout, offout, len, flags); + } +#endif + enum { OPT_ENABLE_TCP = 0x01 << 0, // enable tcp proxy OPT_ENABLE_UDP = 0x01 << 1, // enable udp proxy