Skip to content

fix helper func num #1336

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 27, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions bpf/include/bpf_helper_defs_ext.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
* By default, these IDs are in the 5.10 kernel with kmesh kernel patches.
*/

#define bpf_km_header_strnstr_num 175
#define bpf_km_header_strncmp_num 176
#define bpf_parse_header_msg_num 177

/*
* Description
* Look for the string corresponding to the key in the results of the
Expand All @@ -19,7 +23,8 @@
* If found, return 1; otherwise, return 0.
*/
static long (*bpf_km_header_strnstr)(
struct bpf_sock_addr *ctx, const char *key, int key_sz, const char *subptr, int subptr_sz) = (void *)175;
struct bpf_sock_addr *ctx, const char *key, int key_sz, const char *subptr, int subptr_sz) = (void *)
bpf_km_header_strnstr_num;

/*
* Description
Expand All @@ -30,8 +35,8 @@ static long (*bpf_km_header_strnstr)(
* Return
* If the strings are same, return 0.
*/
static long (*bpf_km_header_strncmp)(const char *key, int key_sz, const char *target, int target_sz, int opt) =
(void *)176;
static long (*bpf_km_header_strncmp)(const char *key, int key_sz, const char *target, int target_sz, int opt) = (void *)
bpf_km_header_strncmp_num;

/*
* Description
Expand All @@ -43,4 +48,4 @@ static long (*bpf_km_header_strncmp)(const char *key, int key_sz, const char *ta
* A HTTP PROTO TYPE is returned on success.
* **PROTO_UNKNOW** is returned if failure.
*/
static long (*bpf_parse_header_msg)(struct bpf_sock_addr *ctx) = (void *)177;
static long (*bpf_parse_header_msg)(struct bpf_sock_addr *ctx) = (void *)bpf_parse_header_msg_num;
2 changes: 1 addition & 1 deletion kmesh_bpf_env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ for name in ${helper_name[@]}; do
current_line=`grep -nr "FN($name)" $KERNEL_HEADER_LINUX_BPF | awk -F ":" {'print $1'}`
if [ -n "$current_line" ]; then
helper_id=`expr $current_line - $base_line`
sed -Ei "/$name/s/([0-9]+)[^0-9]*$/$helper_id;/" $ROOT_DIR/bpf/include/bpf_helper_defs_ext.h
sed -Ei "/${name}_num/s/([0-9]+)[^0-9]*$/$helper_id/" $ROOT_DIR/bpf/include/bpf_helper_defs_ext.h
fi
done
Loading