Skip to content

Instantly share code, notes, and snippets.

@strizhechenko
Created August 29, 2019 09:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save strizhechenko/f9f3eb0d03d11f64267b9ea1f65dd837 to your computer and use it in GitHub Desktop.
Save strizhechenko/f9f3eb0d03d11f64267b9ea1f65dd837 to your computer and use it in GitHub Desktop.
static void print_skb_stuff(const struct sk_buff *skb)
{
struct tcphdr _tcph;
const struct tcphdr *tcph;
tcph = skb_header_pointer(skb, ip_hdrlen(skb),
sizeof(_tcph), &_tcph);
printk("syn=%u ack=%u psh=%u fin=%u seq=%u ack_seq=%u skb->len %u csum=%x\n",
tcph->syn,
tcph->ack,
tcph->psh,
tcph->fin,
ntohl(tcph->ack_seq),
ntohl(tcph->seq),
skb->len,
tcph->check
);
return;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment