Skip to contentSkip to conversation

Splitting network packets from target modules

DISCUSSION arif 2 participants 2 messages Nov 15, 2012

Subsystems (2)
lore
Share & tools
lore

arif

author
#0 lore raw

Hi,

I'm trying to write a target module which will do the following :

1) oldskb will be cached.
2) newskb1,newskb2....newskbn will be allocated and initialized.
3) packet will be dropped using NF_DROP
4) Newskbs will be sent to L4(target will work from PREROUTING hook)

But i'm confused how i'm going to send these new skbs to uplink. returning NF_ACCEPT will not do the trick i guess.

Is there any existing target module which tries to do send multiple skbs to uplink?

cheers
arif

#1 lore raw
Quoted 5 lines · On Thu, 15 Nov 2012 19:14:44 +0600 arif <[email protected]> wrote:

But i'm confused how i'm going to send these new skbs to uplink. returning NF_ACCEPT will not do the trick i guess.

Is there any existing target module which tries to do send multiple skbs to uplink?

I'd guess TEE would be the right place to look at since it creates another packet and sends it on. But beware, it's buggy in current kernels, a fix by Eric Dumazet is required:

net/netfilter/xt_TEE.c +0 -0
index ee2e5bc..bd93e51 100644
@@ -70,6 +70,7 @@ tee_tg_route4(struct sk_buff *skb, const struct

xt_tee_tginfo *info) fl4.daddr = info->gw.ip;
fl4.flowi4_tos = RT_TOS(iph->tos);
fl4.flowi4_scope = RT_SCOPE_UNIVERSE;
+ fl4.flowi4_flags = FLOWI_FLAG_KNOWN_NH;
rt = ip_route_output_key(net, &fl4);
if (IS_ERR(rt))
return false;

Hope that helps,
Torsten