Commit ed0b6d75 authored by Changli Gao's avatar Changli Gao Committed by Patrick McHardy

netfilter: nf_nat: no IP_NAT_RANGE_MAP_IPS flags when alloc_null_binding()

When alloc_null_binding(), no IP_NAT_RNAGE_MAP_IPS in flags means no IP address
translation is needed. It isn't necessary to specify the address explicitly.
Signed-off-by: default avatarChangli Gao <xiaosuo@gmail.com>
Signed-off-by: default avatarPatrick McHardy <kaber@trash.net>
parent 99ad3c53
...@@ -106,16 +106,15 @@ alloc_null_binding(struct nf_conn *ct, unsigned int hooknum) ...@@ -106,16 +106,15 @@ alloc_null_binding(struct nf_conn *ct, unsigned int hooknum)
{ {
/* Force range to this IP; let proto decide mapping for /* Force range to this IP; let proto decide mapping for
per-proto parts (hence not IP_NAT_RANGE_PROTO_SPECIFIED). per-proto parts (hence not IP_NAT_RANGE_PROTO_SPECIFIED).
Use reply in case it's already been mangled (eg local packet).
*/ */
__be32 ip struct nf_nat_range range;
= (HOOK2MANIP(hooknum) == IP_NAT_MANIP_SRC
? ct->tuplehash[IP_CT_DIR_REPLY].tuple.dst.u3.ip range.flags = 0;
: ct->tuplehash[IP_CT_DIR_REPLY].tuple.src.u3.ip); pr_debug("Allocating NULL binding for %p (%pI4)\n", ct,
struct nf_nat_range range HOOK2MANIP(hooknum) == IP_NAT_MANIP_SRC ?
= { IP_NAT_RANGE_MAP_IPS, ip, ip, { 0 }, { 0 } }; &ct->tuplehash[IP_CT_DIR_REPLY].tuple.dst.u3.ip :
&ct->tuplehash[IP_CT_DIR_REPLY].tuple.src.u3.ip);
pr_debug("Allocating NULL binding for %p (%pI4)\n", ct, &ip);
return nf_nat_setup_info(ct, &range, HOOK2MANIP(hooknum)); return nf_nat_setup_info(ct, &range, HOOK2MANIP(hooknum));
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment