ktrace-CO-RE: ktrace01_kern.c print more info from SKB

Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com>
This commit is contained in:
Jesper Dangaard Brouer
2021-06-24 09:02:17 +02:00
parent 21d5dc3961
commit 4dc38c35b9

View File

@@ -35,11 +35,13 @@ SEC("kprobe/udp_send_skb")
int BPF_KPROBE(udp_send_skb, struct sk_buff *skb)
//int udp_send_skb(struct pt_regs *ctx)
{
unsigned int len;
__u32 h;
BPF_CORE_READ_INTO(&h, skb, hash); /* skb->hash */
BPF_CORE_READ_INTO(&h, skb, hash); /* skb->hash */
BPF_CORE_READ_INTO(&len, skb, len); /* skb->len */
bpf_printk("skb->hash = 0x%x ", h);
bpf_printk("skb->hash=0x%x len=%d", h, len);
return 0;
}