Skip to content

Commit 39d0cb1

Browse files
Fix dae trace
Use r8152 oot drivers Signed-off-by: Nicholas Sun <nicholas-sun@outlook.com>
1 parent 4b377cc commit 39d0cb1

File tree

6 files changed

+217
-27
lines changed

6 files changed

+217
-27
lines changed

PATCH/dae/Makefile

Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
# SPDX-License-Identifier: GPL-2.0-only
2+
#
3+
# Copyright (C) 2023 ImmortalWrt.org
4+
5+
include $(TOPDIR)/rules.mk
6+
7+
PKG_NAME:=dae
8+
PKG_VERSION:=0.6.0rc2
9+
PKG_RELEASE:=1
10+
11+
PKG_SOURCE_PROTO:=git
12+
PKG_SOURCE_URL:=https://github.com/daeuniverse/dae.git
13+
PKG_SOURCE_VERSION:=b5ebd4f8cb82c5a0b44a49b53f3e9df4f01419c8
14+
PKG_MIRROR_HASH:=skip
15+
16+
PKG_LICENSE:=AGPL-3.0-only
17+
PKG_LICENSE_FILE:=LICENSE
18+
PKG_MAINTAINER:=Tianling Shen <cnsztl@immortalwrt.org>
19+
20+
PKG_BUILD_DEPENDS:=golang/host bpf-headers
21+
PKG_BUILD_PARALLEL:=1
22+
PKG_USE_MIPS16:=0
23+
PKG_BUILD_FLAGS:=no-mips16
24+
25+
GO_PKG:=github.com/daeuniverse/dae
26+
GO_PKG_LDFLAGS_X:= \
27+
$(GO_PKG)/cmd.Version=$(PKG_VERSION) \
28+
$(GO_PKG)/common/consts.MaxMatchSetLen_=64
29+
30+
include $(INCLUDE_DIR)/package.mk
31+
include $(INCLUDE_DIR)/bpf.mk
32+
include $(TOPDIR)/feeds/packages/lang/golang/golang-package.mk
33+
34+
define Package/dae/Default
35+
SECTION:=net
36+
CATEGORY:=Network
37+
SUBMENU:=Web Servers/Proxies
38+
URL:=https://github.com/daeuniverse/dae
39+
endef
40+
41+
define Package/dae
42+
$(call Package/dae/Default)
43+
TITLE:=A lightweight and high-performance transparent proxy solution
44+
# You need enable KERNEL_DEBUG_INFO_BTF and KERNEL_BPF_EVENTS
45+
DEPENDS:=$(GO_ARCH_DEPENDS) $(BPF_DEPENDS) \
46+
+ca-bundle +kmod-sched-core +kmod-sched-bpf +kmod-xdp-sockets-diag +kmod-veth
47+
endef
48+
49+
define Package/dae-geoip
50+
$(call Package/dae/Default)
51+
TITLE:=geoip for dae
52+
DEPENDS:=+v2ray-geoip
53+
PKGARCH:=all
54+
endef
55+
56+
define Package/dae-geosite
57+
$(call Package/dae/Default)
58+
TITLE:=geosite for dae
59+
DEPENDS:=+v2ray-geosite
60+
PKGARCH:=all
61+
endef
62+
63+
define Package/dae/description
64+
dae, means goose, is a lightweight and high-performance transparent
65+
proxy solution.
66+
67+
In order to improve the traffic diversion performance as much as possible,
68+
dae runs the transparent proxy and traffic diversion suite in the linux
69+
kernel by eBPF. Therefore, we have the opportunity to make the direct
70+
traffic bypass the forwarding by proxy application and achieve true direct
71+
traffic through. Under such a magic trick, there is almost no performance
72+
loss and additional resource consumption for direct traffic.
73+
endef
74+
75+
define Package/dae/conffiles
76+
/etc/dae/config.dae
77+
/etc/config/dae
78+
endef
79+
80+
DAE_CFLAGS:= \
81+
-O2 -Wall -Werror \
82+
-DMAX_MATCH_SET_LEN=64 \
83+
-I$(BPF_HEADERS_DIR)/tools/lib \
84+
-I$(BPF_HEADERS_DIR)/arch/$(BPF_KARCH)/include/asm/mach-generic
85+
86+
define Build/Compile
87+
( \
88+
export $(GO_GENERAL_BUILD_CONFIG_VARS) \
89+
$(GO_PKG_BUILD_CONFIG_VARS) \
90+
$(GO_PKG_BUILD_VARS) \
91+
BPF_CLANG="$(CLANG)" \
92+
BPF_STRIP_FLAG="-strip=$(LLVM_STRIP)" \
93+
BPF_CFLAGS="$(DAE_CFLAGS)" \
94+
BPF_TARGET="bpfel,bpfeb" \
95+
BPF_TRACE_TARGET="$(GO_ARCH)" ; \
96+
go generate $(PKG_BUILD_DIR)/control/control.go ; \
97+
go generate $(PKG_BUILD_DIR)/trace/trace.go ; \
98+
$(call GoPackage/Build/Compile) ; \
99+
)
100+
endef
101+
102+
define Package/dae/install
103+
$(call GoPackage/Package/Install/Bin,$(1))
104+
105+
$(INSTALL_DIR) $(1)/etc/dae/
106+
$(INSTALL_CONF) $(PKG_BUILD_DIR)/example.dae $(1)/etc/dae/
107+
108+
$(INSTALL_DIR) $(1)/etc/config
109+
$(INSTALL_CONF) $(CURDIR)/files/dae.config $(1)/etc/config/dae
110+
111+
$(INSTALL_DIR) $(1)/etc/init.d
112+
$(INSTALL_BIN) $(CURDIR)/files/dae.init $(1)/etc/init.d/dae
113+
endef
114+
115+
define Package/dae-geoip/install
116+
$(INSTALL_DIR) $(1)/usr/share/dae
117+
$(LN) ../v2ray/geoip.dat $(1)/usr/share/dae/geoip.dat
118+
endef
119+
120+
define Package/dae-geosite/install
121+
$(INSTALL_DIR) $(1)/usr/share/dae
122+
$(LN) ../v2ray/geosite.dat $(1)/usr/share/dae/geosite.dat
123+
endef
124+
125+
$(eval $(call GoBinPackage,dae))
126+
$(eval $(call BuildPackage,dae))
127+
$(eval $(call BuildPackage,dae-geoip))
128+
$(eval $(call BuildPackage,dae-geosite))

