From 5cd5ab176ebe020f0af66829254dc29f275c1840 Mon Sep 17 00:00:00 2001 From: bol-van Date: Tue, 22 Oct 2024 18:10:29 +0300 Subject: [PATCH 1/2] custom.d.example old busybox bug workaround --- init.d/openwrt/custom.d.examples/10-inherit-nfqws | 9 ++++++--- init.d/openwrt/custom.d.examples/10-inherit-tpws | 9 ++++++--- init.d/openwrt/custom.d.examples/10-inherit-tpws-socks | 9 ++++++--- .../custom.d.examples/10-inherit-tpws4http-nfqws4https | 2 +- init.d/sysv/custom.d.examples/10-inherit-nfqws | 9 ++++++--- init.d/sysv/custom.d.examples/10-inherit-tpws | 9 ++++++--- init.d/sysv/custom.d.examples/10-inherit-tpws-socks | 9 ++++++--- .../custom.d.examples/10-inherit-tpws4http-nfqws4https | 2 +- 8 files changed, 38 insertions(+), 20 deletions(-) diff --git a/init.d/openwrt/custom.d.examples/10-inherit-nfqws b/init.d/openwrt/custom.d.examples/10-inherit-nfqws index b156402..83db175 100644 --- a/init.d/openwrt/custom.d.examples/10-inherit-nfqws +++ b/init.d/openwrt/custom.d.examples/10-inherit-nfqws @@ -6,17 +6,20 @@ zapret_custom_daemons() { # stop logic is managed by procd - MODE_OVERRIDE=$OVERRIDE start_daemons_procd + local MODE_OVERRIDE=$OVERRIDE + start_daemons_procd } zapret_custom_firewall() { # $1 - 1 - run, 0 - stop - MODE_OVERRIDE=$OVERRIDE zapret_do_firewall_rules_ipt $1 + local MODE_OVERRIDE=$OVERRIDE + zapret_do_firewall_rules_ipt $1 } zapret_custom_firewall_nft() { # stop logic is not required - MODE_OVERRIDE=$OVERRIDE zapret_apply_firewall_rules_nft + local MODE_OVERRIDE=$OVERRIDE + zapret_apply_firewall_rules_nft } diff --git a/init.d/openwrt/custom.d.examples/10-inherit-tpws b/init.d/openwrt/custom.d.examples/10-inherit-tpws index e9c5f69..157eab4 100644 --- a/init.d/openwrt/custom.d.examples/10-inherit-tpws +++ b/init.d/openwrt/custom.d.examples/10-inherit-tpws @@ -6,17 +6,20 @@ zapret_custom_daemons() { # stop logic is managed by procd - MODE_OVERRIDE=$OVERRIDE start_daemons_procd + local MODE_OVERRIDE=$OVERRIDE + start_daemons_procd } zapret_custom_firewall() { # $1 - 1 - run, 0 - stop - MODE_OVERRIDE=$OVERRIDE zapret_do_firewall_rules_ipt $1 + local MODE_OVERRIDE=$OVERRIDE + zapret_do_firewall_rules_ipt $1 } zapret_custom_firewall_nft() { # stop logic is not required - MODE_OVERRIDE=$OVERRIDE zapret_apply_firewall_rules_nft + local MODE_OVERRIDE=$OVERRIDE + zapret_apply_firewall_rules_nft } diff --git a/init.d/openwrt/custom.d.examples/10-inherit-tpws-socks b/init.d/openwrt/custom.d.examples/10-inherit-tpws-socks index b4e686a..90c97e9 100644 --- a/init.d/openwrt/custom.d.examples/10-inherit-tpws-socks +++ b/init.d/openwrt/custom.d.examples/10-inherit-tpws-socks @@ -6,17 +6,20 @@ zapret_custom_daemons() { # stop logic is managed by procd - MODE_OVERRIDE=$OVERRIDE start_daemons_procd + local MODE_OVERRIDE=$OVERRIDE + start_daemons_procd } zapret_custom_firewall() { # $1 - 1 - run, 0 - stop - MODE_OVERRIDE=$OVERRIDE zapret_do_firewall_rules_ipt $1 + local MODE_OVERRIDE=$OVERRIDE + zapret_do_firewall_rules_ipt $1 } zapret_custom_firewall_nft() { # stop logic is not required - MODE_OVERRIDE=$OVERRIDE zapret_apply_firewall_rules_nft + local MODE_OVERRIDE=$OVERRIDE + zapret_apply_firewall_rules_nft } diff --git a/init.d/openwrt/custom.d.examples/10-inherit-tpws4http-nfqws4https b/init.d/openwrt/custom.d.examples/10-inherit-tpws4http-nfqws4https index 752b1a2..c3685a5 100644 --- a/init.d/openwrt/custom.d.examples/10-inherit-tpws4http-nfqws4https +++ b/init.d/openwrt/custom.d.examples/10-inherit-tpws4http-nfqws4https @@ -5,7 +5,7 @@ nfqws_tpws_inheritor() { # $1 - inherited function # $2 - 1 - run, 0 - stop - + local MODE_OVERRIDE [ "$MODE_HTTP" = "1" ] && { MODE_OVERRIDE=tpws MODE_HTTPS=0 MODE_QUIC=0 $1 $2 } diff --git a/init.d/sysv/custom.d.examples/10-inherit-nfqws b/init.d/sysv/custom.d.examples/10-inherit-nfqws index 6002969..2e2dca0 100644 --- a/init.d/sysv/custom.d.examples/10-inherit-nfqws +++ b/init.d/sysv/custom.d.examples/10-inherit-nfqws @@ -6,17 +6,20 @@ zapret_custom_daemons() { # $1 - 1 - run, 0 - stop - MODE_OVERRIDE=$OVERRIDE zapret_do_daemons $1 + local MODE_OVERRIDE=$OVERRIDE + zapret_do_daemons $1 } zapret_custom_firewall() { # $1 - 1 - run, 0 - stop - MODE_OVERRIDE=$OVERRIDE zapret_do_firewall_rules_ipt $1 + local MODE_OVERRIDE=$OVERRIDE + zapret_do_firewall_rules_ipt $1 } zapret_custom_firewall_nft() { # stop logic is not required - MODE_OVERRIDE=$OVERRIDE zapret_apply_firewall_rules_nft + local MODE_OVERRIDE=$OVERRIDE + zapret_apply_firewall_rules_nft } diff --git a/init.d/sysv/custom.d.examples/10-inherit-tpws b/init.d/sysv/custom.d.examples/10-inherit-tpws index c1b183e..84ac85f 100644 --- a/init.d/sysv/custom.d.examples/10-inherit-tpws +++ b/init.d/sysv/custom.d.examples/10-inherit-tpws @@ -6,17 +6,20 @@ zapret_custom_daemons() { # $1 - 1 - run, 0 - stop - MODE_OVERRIDE=$OVERRIDE zapret_do_daemons $1 + local MODE_OVERRIDE=$OVERRIDE + zapret_do_daemons $1 } zapret_custom_firewall() { # $1 - 1 - run, 0 - stop - MODE_OVERRIDE=$OVERRIDE zapret_do_firewall_rules_ipt $1 + local MODE_OVERRIDE=$OVERRIDE + zapret_do_firewall_rules_ipt $1 } zapret_custom_firewall_nft() { # stop logic is not required - MODE_OVERRIDE=$OVERRIDE zapret_apply_firewall_rules_nft + local MODE_OVERRIDE=$OVERRIDE + zapret_apply_firewall_rules_nft } diff --git a/init.d/sysv/custom.d.examples/10-inherit-tpws-socks b/init.d/sysv/custom.d.examples/10-inherit-tpws-socks index 7fcb0e2..62ddb0a 100644 --- a/init.d/sysv/custom.d.examples/10-inherit-tpws-socks +++ b/init.d/sysv/custom.d.examples/10-inherit-tpws-socks @@ -6,17 +6,20 @@ zapret_custom_daemons() { # $1 - 1 - run, 0 - stop - MODE_OVERRIDE=$OVERRIDE zapret_do_daemons $1 + local MODE_OVERRIDE=$OVERRIDE + zapret_do_daemons $1 } zapret_custom_firewall() { # $1 - 1 - run, 0 - stop - MODE_OVERRIDE=$OVERRIDE zapret_do_firewall_rules_ipt $1 + local MODE_OVERRIDE=$OVERRIDE + zapret_do_firewall_rules_ipt $1 } zapret_custom_firewall_nft() { # stop logic is not required - MODE_OVERRIDE=$OVERRIDE zapret_apply_firewall_rules_nft + local MODE_OVERRIDE=$OVERRIDE + zapret_apply_firewall_rules_nft } diff --git a/init.d/sysv/custom.d.examples/10-inherit-tpws4http-nfqws4https b/init.d/sysv/custom.d.examples/10-inherit-tpws4http-nfqws4https index f05d75e..40eb419 100644 --- a/init.d/sysv/custom.d.examples/10-inherit-tpws4http-nfqws4https +++ b/init.d/sysv/custom.d.examples/10-inherit-tpws4http-nfqws4https @@ -5,7 +5,7 @@ nfqws_tpws_inheritor() { # $1 - inherited function # $2 - 1 - run, 0 - stop - + local MODE_OVERRIDE [ "$MODE_HTTP" = "1" ] && { MODE_OVERRIDE=tpws MODE_HTTPS=0 MODE_QUIC=0 $1 $2 } From 2c68d1c94f293470bf3a87b28c4d15242e22218c Mon Sep 17 00:00:00 2001 From: bol-van Date: Wed, 23 Oct 2024 16:37:39 +0300 Subject: [PATCH 2/2] 50-discord: fool first 3 packets --- init.d/openwrt/custom.d.examples/50-discord | 4 ++-- init.d/sysv/custom.d.examples/50-discord | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/init.d/openwrt/custom.d.examples/50-discord b/init.d/openwrt/custom.d.examples/50-discord index dc04c03..536b398 100644 --- a/init.d/openwrt/custom.d.examples/50-discord +++ b/init.d/openwrt/custom.d.examples/50-discord @@ -23,7 +23,7 @@ zapret_custom_firewall() # $1 - 1 - run, 0 - stop local f - local first_packets_only="$ipt_connbytes 1:1" + local first_packets_only="$ipt_connbytes 1:3" local desync="-m mark ! --mark $DESYNC_MARK/$DESYNC_MARK" local DISCORD_PORTS_IPT=$(replace_char - : $DISCORD_PORTS) local dest_set="-m set --match-set $DISCORD_SET_NAME dst" @@ -52,7 +52,7 @@ zapret_custom_firewall_nft() # stop logic is not required local f - local first_packets_only="$nft_connbytes 1" + local first_packets_only="$nft_connbytes 1-3" local desync="mark and $DESYNC_MARK == 0" local dest_set="ip daddr @$DISCORD_SET_NAME" local subnets diff --git a/init.d/sysv/custom.d.examples/50-discord b/init.d/sysv/custom.d.examples/50-discord index edb685a..6717880 100644 --- a/init.d/sysv/custom.d.examples/50-discord +++ b/init.d/sysv/custom.d.examples/50-discord @@ -23,7 +23,7 @@ zapret_custom_firewall() # $1 - 1 - run, 0 - stop local f - local first_packets_only="$ipt_connbytes 1:1" + local first_packets_only="$ipt_connbytes 1:3" local desync="-m mark ! --mark $DESYNC_MARK/$DESYNC_MARK" local DISCORD_PORTS_IPT=$(replace_char - : $DISCORD_PORTS) local dest_set="-m set --match-set $DISCORD_SET_NAME dst" @@ -52,7 +52,7 @@ zapret_custom_firewall_nft() # stop logic is not required local f - local first_packets_only="$nft_connbytes 1" + local first_packets_only="$nft_connbytes 1-3" local desync="mark and $DESYNC_MARK == 0" local dest_set="ip daddr @$DISCORD_SET_NAME" local subnets