Last active
August 23, 2024 05:04
-
-
Save larsks/bb9e7d046a5a6fe87baae44720d4866b to your computer and use it in GitHub Desktop.
Track routing decisions made by fib_validate_source
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
kprobe:fib_validate_source { | |
$skb = (struct sk_buff*) arg0; | |
@skb[tid] = $skb; | |
@ipheader[tid] = ((struct iphdr *) ($skb->head + $skb->network_header)); | |
} | |
kretprobe:fib_validate_source { | |
$skb = @skb[tid]; | |
$ipheader = @ipheader[tid]; | |
$version = $ipheader->version; | |
// 0xe9051eac is "172.30.5.233" in little-endian byte order. Replace this with an appropriate | |
// value. | |
if ((uint32)$ipheader->daddr == 0xe9051eac) { | |
printf("%dv%d | %s:%s -> %d\n", $ipheader->protocol, $version, | |
ntop($ipheader->saddr), ntop($ipheader->daddr), retval); | |
} | |
delete(@ipheader[tid]); | |
delete(@skb[tid]); | |
} | |
END { | |
clear(@ipheader); | |
clear(@skb); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment