Skip to content

Commit 6fa3632

Browse files
author
lec-bit
committed
tmp
1 parent cc1af1d commit 6fa3632

File tree

5 files changed

+18
-7
lines changed

5 files changed

+18
-7
lines changed

build.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ if [ "$1" == "-h" -o "$1" == "--help" ]; then
4343
fi
4444

4545
if [ -z "$1" -o "$1" == "-b" -o "$1" == "--build" ]; then
46+
bash kmesh_macros_env_kernel.sh
4647
prepare
4748
make
4849
exit

config/kmesh_marcos_def.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,35 +7,35 @@
77
* loopback address link conflicts. Obtains the namespace cookie of the
88
* current container based on the bpf_get_netns_cookie auxiliary function.
99
*/
10-
#define MDA_LOOPBACK_ADDR 1
10+
#define MDA_LOOPBACK_ADDR 0
1111

1212
/* supports NAT acceleration. That is, acceleration can also be performed
1313
* when iptables is used to forward traffic between service containers
1414
* and sidecar containers. The bpf_sk_original_addr auxiliary function is
1515
* used to obtain the original destination address.
1616
*/
17-
#define MDA_NAT_ACCEL 1
17+
#define MDA_NAT_ACCEL 0
1818

1919
/* supports acceleration function filtering based on GID and UID.
2020
* That is, the GID or UID corresponding to the process to be accelerated
2121
* is configured in the configuration file. The bpf_get_sockops_uid_gid
2222
* auxiliary function is used to obtain the GID and UID of the current
2323
* process.
2424
*/
25-
#define MDA_GID_UID_FILTER 1
25+
#define MDA_GID_UID_FILTER 0
2626

2727
/*
2828
* in kernel 6.x version, add the new iter type ITER_UBUF, and we need add code
2929
* for the corresponding scenarios.
3030
*/
31-
#define KERNEL_VERISON6 0
31+
#define KERNEL_VERISON6 1
3232

3333
/*
3434
* Kmesh’s Layer 7 acceleration proxy capability relies on kernel enhancements.
3535
* It’s necessary to determine whether the current environment has an
3636
* enhanced kernel in order to enable Kmesh’s capabilities.
3737
*/
38-
#define ENHANCED_KERNEL 0
38+
#define ENHANCED_KERNEL 1
3939

4040
/*
4141
* Different versions of libbpf can be installed in different environments,
@@ -50,4 +50,4 @@
5050
/*
5151
* Determine whether the current kernel version supports the use of kfunc.
5252
*/
53-
#define KERNEL_KFUNC 0
53+
#define KERNEL_KFUNC 1

kernel/ko_src/kmesh/Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,13 @@ kmesh-objs = kmesh_main.o defer_connect.o \
1313
kmesh_parse_http_1_1.o kmesh_func.o
1414

1515
KERNELDIR ?= /lib/modules/$(shell uname -r)/build
16+
VMLINUX_PATH := /sys/kernel/btf/vmlinux
1617
PWD := $(shell pwd)
1718

1819
ccflags-y += -Wno-discarded-qualifiers
1920

2021
all:
21-
$(MAKE) -C $(KERNELDIR) M=$(PWD)
22+
$(MAKE) -C $(KERNELDIR) M=$(PWD) KBUILD_VMLINUX_LIBS=$(VMLINUX_PATH) modules
2223

2324
install:
2425
install -dp -m 0500 /lib/modules/kmesh

kmesh_compile_env_pre.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,10 @@ function set_enhanced_kernel_env() {
146146

147147
KERNEL_MAJOR=$(uname -r | awk -F '.' '{print $1}')
148148

149+
zcat /proc/config.gz | grep BTF
150+
cat "/boot/config-$(uname -r)" | grep BTF
151+
check_config "CONFIG_DEBUG_INFO_BTF_MODULES"
152+
check_config "CONFIG_DEBUG_INFO_BTF"
149153
if grep -q "FN(parse_header_msg)" $KERNEL_HEADER_LINUX_BPF ||
150154
[ "$(check_config "CONFIG_DEBUG_INFO_BTF_MODULES")" == "y" ] &&
151155
[ "$(check_config "CONFIG_DEBUG_INFO_BTF")" == "y" ] &&

kmesh_macros_env_kernel.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,17 @@ else
3939
set_config ENHANCED_KERNEL 0
4040
fi
4141

42+
zcat /proc/config.gz | grep BTF
43+
cat "/boot/config-$(uname -r)" | grep BTF
4244
# KERNEL_KFUNC
4345
if [ "$(check_config "CONFIG_DEBUG_INFO_BTF_MODULES")" == "y" ] &&
4446
[ "$(check_config "CONFIG_DEBUG_INFO_BTF")" == "y" ] &&
4547
[ "$KERNEL_VERSION" -ge 6 ]; then
4648
set_config ENHANCED_KERNEL 1
4749
set_config KERNEL_KFUNC 1
50+
cp /sys/kernel/btf/vmlinux /lib/modules/$(uname -r)/build
4851
else
4952
set_config KERNEL_KFUNC 0
5053
fi
54+
55+
cat config/kmesh_marcos_def.h

0 commit comments

Comments
 (0)