Created
April 23, 2020 19:56
-
-
Save joestringer/9ecf8389e84decc87fb439f7a70f1b9c to your computer and use it in GitHub Desktop.
bpftrace script for gathering stack traces for dropped packets
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) 2020 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