From: Aft nix <aftnix@gmail.com>
To: Netfilter Developer Mailing List <netfilter-devel@vger.kernel.org>
Subject: Target extension with nf_hooks
Date: Sun, 11 Nov 2012 16:56:14 +0600 [thread overview]
Message-ID: <CAGuaRCtEa2VGPb3-jYvuK9+t++L44xTeOm15xpsFXmzLHoui3g@mail.gmail.com> (raw)
Hi,
Is there any technical difficulties associated with the following scenario:
1) its invoked with $iptables -t mangle -A PREROUTING -j MY_TARGET
2) My target module is initialized as :
static struct xt_target obsf_tg_reg __read_mostly = {
.name = "OBSF",
.family = NFPROTO_UNSPEC,
.target = obsf_tg,
.checkentry = obsf_tg_check,
.targetsize = sizeof(struct xt_OBSF_tginfo),
.me = THIS_MODULE,
};
static int __init obsf_tg_init(void)
{
return xt_register_target(&obsf_tg_reg);
}
2) Now inside the module, it also registers a nf_hook:
static struct nf_hook_ops inward_obsf_ops __read_mostly = {
.pf = NFPROTO_IPV4,
.priority = 1,
.hooknum = NF_INET_PRE_ROUTING,
.hook = ibss_obsf_inward_begin,
};
/*
* Module init and exit functions
* No need ot worry about them
*/
static int __init ibss_obsf_inward_init(void)
{
printk(KERN_ALERT "\nPacket_Inward module started ...");
return nf_register_hook(&inward_obsf_ops);
}
My question is
a) Between ibss_obsf_inward_begin() and obsf_tg() who will be called first?
b) Does this design lead to any inconsistencies?
c) Should i register ibss_ofsf_inward_begin() with different hook ,
say NF_INET_LOCAL_INPUT?
Only example i could find inside 3.7.rc3 kernel tree is :
net/ipv4/ipt_CLUSTERIP.c:540
540 static struct nf_hook_ops cip_arp_ops __read_mostly = {
541 .hook = arp_mangle,
542 .pf = NFPROTO_ARP,
543 .hooknum = NF_ARP_OUT,
544 .priority = -1
545 };
I'm not sure i can do the same for ordinary netfilter module.
--
-aft
next reply other threads:[~2012-11-11 10:56 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-11 10:56 Aft nix [this message]
2012-11-11 13:36 ` Target extension with nf_hooks Jan Engelhardt
2012-11-11 14:47 ` Aft nix
2012-11-11 17:15 ` Jan Engelhardt
2012-12-02 10:58 ` arif
2012-12-04 18:17 ` Jan Engelhardt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAGuaRCtEa2VGPb3-jYvuK9+t++L44xTeOm15xpsFXmzLHoui3g@mail.gmail.com \
--to=aftnix@gmail.com \
--cc=netfilter-devel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).