Skip to content

Instantly share code, notes, and snippets.

@liyihuang
Last active April 5, 2024 21:26
Show Gist options
  • Save liyihuang/9429f088128183a1e486b50a1d25e516 to your computer and use it in GitHub Desktop.
Save liyihuang/9429f088128183a1e486b50a1d25e516 to your computer and use it in GitHub Desktop.
#include <linux/if_ether.h>
void *data = (void*)(long)skb->data;
if (eth->h_proto == bpf_htons(ETH_P_ARP)){
char *test = (char*)(data+ETH_HLEN);
bpf_printk("its %d",*test);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment