mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-05 18:39:59 +00:00
[NETFILTER]: Make NETMAP target usable in OUTPUT
Signed-off-by: Gary Wayne Smith <gary.w.smith@primeexalia.com> Signed-off-by: Patrick McHardy <kaber@trash.net> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
9baa5c67ff
commit
000efe1d86
1 changed files with 5 additions and 3 deletions
|
@ -46,7 +46,8 @@ check(const char *tablename,
|
||||||
DEBUGP(MODULENAME":check: size %u.\n", targinfosize);
|
DEBUGP(MODULENAME":check: size %u.\n", targinfosize);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (hook_mask & ~((1 << NF_IP_PRE_ROUTING) | (1 << NF_IP_POST_ROUTING))) {
|
if (hook_mask & ~((1 << NF_IP_PRE_ROUTING) | (1 << NF_IP_POST_ROUTING) |
|
||||||
|
(1 << NF_IP_LOCAL_OUT))) {
|
||||||
DEBUGP(MODULENAME":check: bad hooks %x.\n", hook_mask);
|
DEBUGP(MODULENAME":check: bad hooks %x.\n", hook_mask);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -76,12 +77,13 @@ target(struct sk_buff **pskb,
|
||||||
struct ip_nat_range newrange;
|
struct ip_nat_range newrange;
|
||||||
|
|
||||||
IP_NF_ASSERT(hooknum == NF_IP_PRE_ROUTING
|
IP_NF_ASSERT(hooknum == NF_IP_PRE_ROUTING
|
||||||
|| hooknum == NF_IP_POST_ROUTING);
|
|| hooknum == NF_IP_POST_ROUTING
|
||||||
|
|| hooknum == NF_IP_LOCAL_OUT);
|
||||||
ct = ip_conntrack_get(*pskb, &ctinfo);
|
ct = ip_conntrack_get(*pskb, &ctinfo);
|
||||||
|
|
||||||
netmask = ~(mr->range[0].min_ip ^ mr->range[0].max_ip);
|
netmask = ~(mr->range[0].min_ip ^ mr->range[0].max_ip);
|
||||||
|
|
||||||
if (hooknum == NF_IP_PRE_ROUTING)
|
if (hooknum == NF_IP_PRE_ROUTING || hooknum == NF_IP_LOCAL_OUT)
|
||||||
new_ip = (*pskb)->nh.iph->daddr & ~netmask;
|
new_ip = (*pskb)->nh.iph->daddr & ~netmask;
|
||||||
else
|
else
|
||||||
new_ip = (*pskb)->nh.iph->saddr & ~netmask;
|
new_ip = (*pskb)->nh.iph->saddr & ~netmask;
|
||||||
|
|
Loading…
Reference in a new issue