-
Notifications
You must be signed in to change notification settings - Fork 162
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Print drop reason from kfree_skb_reason
This commit extracts a drop reason from kfree_skb_reason(), and prints it when kfree_skb_reason() is called. The helper was introduced in the v5.17. The second function param of it contains a drop reason which is the "skb_drop_reason" enum. To extract enum, we parse the kernel's BTF, as the enum is not considered as UAPI, and there were already some position changes among its values. An example output: 0xffff936378692ce8 6 [curl] nf_hook_slow 172.20.10.2:33918->1.1.1.1:4240(tcp) 0xffff936378692ce8 6 [curl] kfree_skb_reason(SKB_DROP_REASON_NETFILTER_DROP) 172.20.10.2:33918->1.1.1.1:4240(tcp) An alternative approach to passing the second param would have been to set a BPF cookie when attaching the kprobe to the kfree_skb_reason(). However, that would require creating a new bpf/kprobe_pwru*.c, as the helper bpf_get_attach_cookie() requires the bpf_link support, and thus a newer kernel than the v5.3 (min required by pwru). Signed-off-by: Martynas Pumputis <m@lambda.lt>
- Loading branch information
Showing
4 changed files
with
47 additions
and
3 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -116,6 +116,7 @@ type Event struct { | |
Meta Meta | ||
Tuple Tuple | ||
PrintStackId int64 | ||
ParamSecond uint64 | ||
CPU uint32 | ||
} | ||
|
||
|
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