PATCH/dae/files/dae.config

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
2+
config dae 'config'
3+
option enabled '0'
4+
option config_file '/etc/dae/config.dae'
5+
option log_maxbackups '1'
6+
option log_maxsize '1'
7+

PATCH/dae/files/dae.init

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
#!/bin/sh /etc/rc.common
2+
# Copyright (C) 2023 Tianling Shen <cnsztl@immortalwrt.org>
3+
4+
USE_PROCD=1
5+
START=99
6+
7+
extra_command "hot_reload" "Hot-reload service"
8+
9+
CONF="dae"
10+
PROG="/usr/bin/dae"
11+
LOG_DIR="/var/log/dae"
12+
13+
start_service() {
14+
config_load "$CONF"
15+
16+
local enabled
17+
config_get_bool enabled "config" "enabled" "0"
18+
[ "$enabled" -eq "1" ] || return 1
19+
20+
local config_file
21+
config_get config_file "config" "config_file" "/etc/dae/config.dae"
22+
23+
"$PROG" validate -c "$config_file" || return 1
24+
25+
local log_maxbackups log_maxsize
26+
config_get log_maxbackups "config" "log_maxbackups" "1"
27+
config_get log_maxsize "config" "log_maxsize" "1"
28+
29+
procd_open_instance "$CONF"
30+
procd_set_param command "$PROG" run
31+
procd_append_param command --config "$config_file"
32+
procd_append_param command --disable-timestamp
33+
procd_append_param command --logfile "$LOG_DIR/dae.log"
34+
procd_append_param command --logfile-maxbackups "$log_maxbackups"
35+
procd_append_param command --logfile-maxsize "$log_maxsize"
36+
37+
procd_set_param limits core="unlimited"
38+
procd_set_param limits nofile="1000000 1000000"
39+
procd_set_param respawn
40+
# procd_set_param stdout 1
41+
procd_set_param stderr 1
42+
43+
procd_close_instance
44+
}
45+
46+
stop_service() {
47+
rm -rf "$LOG_DIR"
48+
}
49+
50+
service_triggers() {
51+
procd_add_reload_trigger "$CONF"
52+
}
53+
54+
hot_reload() {
55+
"$PROG" reload "$(cat /var/run/dae.pid)"
56+
}

README.md

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -23,24 +23,24 @@ regarding the accuracy, adequacy, validity, reliability, availability, or comple
2323
---
2424
### Key Infomations
2525

26-
Login IP:192.168.1.1
26+
Login IP:192.168.1.1
2727

28-
Password:None
28+
Password:None
2929

