Skip to contentSkip to conversation

ow to intercept an udp packet sent by a socket in a Netfilter module

DISCUSSION Olivier GRALL 1 participant 1 message Dec 23, 2004 netfilter

lore
Share & tools
lore
#0 lore raw

Hello

I'm writing a little module using netfilter. I want to catch an UDP packet sended by a socket and to change its source port without conntrack see the changes. I want to do it on the POSTROUTING Hook but I don't see any packets from a socket in my module logs.

So I want to know how to capture packets coming from a local socket in POSTROUTING.

For the moment, I register like this:
static struct nf_hook_ops ipt_ops_out =

   {
     { NULL, NULL},
     ms_media_hook_out,
     THIS_MODULE,
     PF_INET,
     NF_IP_POST_ROUTING,
     NF_IP_PRI_NAT_SRC+1

};

Thanks,

Olivier GRALL