forked from kmesh-net/kmesh
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathkmesh_bpf_env.sh
More file actions
25 lines (22 loc) · 765 Bytes
/
kmesh_bpf_env.sh
File metadata and controls
25 lines (22 loc) · 765 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/bin/bash
ROOT_DIR=$(dirname $(readlink -f ${BASH_SOURCE[0]}))
VERSION=$(uname -r | cut -d '.' -f 1,2)
OE_VERSION=$(uname -r | grep -o 'oe[^.]*')
# new bpf helper functions name in the kernel, if there are any new functions
# added in the future, please add them to the list.
helper_name=(
strncpy
strnstr
strnlen
_strncmp
parse_header_msg
get_msg_header_element
)
base_line=`grep -nr "FN(unspec)" $KERNEL_HEADER_LINUX_BPF | awk -F ":" {'print $1'}`
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
fi
done