mirror of
https://github.com/Ysurac/openmptcprouter-feeds.git
synced 2025-02-12 18:41:51 +00:00
Fix eBPF support to shadowsocks
This commit is contained in:
parent
b6d8d49c35
commit
cecdab539d
3 changed files with 12 additions and 9 deletions
|
@ -94,6 +94,8 @@ define Package/shadowsocks-libev-ss-rules/install
|
|||
$(INSTALL_BIN) ./files/ss-rules.defaults $(1)/etc/uci-defaults
|
||||
$(INSTALL_DIR) $(1)/etc/sysctl.d
|
||||
$(INSTALL_DATA) ./files/shadowsocks.conf $(1)/etc/sysctl.d
|
||||
$(INSTALL_DIR) $(1)/usr/lib/shadowsocks-libev
|
||||
$(INSTALL_DATA) $(PKG_BUILD_DIR)/src/*.ebpf $(1)/usr/lib/shadowsocks-libev
|
||||
endef
|
||||
|
||||
define Package/shadowsocks-libev-ss-rules/prerm
|
||||
|
|
|
@ -49,9 +49,9 @@ ss_mkjson_server_conf_() {
|
|||
[ -n "$server_port" ] || return 1
|
||||
password="${password//\"/\\\"}"
|
||||
key="$(echo $key | sed 's/+/-/g; s/\//_/g;')"
|
||||
[ "$method" = "none" -a -z "$key" ] && key="none"
|
||||
[ "$method" = "none-ebpf" -a -z "$key" ] && {
|
||||
key="none"
|
||||
[ "$method" = "none" -a -z "$key" ] && key=""
|
||||
[ "$ebpf" = 1 ] && {
|
||||
key=""
|
||||
method="none"
|
||||
}
|
||||
cat <<-EOF
|
||||
|
@ -70,7 +70,7 @@ ss_mkjson_common_conf() {
|
|||
[ "$reuse_port" = 0 ] && reuse_port=false || reuse_port=true
|
||||
[ "$mptcp" = 0 ] && mptcp=false || mptcp=true
|
||||
[ "$syslog" = 0 ] && syslog=false || syslog=true
|
||||
[ "$method" = "none-ebpf" ] && ebpf=true || ebpf=false
|
||||
[ "$ebpf" = 0 ] && ebpf=false || ebpf=true
|
||||
cat <<-EOF
|
||||
"use_syslog": $syslog,
|
||||
"ipv6_first": $ipv6_first,
|
||||
|
@ -389,7 +389,7 @@ validate_common_server_options_() {
|
|||
local cfgtype="$1"; shift
|
||||
local cfg="$1"; shift
|
||||
local func="$1"; shift
|
||||
local stream_methods='"none-ebpf", "none", "table", "rc4", "rc4-md5", "aes-128-cfb", "aes-192-cfb", "aes-256-cfb", "aes-128-ctr", "aes-192-ctr", "aes-256-ctr", "bf-cfb", "camellia-128-cfb", "camellia-192-cfb", "camellia-256-cfb", "salsa20", "chacha20", "chacha20-ietf"'
|
||||
local stream_methods='"none", "table", "rc4", "rc4-md5", "aes-128-cfb", "aes-192-cfb", "aes-256-cfb", "aes-128-ctr", "aes-192-ctr", "aes-256-ctr", "bf-cfb", "camellia-128-cfb", "camellia-192-cfb", "camellia-256-cfb", "salsa20", "chacha20", "chacha20-ietf"'
|
||||
local aead_methods='"aes-128-gcm", "aes-192-gcm", "aes-256-gcm", "chacha20-ietf-poly1305", "xchacha20-ietf-poly1305"'
|
||||
|
||||
"${func:-ss_validate}" "$cfgtype" "$cfg" "$@" \
|
||||
|
@ -420,6 +420,7 @@ validate_common_options_() {
|
|||
'no_delay:bool:0' \
|
||||
'reuse_port:bool:0' \
|
||||
'mptcp:bool:0' \
|
||||
'ebpf:bool:0' \
|
||||
'verbose:bool:0' \
|
||||
'mode:or("tcp_only", "udp_only", "tcp_and_udp"):tcp_only' \
|
||||
'mtu:uinteger' \
|
||||
|
|
|
@ -299,8 +299,8 @@ diff -aurN shadowsocks-libev-nocrypto-nocrypto/src/redir.c shadowsocks-libev-noc
|
|||
#define IP6T_SO_ORIGINAL_DST 80
|
||||
#endif
|
||||
|
||||
+#define PARSE_PROG_FILENAME "sockmap_parse.o.ebpf"
|
||||
+#define VERDICT_PROG_FILENAME "sockmap_verdict.o.ebpf"
|
||||
+#define PARSE_PROG_FILENAME "/usr/lib/shadowsocks-libev/sockmap_parse.o.ebpf"
|
||||
+#define VERDICT_PROG_FILENAME "/usr/lib/shadowsocks-libev/sockmap_verdict.o.ebpf"
|
||||
+
|
||||
static void accept_cb(EV_P_ ev_io *w, int revents);
|
||||
static void server_recv_cb(EV_P_ ev_io *w, int revents);
|
||||
|
@ -511,7 +511,7 @@ diff -aurN shadowsocks-libev-nocrypto-nocrypto/src/redir.c shadowsocks-libev-noc
|
|||
+ PARSE_PROG_FILENAME, BPF_PROG_TYPE_SK_SKB,
|
||||
+ &pobj, &pfd);
|
||||
+ if(err < 0) {
|
||||
+ LOGE("Failed to load BPF object\n");
|
||||
+ LOGE("Failed to load BPF object (parse)\n");
|
||||
+ goto error_cleanup;
|
||||
+ }
|
||||
+
|
||||
|
@ -520,7 +520,7 @@ diff -aurN shadowsocks-libev-nocrypto-nocrypto/src/redir.c shadowsocks-libev-noc
|
|||
+ VERDICT_PROG_FILENAME, BPF_PROG_TYPE_SK_SKB,
|
||||
+ &vobj, &vfd);
|
||||
+ if(err < 0) {
|
||||
+ LOGE("Failed to load BPF object\n");
|
||||
+ LOGE("Failed to load BPF object (verdict)\n");
|
||||
+ goto error_cleanup;
|
||||
+ }
|
||||
+
|
||||
|
|
Loading…
Reference in a new issue