mirror of
https://github.com/adulau/aha.git
synced 2025-01-01 05:36:24 +00:00
netfilter: arptables in netns for real
IN, FORWARD -- grab netns from in device, OUT -- from out device. Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com> Signed-off-by: Patrick McHardy <kaber@trash.net> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
f858b4869a
commit
3918fed5f3
1 changed files with 30 additions and 9 deletions
|
@ -55,32 +55,53 @@ static struct xt_table packet_filter = {
|
||||||
};
|
};
|
||||||
|
|
||||||
/* The work comes in here from netfilter.c */
|
/* The work comes in here from netfilter.c */
|
||||||
static unsigned int arpt_hook(unsigned int hook,
|
static unsigned int arpt_in_hook(unsigned int hook,
|
||||||
struct sk_buff *skb,
|
struct sk_buff *skb,
|
||||||
const struct net_device *in,
|
const struct net_device *in,
|
||||||
const struct net_device *out,
|
const struct net_device *out,
|
||||||
int (*okfn)(struct sk_buff *))
|
int (*okfn)(struct sk_buff *))
|
||||||
{
|
{
|
||||||
return arpt_do_table(skb, hook, in, out, init_net.ipv4.arptable_filter);
|
return arpt_do_table(skb, hook, in, out,
|
||||||
|
dev_net(in)->ipv4.arptable_filter);
|
||||||
|
}
|
||||||
|
|
||||||
|
static unsigned int arpt_out_hook(unsigned int hook,
|
||||||
|
struct sk_buff *skb,
|
||||||
|
const struct net_device *in,
|
||||||
|
const struct net_device *out,
|
||||||
|
int (*okfn)(struct sk_buff *))
|
||||||
|
{
|
||||||
|
return arpt_do_table(skb, hook, in, out,
|
||||||
|
dev_net(out)->ipv4.arptable_filter);
|
||||||
|
}
|
||||||
|
|
||||||
|
static unsigned int arpt_forward_hook(unsigned int hook,
|
||||||
|
struct sk_buff *skb,
|
||||||
|
const struct net_device *in,
|
||||||
|
const struct net_device *out,
|
||||||
|
int (*okfn)(struct sk_buff *))
|
||||||
|
{
|
||||||
|
return arpt_do_table(skb, hook, in, out,
|
||||||
|
dev_net(in)->ipv4.arptable_filter);
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct nf_hook_ops arpt_ops[] __read_mostly = {
|
static struct nf_hook_ops arpt_ops[] __read_mostly = {
|
||||||
{
|
{
|
||||||
.hook = arpt_hook,
|
.hook = arpt_in_hook,
|
||||||
.owner = THIS_MODULE,
|
.owner = THIS_MODULE,
|
||||||
.pf = NF_ARP,
|
.pf = NF_ARP,
|
||||||
.hooknum = NF_ARP_IN,
|
.hooknum = NF_ARP_IN,
|
||||||
.priority = NF_IP_PRI_FILTER,
|
.priority = NF_IP_PRI_FILTER,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.hook = arpt_hook,
|
.hook = arpt_out_hook,
|
||||||
.owner = THIS_MODULE,
|
.owner = THIS_MODULE,
|
||||||
.pf = NF_ARP,
|
.pf = NF_ARP,
|
||||||
.hooknum = NF_ARP_OUT,
|
.hooknum = NF_ARP_OUT,
|
||||||
.priority = NF_IP_PRI_FILTER,
|
.priority = NF_IP_PRI_FILTER,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.hook = arpt_hook,
|
.hook = arpt_forward_hook,
|
||||||
.owner = THIS_MODULE,
|
.owner = THIS_MODULE,
|
||||||
.pf = NF_ARP,
|
.pf = NF_ARP,
|
||||||
.hooknum = NF_ARP_FORWARD,
|
.hooknum = NF_ARP_FORWARD,
|
||||||
|
|
Loading…
Reference in a new issue