mirror of
https://github.com/team-infusion-developers/android_kernel_samsung_msm8976.git
synced 2024-10-03 02:11:29 +00:00
[NETFILTER]: nf_nat: remove unused argument of function allocating binding
nf_nat_rule_find, alloc_null_binding and alloc_null_binding_confirmed do not use the argument 'info', which is actually ct->nat.info. If they are necessary to access it again, we can use the argument 'ct' instead. Signed-off-by: Yasuyuki Kozakai <yasuyuki.kozakai@toshiba.co.jp> Signed-off-by: Patrick McHardy <kaber@trash.net> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
3c2ad469c3
commit
ba4c7cbadd
3 changed files with 10 additions and 25 deletions
|
@ -10,16 +10,11 @@ extern int nf_nat_rule_find(struct sk_buff **pskb,
|
||||||
unsigned int hooknum,
|
unsigned int hooknum,
|
||||||
const struct net_device *in,
|
const struct net_device *in,
|
||||||
const struct net_device *out,
|
const struct net_device *out,
|
||||||
struct nf_conn *ct,
|
struct nf_conn *ct);
|
||||||
struct nf_nat_info *info);
|
|
||||||
|
|
||||||
extern unsigned int
|
extern unsigned int
|
||||||
alloc_null_binding(struct nf_conn *ct,
|
alloc_null_binding(struct nf_conn *ct, unsigned int hooknum);
|
||||||
struct nf_nat_info *info,
|
|
||||||
unsigned int hooknum);
|
|
||||||
|
|
||||||
extern unsigned int
|
extern unsigned int
|
||||||
alloc_null_binding_confirmed(struct nf_conn *ct,
|
alloc_null_binding_confirmed(struct nf_conn *ct, unsigned int hooknum);
|
||||||
struct nf_nat_info *info,
|
|
||||||
unsigned int hooknum);
|
|
||||||
#endif /* _NF_NAT_RULE_H */
|
#endif /* _NF_NAT_RULE_H */
|
||||||
|
|
|
@ -173,9 +173,7 @@ static int ipt_dnat_checkentry(const char *tablename,
|
||||||
}
|
}
|
||||||
|
|
||||||
inline unsigned int
|
inline unsigned int
|
||||||
alloc_null_binding(struct nf_conn *ct,
|
alloc_null_binding(struct nf_conn *ct, unsigned int hooknum)
|
||||||
struct nf_nat_info *info,
|
|
||||||
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).
|
||||||
|
@ -194,9 +192,7 @@ alloc_null_binding(struct nf_conn *ct,
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int
|
unsigned int
|
||||||
alloc_null_binding_confirmed(struct nf_conn *ct,
|
alloc_null_binding_confirmed(struct nf_conn *ct, unsigned int hooknum)
|
||||||
struct nf_nat_info *info,
|
|
||||||
unsigned int hooknum)
|
|
||||||
{
|
{
|
||||||
__be32 ip
|
__be32 ip
|
||||||
= (HOOK2MANIP(hooknum) == IP_NAT_MANIP_SRC
|
= (HOOK2MANIP(hooknum) == IP_NAT_MANIP_SRC
|
||||||
|
@ -218,8 +214,7 @@ int nf_nat_rule_find(struct sk_buff **pskb,
|
||||||
unsigned int hooknum,
|
unsigned int hooknum,
|
||||||
const struct net_device *in,
|
const struct net_device *in,
|
||||||
const struct net_device *out,
|
const struct net_device *out,
|
||||||
struct nf_conn *ct,
|
struct nf_conn *ct)
|
||||||
struct nf_nat_info *info)
|
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
@ -228,7 +223,7 @@ int nf_nat_rule_find(struct sk_buff **pskb,
|
||||||
if (ret == NF_ACCEPT) {
|
if (ret == NF_ACCEPT) {
|
||||||
if (!nf_nat_initialized(ct, HOOK2MANIP(hooknum)))
|
if (!nf_nat_initialized(ct, HOOK2MANIP(hooknum)))
|
||||||
/* NUL mapping */
|
/* NUL mapping */
|
||||||
ret = alloc_null_binding(ct, info, hooknum);
|
ret = alloc_null_binding(ct, hooknum);
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
@ -80,7 +80,6 @@ nf_nat_fn(unsigned int hooknum,
|
||||||
struct nf_conn *ct;
|
struct nf_conn *ct;
|
||||||
enum ip_conntrack_info ctinfo;
|
enum ip_conntrack_info ctinfo;
|
||||||
struct nf_conn_nat *nat;
|
struct nf_conn_nat *nat;
|
||||||
struct nf_nat_info *info;
|
|
||||||
/* maniptype == SRC for postrouting. */
|
/* maniptype == SRC for postrouting. */
|
||||||
enum nf_nat_manip_type maniptype = HOOK2MANIP(hooknum);
|
enum nf_nat_manip_type maniptype = HOOK2MANIP(hooknum);
|
||||||
|
|
||||||
|
@ -129,7 +128,6 @@ nf_nat_fn(unsigned int hooknum,
|
||||||
}
|
}
|
||||||
/* Fall thru... (Only ICMPs can be IP_CT_IS_REPLY) */
|
/* Fall thru... (Only ICMPs can be IP_CT_IS_REPLY) */
|
||||||
case IP_CT_NEW:
|
case IP_CT_NEW:
|
||||||
info = &nat->info;
|
|
||||||
|
|
||||||
/* Seen it before? This can happen for loopback, retrans,
|
/* Seen it before? This can happen for loopback, retrans,
|
||||||
or local packets.. */
|
or local packets.. */
|
||||||
|
@ -138,14 +136,13 @@ nf_nat_fn(unsigned int hooknum,
|
||||||
|
|
||||||
if (unlikely(nf_ct_is_confirmed(ct)))
|
if (unlikely(nf_ct_is_confirmed(ct)))
|
||||||
/* NAT module was loaded late */
|
/* NAT module was loaded late */
|
||||||
ret = alloc_null_binding_confirmed(ct, info,
|
ret = alloc_null_binding_confirmed(ct, hooknum);
|
||||||
hooknum);
|
|
||||||
else if (hooknum == NF_IP_LOCAL_IN)
|
else if (hooknum == NF_IP_LOCAL_IN)
|
||||||
/* LOCAL_IN hook doesn't have a chain! */
|
/* LOCAL_IN hook doesn't have a chain! */
|
||||||
ret = alloc_null_binding(ct, info, hooknum);
|
ret = alloc_null_binding(ct, hooknum);
|
||||||
else
|
else
|
||||||
ret = nf_nat_rule_find(pskb, hooknum, in, out,
|
ret = nf_nat_rule_find(pskb, hooknum, in, out,
|
||||||
ct, info);
|
ct);
|
||||||
|
|
||||||
if (ret != NF_ACCEPT) {
|
if (ret != NF_ACCEPT) {
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -160,10 +157,8 @@ nf_nat_fn(unsigned int hooknum,
|
||||||
/* ESTABLISHED */
|
/* ESTABLISHED */
|
||||||
NF_CT_ASSERT(ctinfo == IP_CT_ESTABLISHED ||
|
NF_CT_ASSERT(ctinfo == IP_CT_ESTABLISHED ||
|
||||||
ctinfo == (IP_CT_ESTABLISHED+IP_CT_IS_REPLY));
|
ctinfo == (IP_CT_ESTABLISHED+IP_CT_IS_REPLY));
|
||||||
info = &nat->info;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
NF_CT_ASSERT(info);
|
|
||||||
return nf_nat_packet(ct, ctinfo, hooknum, pskb);
|
return nf_nat_packet(ct, ctinfo, hooknum, pskb);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue