Skip to content

Instantly share code, notes, and snippets.

@hillar
Created August 4, 2016 05:27
Show Gist options
  • Save hillar/114ae4c7dedb7061f284288884ab2f0c to your computer and use it in GitHub Desktop.
Save hillar/114ae4c7dedb7061f284288884ab2f0c to your computer and use it in GitHub Desktop.
unsigned int ip_total_len = (unsigned int)ntohs((ip_hdr->ip_len));
unsigned int real_len = 14 + ip_total_len;
unsigned int dif = (*pkthdr)->caplen - real_len;
if (dif > 0 && dif < 32)
{
(*pkthdr)->caplen -= dif;
(*pkthdr)->len -= dif;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment