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

[NETFILTER]: kill __ip_ct_expect_unlink_destroy

The following patch kills __ip_ct_expect_unlink_destroy and export
unlink_expect as ip_ct_unlink_expect. As it was discussed [1], the function
__ip_ct_expect_unlink_destroy is a bit confusing so better do the following
sequence: ip_ct_destroy_expect and ip_conntrack_expect_put.

[1] https://lists.netfilter.org/pipermail/netfilter-devel/2005-August/020794.html

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Pablo Neira Ayuso and committed by
David S. Miller
49719eb3 91c46e2e

+17 -19
+1 -1
include/linux/netfilter_ipv4/ip_conntrack_core.h
··· 52 52 return ret; 53 53 } 54 54 55 - extern void __ip_ct_expect_unlink_destroy(struct ip_conntrack_expect *exp); 55 + extern void ip_ct_unlink_expect(struct ip_conntrack_expect *exp); 56 56 57 57 extern struct list_head *ip_conntrack_hash; 58 58 extern struct list_head ip_conntrack_expect_list;
+7 -13
net/ipv4/netfilter/ip_conntrack_core.c
··· 197 197 198 198 199 199 /* ip_conntrack_expect helper functions */ 200 - static void unlink_expect(struct ip_conntrack_expect *exp) 200 + void ip_ct_unlink_expect(struct ip_conntrack_expect *exp) 201 201 { 202 202 ASSERT_WRITE_LOCK(&ip_conntrack_lock); 203 203 IP_NF_ASSERT(!timer_pending(&exp->timeout)); ··· 207 207 ip_conntrack_expect_put(exp); 208 208 } 209 209 210 - void __ip_ct_expect_unlink_destroy(struct ip_conntrack_expect *exp) 211 - { 212 - unlink_expect(exp); 213 - ip_conntrack_expect_put(exp); 214 - } 215 - 216 210 static void expectation_timed_out(unsigned long ul_expect) 217 211 { 218 212 struct ip_conntrack_expect *exp = (void *)ul_expect; 219 213 220 214 write_lock_bh(&ip_conntrack_lock); 221 - unlink_expect(exp); 215 + ip_ct_unlink_expect(exp); 222 216 write_unlock_bh(&ip_conntrack_lock); 223 217 ip_conntrack_expect_put(exp); 224 218 } ··· 263 269 atomic_inc(&i->use); 264 270 return i; 265 271 } else if (del_timer(&i->timeout)) { 266 - unlink_expect(i); 272 + ip_ct_unlink_expect(i); 267 273 return i; 268 274 } 269 275 } ··· 282 288 283 289 list_for_each_entry_safe(i, tmp, &ip_conntrack_expect_list, list) { 284 290 if (i->master == ct && del_timer(&i->timeout)) { 285 - unlink_expect(i); 291 + ip_ct_unlink_expect(i); 286 292 ip_conntrack_expect_put(i); 287 293 } 288 294 } ··· 923 929 /* choose the the oldest expectation to evict */ 924 930 list_for_each_entry_reverse(i, &ip_conntrack_expect_list, list) { 925 931 if (expect_matches(i, exp) && del_timer(&i->timeout)) { 926 - unlink_expect(i); 932 + ip_ct_unlink_expect(i); 927 933 write_unlock_bh(&ip_conntrack_lock); 928 934 ip_conntrack_expect_put(i); 929 935 return; ··· 980 986 list_for_each_entry_reverse(i, &ip_conntrack_expect_list, list) { 981 987 if (i->master == master) { 982 988 if (del_timer(&i->timeout)) { 983 - unlink_expect(i); 989 + ip_ct_unlink_expect(i); 984 990 ip_conntrack_expect_put(i); 985 991 } 986 992 break; ··· 1097 1103 /* Get rid of expectations */ 1098 1104 list_for_each_entry_safe(exp, tmp, &ip_conntrack_expect_list, list) { 1099 1105 if (exp->master->helper == me && del_timer(&exp->timeout)) { 1100 - unlink_expect(exp); 1106 + ip_ct_unlink_expect(exp); 1101 1107 ip_conntrack_expect_put(exp); 1102 1108 } 1103 1109 }
+8 -4
net/ipv4/netfilter/ip_conntrack_netlink.c
··· 1349 1349 list_for_each_entry_safe(exp, tmp, &ip_conntrack_expect_list, 1350 1350 list) { 1351 1351 if (exp->master->helper == h 1352 - && del_timer(&exp->timeout)) 1353 - __ip_ct_expect_unlink_destroy(exp); 1352 + && del_timer(&exp->timeout)) { 1353 + ip_ct_unlink_expect(exp); 1354 + ip_conntrack_expect_put(exp); 1355 + } 1354 1356 } 1355 1357 write_unlock(&ip_conntrack_lock); 1356 1358 } else { ··· 1360 1358 write_lock_bh(&ip_conntrack_lock); 1361 1359 list_for_each_entry_safe(exp, tmp, &ip_conntrack_expect_list, 1362 1360 list) { 1363 - if (del_timer(&exp->timeout)) 1364 - __ip_ct_expect_unlink_destroy(exp); 1361 + if (del_timer(&exp->timeout)) { 1362 + ip_ct_unlink_expect(exp); 1363 + ip_conntrack_expect_put(exp); 1364 + } 1365 1365 } 1366 1366 write_unlock_bh(&ip_conntrack_lock); 1367 1367 }
+1 -1
net/ipv4/netfilter/ip_conntrack_standalone.c
··· 998 998 EXPORT_SYMBOL(ip_conntrack_unexpect_related); 999 999 EXPORT_SYMBOL_GPL(ip_conntrack_expect_list); 1000 1000 EXPORT_SYMBOL_GPL(__ip_conntrack_expect_find); 1001 - EXPORT_SYMBOL_GPL(__ip_ct_expect_unlink_destroy); 1001 + EXPORT_SYMBOL_GPL(ip_ct_unlink_expect); 1002 1002 1003 1003 EXPORT_SYMBOL(ip_conntrack_tuple_taken); 1004 1004 EXPORT_SYMBOL(ip_ct_gather_frags);