Skip to content

Commit 44253ce

Browse files
committed
Address comment
Signed-off-by: Zhonghu Xu <[email protected]>
1 parent 70f3592 commit 44253ce

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

bpf/include/bpf_common.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -262,15 +262,13 @@ static inline void remove_kmesh_managed_ip(__u32 family, __u32 ip4, __u32 *ip6)
262262

263263
static inline bool sock_conn_from_sim(struct __sk_buff *skb)
264264
{
265-
__u16 enable_port = ENABLE_KMESH_PORT;
266-
__u16 disable_port = DISABLE_KMESH_PORT;
267265
__u16 dst_port = (__u16)(skb->remote_port >> 16);
268-
if (bpf_ntohs(dst_port) != enable_port && bpf_ntohs(dst_port) != disable_port)
266+
if (bpf_ntohs(dst_port) != ENABLE_KMESH_PORT && bpf_ntohs(dst_port) != DISABLE_KMESH_PORT)
269267
return false;
270268

271269
if (skb->protocol == AF_INET)
272270
return bpf_ntohl(skb->remote_ip4) == CONTROL_CMD_IP;
273-
// If directly read skb->remote_ip6. bpf prog load failed
271+
// If directly read skb->remote_ip6. bpf prog load would fail with permission denied.
274272
__u32 remote_ip6[4] = {0};
275273
bpf_skb_load_bytes(skb, offsetof(struct __sk_buff, remote_ip6), &remote_ip6, sizeof(remote_ip6));
276274
return (

0 commit comments

Comments
 (0)