Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[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>

authored by

Yasuyuki Kozakai and committed by
David S. Miller
ba4c7cba 3c2ad469

+10 -25
+3 -8
include/net/netfilter/nf_nat_rule.h
··· 10 10 unsigned int hooknum, 11 11 const struct net_device *in, 12 12 const struct net_device *out, 13 - struct nf_conn *ct, 14 - struct nf_nat_info *info); 13 + struct nf_conn *ct); 15 14 16 15 extern unsigned int 17 - alloc_null_binding(struct nf_conn *ct, 18 - struct nf_nat_info *info, 19 - unsigned int hooknum); 16 + alloc_null_binding(struct nf_conn *ct, unsigned int hooknum); 20 17 21 18 extern unsigned int 22 - alloc_null_binding_confirmed(struct nf_conn *ct, 23 - struct nf_nat_info *info, 24 - unsigned int hooknum); 19 + alloc_null_binding_confirmed(struct nf_conn *ct, unsigned int hooknum); 25 20 #endif /* _NF_NAT_RULE_H */
+4 -9
net/ipv4/netfilter/nf_nat_rule.c
··· 173 173 } 174 174 175 175 inline unsigned int 176 - alloc_null_binding(struct nf_conn *ct, 177 - struct nf_nat_info *info, 178 - unsigned int hooknum) 176 + alloc_null_binding(struct nf_conn *ct, unsigned int hooknum) 179 177 { 180 178 /* Force range to this IP; let proto decide mapping for 181 179 per-proto parts (hence not IP_NAT_RANGE_PROTO_SPECIFIED). ··· 192 194 } 193 195 194 196 unsigned int 195 - alloc_null_binding_confirmed(struct nf_conn *ct, 196 - struct nf_nat_info *info, 197 - unsigned int hooknum) 197 + alloc_null_binding_confirmed(struct nf_conn *ct, unsigned int hooknum) 198 198 { 199 199 __be32 ip 200 200 = (HOOK2MANIP(hooknum) == IP_NAT_MANIP_SRC ··· 214 218 unsigned int hooknum, 215 219 const struct net_device *in, 216 220 const struct net_device *out, 217 - struct nf_conn *ct, 218 - struct nf_nat_info *info) 221 + struct nf_conn *ct) 219 222 { 220 223 int ret; 221 224 ··· 223 228 if (ret == NF_ACCEPT) { 224 229 if (!nf_nat_initialized(ct, HOOK2MANIP(hooknum))) 225 230 /* NUL mapping */ 226 - ret = alloc_null_binding(ct, info, hooknum); 231 + ret = alloc_null_binding(ct, hooknum); 227 232 } 228 233 return ret; 229 234 }
+3 -8
net/ipv4/netfilter/nf_nat_standalone.c
··· 80 80 struct nf_conn *ct; 81 81 enum ip_conntrack_info ctinfo; 82 82 struct nf_conn_nat *nat; 83 - struct nf_nat_info *info; 84 83 /* maniptype == SRC for postrouting. */ 85 84 enum nf_nat_manip_type maniptype = HOOK2MANIP(hooknum); 86 85 ··· 128 129 } 129 130 /* Fall thru... (Only ICMPs can be IP_CT_IS_REPLY) */ 130 131 case IP_CT_NEW: 131 - info = &nat->info; 132 132 133 133 /* Seen it before? This can happen for loopback, retrans, 134 134 or local packets.. */ ··· 136 138 137 139 if (unlikely(nf_ct_is_confirmed(ct))) 138 140 /* NAT module was loaded late */ 139 - ret = alloc_null_binding_confirmed(ct, info, 140 - hooknum); 141 + ret = alloc_null_binding_confirmed(ct, hooknum); 141 142 else if (hooknum == NF_IP_LOCAL_IN) 142 143 /* LOCAL_IN hook doesn't have a chain! */ 143 - ret = alloc_null_binding(ct, info, hooknum); 144 + ret = alloc_null_binding(ct, hooknum); 144 145 else 145 146 ret = nf_nat_rule_find(pskb, hooknum, in, out, 146 - ct, info); 147 + ct); 147 148 148 149 if (ret != NF_ACCEPT) { 149 150 return ret; ··· 157 160 /* ESTABLISHED */ 158 161 NF_CT_ASSERT(ctinfo == IP_CT_ESTABLISHED || 159 162 ctinfo == (IP_CT_ESTABLISHED+IP_CT_IS_REPLY)); 160 - info = &nat->info; 161 163 } 162 164 163 - NF_CT_ASSERT(info); 164 165 return nf_nat_packet(ct, ctinfo, hooknum, pskb); 165 166 } 166 167