Skip to contentSkip to conversation

Is it ok to create copies of sk_buff in PRE_ROUTING hook and call okfn(sk_buff_ptr) to forward it to multiple machines ?

DISCUSSION Rohit 1 participant 1 message Dec 19, 2007 netfilter

lore
Share & tools
lore

Rohit

author
#0 lore raw

HI all,
I am working on a task which requires my netfilter based kernel module (hooks at PRE_ROUTING and POST_ROUTING) to send same tcp packet to multiple machines. What i have done in my hook is sk_buff_ptr = pskb_copy(pskb) ; where pskb is original packet passed to my hook function @ PRE_ROUTING by netfilter layer. and after modifying ip address and ports
i do okfn(sk_buff_ptr). This is working and i am getting the desired output.

But i am not sure if this is correct way to do this kind of job ??
Or is there any other mechanism to achieve same.?? I want make sure that the cloned packets travel the correct path in networking code and not bypass something important.From what i have understood okfn function will be anyway called with packet pointer passed to it (ip_rcv_finish or similar) after the hooks . So this should not be an issue but need confirmation/correction from netfilter community.

Thanks,
Rohit