3030
### Version Informations
3131

32-
OpenWrt official v23.05.2
32+
OpenWrt official v23.05.3
3333

3434
---
3535
### Feature
3636

37-
1.Based on official OpenWrt
37+
1.Based on official OpenWrt
3838

39-
2.Only contain the most basic software for the stability
39+
2.Only contain the most basic software for the stability
4040

41-
3.Fullcone NAT supported
41+
3.Fullcone NAT supported
4242

43-
4.Opkg vermagic matched with OpenWrt manifest ( You can install the software as if you have AppStore~ )
43+
4.Opkg vermagic matched with OpenWrt manifest ( You can install the software as if you have AppStore~ )
4444

4545
5.Add package [dae](https://github.com/daeuniverse/dae), a high performance eBPF transparent proxy client
4646

@@ -50,11 +50,11 @@ OpenWrt official v23.05.2
5050

5151
8.Update to firewall4, firewall3 no longer supported ( Huge improvements in performance )
5252

53-
9.Add support for phone USB hotspot sharing, both for Android and iPhone
53+
9.Add support for phone USB hotspot sharing, both for Android and iPhone
5454

55-
10.Disable IPv6 by default
55+
10.Disable IPv6 by default
5656

57-
* If you do need IPv6
57+
* If you do need IPv6
5858

5959
```
6060
uci set dhcp.lan.ra='hybrid'
@@ -68,7 +68,7 @@ uci commit dhcp
6868
* PS: HYBRID mode is never a good choice, please learn about [IPv6](https://www.cisco.com/en/US/docs/switches/lan/catalyst3850/software/release/3se/consolidated_guide/b_consolidated_3850_3se_cg_chapter_0101011.html). Also odhcpd on OpenWrt has serious bugs!
6969
* Bug fixed:
7070
* Add `dhcp.lan.max_preferred_lifetime` and `dhcp.lan.max_valid_lifetime` with LuCI options
71-
* Add scripts to fix `lan` IPv6 misbehaving when `wan` is getting IPv6-PD via PPPoE
71+
* Add scripts to fix `lan` IPv6 misbehaving when `wan` is getting IPv6-PD via PPPoE
7272

7373
#### X86_64 Feature
7474

@@ -83,23 +83,23 @@ Realtek: r8125, r8169, r8152
8383

8484
#### R2S Feature
8585

86-
1.Fix DDR4 333MHz problem
86+
1.Fix DDR4 333MHz problem
8787

88-
2.Modify DTSI to support overclocked unstable devices as much as possible
88+
2.Modify DTSI to support overclocked unstable devices as much as possible
8989

90-
3.Remove frequencies below 800MHz (same voltage) for faster response
90+
3.Remove frequencies below 800MHz (same voltage) for faster response
9191

92-
4.Support TF card with a minimum size of 512MB
92+
4.Support TF card with a minimum size of 512MB
9393

9494
![](/Screenshots/main.jpeg)
9595

9696
#### R4S Feature
9797

98-
1.Overclock to 2208MHz/1800MHz (big.LITTLE)
98+
1.Overclock to 2208MHz/1800MHz (big.LITTLE)
9999

100-
2.Remove thermal throttle limit (Default at 70°C)
100+
2.Remove thermal throttle limit (Default at 70°C)
101101

102-
3.Support TF card in 1.8V signalling, fix UHS card cannot boot in 3.3V mode
102+
3.Support TF card in 1.8V signalling, fix UHS card cannot boot in 3.3V mode
103103

104104
---
105105
## Thanks to everyone in ImmortalWrt and OpenWrt

SCRIPTS/02_prepare_package.sh

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ cp -rf ../immortalwrt_23/package/boot/uboot-rockchip ./package/boot/uboot-rockch
7171
rm -rf ./package/boot/arm-trusted-firmware-rockchip
7272
cp -rf ../immortalwrt_23/package/boot/arm-trusted-firmware-rockchip ./package/boot/arm-trusted-firmware-rockchip
7373
sed -i '/REQUIRE_IMAGE_METADATA/d' target/linux/rockchip/armv8/base-files/lib/upgrade/platform.sh
74+
sed -i '/^define Device\/friendlyarm_nanopi-.*$/,/^endef/ s/kmod-usb-net-rtl8152/kmod-usb-net-rtl8152-vendor/' target/linux/rockchip/image/armv8.mk
7475
wget -qO - https://github.com/openwrt/openwrt/commit/c21a3570.patch | patch -p1
7576
sed -i '/I915/d' target/linux/x86/64/config-5.15
7677
# Disable mitigations
@@ -100,7 +101,8 @@ cp -rf ../immortalwrt_23/package/utils/mhz ./package/utils/mhz
100101
cp -rf ../immortalwrt_luci/applications/luci-app-autoreboot ./feeds/luci/applications/luci-app-autoreboot
101102
ln -sf ../../../feeds/luci/applications/luci-app-autoreboot ./package/feeds/luci/luci-app-autoreboot
102103
# Dae ready
103-
cp -rf ../immortalwrt_pkg/net/dae ./feeds/packages/net/dae
104+
#cp -rf ../immortalwrt_pkg/net/dae ./feeds/packages/net/dae
105+
cp -rf ../PATCH/dae ./feeds/packages/net/dae
104106
ln -sf ../../../feeds/packages/net/dae ./package/feeds/packages/dae
105107
wget -qO - https://github.com/immortalwrt/immortalwrt/commit/73e5679.patch | patch -p1
106108
wget https://github.com/immortalwrt/immortalwrt/raw/openwrt-23.05/target/linux/generic/backport-5.15/051-v5.18-bpf-Add-config-to-allow-loading-modules-with-BTF-mismatch.patch -O target/linux/generic/backport-5.15/051-v5.18-bpf-Add-config-to-allow-loading-modules-with-BTF-mismatch.patch
@@ -112,18 +114,15 @@ cp -rf ../PATCH/cgroupfs-mount/900-mount-cgroup-v2-hierarchy-to-sys-fs-cgroup-cg
112114
cp -rf ../PATCH/cgroupfs-mount/901-fix-cgroupfs-umount.patch ./feeds/packages/utils/cgroupfs-mount/patches/
113115
cp -rf ../PATCH/script/updategeo.sh ./package/base-files/files/bin/updategeo
114116
# Dae update
115-
sed -i '/zip/d;/HASH/d;/RELEASE:=/d' feeds/packages/net/dae/Makefile
116-
sed -i "/VERSION:/ s/$/-$(date +'%Y%m%d')/" feeds/packages/net/dae/Makefile
117-
sed -i '10i\PKG_SOURCE_PROTO:=git' feeds/packages/net/dae/Makefile
118-
sed -i '11i\PKG_SOURCE_URL:=https://github.com/daeuniverse/dae.git' feeds/packages/net/dae/Makefile
119-
sed -i "12i\PKG_SOURCE_VERSION:=$(curl -s https://api.github.com/repos/daeuniverse/dae/commits | grep '"sha"' | head -1 | cut -d '"' -f 4)" feeds/packages/net/dae/Makefile
120-
sed -i '13i\PKG_MIRROR_HASH:=skip' feeds/packages/net/dae/Makefile
117+
sed -i "s,0.6.0rc2,$(curl -s "https://api.github.com/repos/daeuniverse/dae/releases" | grep -m 1 -oP '"tag_name": "\K(.*?)(?=")' | cut -d '"' -f 4)-$(date +'%Y%m%d'),g" feeds/packages/net/dae/Makefile
118+
sed -i "s,b5ebd4f8cb82c5a0b44a49b53f3e9df4f01419c8,$(curl -s https://api.github.com/repos/daeuniverse/dae/commits | grep '"sha"' | head -1 | cut -d '"' -f 4),g" feeds/packages/net/dae/Makefile
121119
# Golang
122120
rm -rf ./feeds/packages/lang/golang
123121
cp -rf ../openwrt_pkg_ma/lang/golang ./feeds/packages/lang/golang
124122
# NIC drivers update
125123
git clone https://github.com/sbwml/package_kernel_r8125 package/new/r8125
126-
cp -rf ../immortalwrt/package/kernel/r8152 ./package/new/r8152
124+
#cp -rf ../immortalwrt/package/kernel/r8152 ./package/new/r8152
125+
git clone https://github.com/sbwml/package_kernel_r8152 package/new/r8152
127126
git clone -b master --depth 1 https://github.com/BROBIRD/openwrt-r8168.git package/new/r8168
128127
patch -p1 <../PATCH/r8168/r8168-fix_LAN_led-for_r4s-from_TL.patch
129128
cp -rf ../lede/target/linux/x86/patches-5.15/996-intel-igc-i225-i226-disable-eee.patch ./target/linux/x86/patches-5.15/996-intel-igc-i225-i226-disable-eee.patch

SCRIPTS/switch

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@
88
#
99
# Change Lines
1010
#
11-
# 24 Mar
11+
# 18 Apr
1212

0 commit comments

Comments
 (0)