Skip to contentSkip to conversation

using netfilter hooks (in not the intended way)

DISCUSSION Ian Norton 1 participant 2 messages Feb 24, 2005 – Feb 25, 2005 netfilter

lore
Share & tools
lore

Ian Norton

author
#0 lore raw

Hi everyone,

I hope somoene can give me some pointers here, Im writing an implementation of ipcomp for 2.4.x using netfilter hooks instead of the normal way new protocols are handled, I know it's not what netfilter is intended to do, but, the main idea here is that it is one of those 'there is more than one way to do stuff' exercizes for a university project.

basically, my problem is this, when recieving a compressed packet, i want to decompress it, expand the skb and memcpy the decompressed data into the skb.

now, i seem to be able to do all this, if i make a clone of this skb and send it using dev_queue_xmit or netif_rx() then it turns up where i want it (albiet later than i would like and requireing some link layer header stuff)

i really want to return the 'modified' skb back to netfilter with NF_ACCEPT however if i do a pskb_expand_head() on it, then it is as if i did nothing to the packet after calling pskb_expand_head().

afaik, pskb_expand_head() will create a copy of the skb if it needs to, how can i make sure that netfilter will see this new larger copy?

thanks in advance

regards

Ian

author
#1 lore raw
Quoted 17 lines · Ian Norton

Hi everyone,

I hope somoene can give me some pointers here, Im writing an implementation of ipcomp for 2.4.x using netfilter hooks instead of the normal way new protocols are handled, I know it's not what netfilter is intended to do, but, the main idea here is that it is one of those 'there is more than one way to do stuff' exercizes for a university project.

basically, my problem is this, when recieving a compressed packet, i want to decompress it, expand the skb and memcpy the decompressed data into the skb.

now, i seem to be able to do all this, if i make a clone of this skb and send it using dev_queue_xmit or netif_rx() then it turns up where i want it (albiet later than i would like and requireing some link layer header stuff)

Quoted 6 lines

i really want to return the 'modified' skb back to netfilter with NF_ACCEPT however if i do a pskb_expand_head() on it, then it is as if i did nothing to the packet after calling pskb_expand_head().

afaik, pskb_expand_head() will create a copy of the skb if it needs to, how can i make sure that netfilter will see this new larger copy?

If I cant do that, is there a way to 'replace' the current packet with a new one (so that subsequent hookfns get the new packet instead)?

By any chance, are the skb's sent to hookfns cloned? if so, would this mean i can alter as much as i like in the skb->data area, but anything outside of the original skb's data area will get lost ?

Ian