Brand New Day
It’s a brand new day with no novelty! Back to the lab today trying to now get access to the packet data to calculate the hash values. I suspect that inside netfilter’s sk_buff structure there’s an unsigned char* data field. This probably is exactly what I need to get the hash values. There’s this awesome link which has great information about sk_buff structure. The unsigned int len; has the size of the complete input data including the headers. I guess if this len value == size of the actual data for the IP header (which could be TCP header / UDP header / ICMP header) then if we are using chunks of this data to find hashes then the following algorithm could be used:
no_of_chunks = len / BYTE_SIZE_FOR_SIGN;
addendum = len % BYTE_SIZE_FOR_SIGN;
for (int i = 0; i < no_of_chunks; i++)
{
storeInTable(hashRabin(data,i*BYTE_SIZE_FOR_SIGN,
(i+1)*BYTE_SIZE_FOR_SIGN - 1 ,0));
}
storeInTable(
hashRabin(data,no_of_chunks*BYTE_SIZE_FOR_SIGN,
no_of_chunks*BYTE_SIZE_FOR_SIGN+addendum, 0)
);
This are my initial thoughts let’s see how it works out!
-Rajat.
Rajat’s Homepage