Skip to content

Commit e7b42d6

Browse files
author
lec-bit
committed
fix bpf helper num
Signed-off-by: lec-bit <[email protected]>
1 parent a4bc785 commit e7b42d6

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

bpf/include/bpf_helper_defs_ext.h

+7-3
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@
1010
* By default, these IDs are in the 5.10 kernel with kmesh kernel patches.
1111
*/
1212

13+
#define bpf_km_header_strnstr_num 175
14+
#define bpf_km_header_strncmp_num 176
15+
#define bpf_parse_header_msg_num 177
16+
1317
/*
1418
* Description
1519
* Look for the string corresponding to the key in the results of the
@@ -19,7 +23,7 @@
1923
* If found, return 1; otherwise, return 0.
2024
*/
2125
static long (*bpf_km_header_strnstr)(
22-
struct bpf_sock_addr *ctx, const char *key, int key_sz, const char *subptr, int subptr_sz) = (void *)175;
26+
struct bpf_sock_addr *ctx, const char *key, int key_sz, const char *subptr, int subptr_sz) = (void *)bpf_km_header_strnstr_num;
2327

2428
/*
2529
* Description
@@ -31,7 +35,7 @@ static long (*bpf_km_header_strnstr)(
3135
* If the strings are same, return 0.
3236
*/
3337
static long (*bpf_km_header_strncmp)(const char *key, int key_sz, const char *target, int target_sz, int opt) =
34-
(void *)176;
38+
(void *)bpf_km_header_strncmp_num;
3539

3640
/*
3741
* Description
@@ -43,4 +47,4 @@ static long (*bpf_km_header_strncmp)(const char *key, int key_sz, const char *ta
4347
* A HTTP PROTO TYPE is returned on success.
4448
* **PROTO_UNKNOW** is returned if failure.
4549
*/
46-
static long (*bpf_parse_header_msg)(struct bpf_sock_addr *ctx) = (void *)177;
50+
static long (*bpf_parse_header_msg)(struct bpf_sock_addr *ctx) = (void *)bpf_parse_header_msg_num;

kmesh_bpf_env.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,6 @@ for name in ${helper_name[@]}; do
1717
current_line=`grep -nr "FN($name)" $KERNEL_HEADER_LINUX_BPF | awk -F ":" {'print $1'}`
1818
if [ -n "$current_line" ]; then
1919
helper_id=`expr $current_line - $base_line`
20-
sed -Ei "/$name/s/([0-9]+)[^0-9]*$/$helper_id;/" $ROOT_DIR/bpf/include/bpf_helper_defs_ext.h
20+
sed -Ei "/${name}_num/s/([0-9]+)[^0-9]*$/$helper_id/" $ROOT_DIR/bpf/include/bpf_helper_defs_ext.h
2121
fi
2222
done

0 commit comments

Comments
 (0)