qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: luwenpeng <lwp_1994@163.com>
To: qemu-devel@nongnu.org
Cc: jasowang@redhat.com, luwenpeng <lwp_1994@163.com>
Subject: [PATCH] tools/ebpf: Fix IPv4 fragmentation identify
Date: Fri, 21 Apr 2023 16:20:28 +0800	[thread overview]
Message-ID: <20230421082028.53579-1-lwp_1994@163.com> (raw)

The meaning of the bit flag in ip.frag_off is Don`t fragmented
When judging IPv4 is_fragmented according to ip.frag_off,
should use !(bpf_ntohs(ip.frag_off) & 0x4000) instead of !!ip.frag_off

Signed-off-by: WenPeng Lu <lwp_1994@163.com>
---
 tools/ebpf/rss.bpf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/ebpf/rss.bpf.c b/tools/ebpf/rss.bpf.c
index 20f227e2ac..e77b764f3d 100644
--- a/tools/ebpf/rss.bpf.c
+++ b/tools/ebpf/rss.bpf.c
@@ -317,7 +317,7 @@ static inline int parse_packet(struct __sk_buff *skb,
 
         info->in_src = ip.saddr;
         info->in_dst = ip.daddr;
-        info->is_fragmented = !!ip.frag_off;
+        info->is_fragmented = !(bpf_ntohs(ip.frag_off) & 0x4000);
 
         l4_protocol = ip.protocol;
         l4_offset = ip.ihl * 4;
-- 
2.30.1 (Apple Git-130)



             reply	other threads:[~2023-04-21 12:21 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-21  8:20 luwenpeng [this message]
     [not found] ` <CAGoVJZx2T6C37UTiaO5xL78vMKweJYyEVZse72t0LNv3-kV3_Q@mail.gmail.com>
2023-04-28 10:58   ` [PATCH] tools/ebpf: Fix IPv4 fragmentation identify Andrew Melnichenko
2023-04-28 11:55     ` Andrew Melnichenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230421082028.53579-1-lwp_1994@163.com \
    --to=lwp_1994@163.com \
    --cc=jasowang@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).