Created
June 24, 2020 21:34
-
-
Save joestringer/4db12af8fef5df3bdfa39d01702313cb to your computer and use it in GitHub Desktop.
Collect stack traces for dropped packets and print them after ^C
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bpftrace | |
/* | |
* skb_free.bt Trace skb drops when the socket is associated with the skb. | |
* For Linux, uses bpftrace and eBPF. | |
* | |
* USAGE: skb_free.bt | |
* | |
* Copyright (c) 2019 Joe Stringer. | |
* Licensed under the Apache License, Version 2.0 (the "License") | |
* | |
* 08-May-2019 Joe Stringer created this. | |
*/ | |
#include <linux/netdevice.h> | |
#include <linux/skbuff.h> | |
kprobe:kfree_skb { | |
$skb = (struct sk_buff *)arg0; | |
$sk = $skb->sk; | |
if ($sk) { | |
@ip4_stacks[kstack] = count(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment