[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>
This commit is contained in:
parent
91c46e2e60
commit
49719eb355
|
@ -52,7 +52,7 @@ static inline int ip_conntrack_confirm(struct sk_buff **pskb)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern void __ip_ct_expect_unlink_destroy(struct ip_conntrack_expect *exp);
|
extern void ip_ct_unlink_expect(struct ip_conntrack_expect *exp);
|
||||||
|
|
||||||
extern struct list_head *ip_conntrack_hash;
|
extern struct list_head *ip_conntrack_hash;
|
||||||
extern struct list_head ip_conntrack_expect_list;
|
extern struct list_head ip_conntrack_expect_list;
|
||||||
|
|
|
@ -197,7 +197,7 @@ ip_ct_invert_tuple(struct ip_conntrack_tuple *inverse,
|
||||||
|
|
||||||
|
|
||||||
/* ip_conntrack_expect helper functions */
|
/* ip_conntrack_expect helper functions */
|
||||||
static void unlink_expect(struct ip_conntrack_expect *exp)
|
void ip_ct_unlink_expect(struct ip_conntrack_expect *exp)
|
||||||
{
|
{
|
||||||
ASSERT_WRITE_LOCK(&ip_conntrack_lock);
|
ASSERT_WRITE_LOCK(&ip_conntrack_lock);
|
||||||
IP_NF_ASSERT(!timer_pending(&exp->timeout));
|
IP_NF_ASSERT(!timer_pending(&exp->timeout));
|
||||||
|
@ -207,18 +207,12 @@ static void unlink_expect(struct ip_conntrack_expect *exp)
|
||||||
ip_conntrack_expect_put(exp);
|
ip_conntrack_expect_put(exp);
|
||||||
}
|
}
|
||||||
|
|
||||||
void __ip_ct_expect_unlink_destroy(struct ip_conntrack_expect *exp)
|
|
||||||
{
|
|
||||||
unlink_expect(exp);
|
|
||||||
ip_conntrack_expect_put(exp);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void expectation_timed_out(unsigned long ul_expect)
|
static void expectation_timed_out(unsigned long ul_expect)
|
||||||
{
|
{
|
||||||
struct ip_conntrack_expect *exp = (void *)ul_expect;
|
struct ip_conntrack_expect *exp = (void *)ul_expect;
|
||||||
|
|
||||||
write_lock_bh(&ip_conntrack_lock);
|
write_lock_bh(&ip_conntrack_lock);
|
||||||
unlink_expect(exp);
|
ip_ct_unlink_expect(exp);
|
||||||
write_unlock_bh(&ip_conntrack_lock);
|
write_unlock_bh(&ip_conntrack_lock);
|
||||||
ip_conntrack_expect_put(exp);
|
ip_conntrack_expect_put(exp);
|
||||||
}
|
}
|
||||||
|
@ -269,7 +263,7 @@ find_expectation(const struct ip_conntrack_tuple *tuple)
|
||||||
atomic_inc(&i->use);
|
atomic_inc(&i->use);
|
||||||
return i;
|
return i;
|
||||||
} else if (del_timer(&i->timeout)) {
|
} else if (del_timer(&i->timeout)) {
|
||||||
unlink_expect(i);
|
ip_ct_unlink_expect(i);
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -288,7 +282,7 @@ void ip_ct_remove_expectations(struct ip_conntrack *ct)
|
||||||
|
|
||||||
list_for_each_entry_safe(i, tmp, &ip_conntrack_expect_list, list) {
|
list_for_each_entry_safe(i, tmp, &ip_conntrack_expect_list, list) {
|
||||||
if (i->master == ct && del_timer(&i->timeout)) {
|
if (i->master == ct && del_timer(&i->timeout)) {
|
||||||
unlink_expect(i);
|
ip_ct_unlink_expect(i);
|
||||||
ip_conntrack_expect_put(i);
|
ip_conntrack_expect_put(i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -929,7 +923,7 @@ void ip_conntrack_unexpect_related(struct ip_conntrack_expect *exp)
|
||||||
/* choose the the oldest expectation to evict */
|
/* choose the the oldest expectation to evict */
|
||||||
list_for_each_entry_reverse(i, &ip_conntrack_expect_list, list) {
|
list_for_each_entry_reverse(i, &ip_conntrack_expect_list, list) {
|
||||||
if (expect_matches(i, exp) && del_timer(&i->timeout)) {
|
if (expect_matches(i, exp) && del_timer(&i->timeout)) {
|
||||||
unlink_expect(i);
|
ip_ct_unlink_expect(i);
|
||||||
write_unlock_bh(&ip_conntrack_lock);
|
write_unlock_bh(&ip_conntrack_lock);
|
||||||
ip_conntrack_expect_put(i);
|
ip_conntrack_expect_put(i);
|
||||||
return;
|
return;
|
||||||
|
@ -986,7 +980,7 @@ static void evict_oldest_expect(struct ip_conntrack *master)
|
||||||
list_for_each_entry_reverse(i, &ip_conntrack_expect_list, list) {
|
list_for_each_entry_reverse(i, &ip_conntrack_expect_list, list) {
|
||||||
if (i->master == master) {
|
if (i->master == master) {
|
||||||
if (del_timer(&i->timeout)) {
|
if (del_timer(&i->timeout)) {
|
||||||
unlink_expect(i);
|
ip_ct_unlink_expect(i);
|
||||||
ip_conntrack_expect_put(i);
|
ip_conntrack_expect_put(i);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -1103,7 +1097,7 @@ void ip_conntrack_helper_unregister(struct ip_conntrack_helper *me)
|
||||||
/* Get rid of expectations */
|
/* Get rid of expectations */
|
||||||
list_for_each_entry_safe(exp, tmp, &ip_conntrack_expect_list, list) {
|
list_for_each_entry_safe(exp, tmp, &ip_conntrack_expect_list, list) {
|
||||||
if (exp->master->helper == me && del_timer(&exp->timeout)) {
|
if (exp->master->helper == me && del_timer(&exp->timeout)) {
|
||||||
unlink_expect(exp);
|
ip_ct_unlink_expect(exp);
|
||||||
ip_conntrack_expect_put(exp);
|
ip_conntrack_expect_put(exp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1349,8 +1349,10 @@ ctnetlink_del_expect(struct sock *ctnl, struct sk_buff *skb,
|
||||||
list_for_each_entry_safe(exp, tmp, &ip_conntrack_expect_list,
|
list_for_each_entry_safe(exp, tmp, &ip_conntrack_expect_list,
|
||||||
list) {
|
list) {
|
||||||
if (exp->master->helper == h
|
if (exp->master->helper == h
|
||||||
&& del_timer(&exp->timeout))
|
&& del_timer(&exp->timeout)) {
|
||||||
__ip_ct_expect_unlink_destroy(exp);
|
ip_ct_unlink_expect(exp);
|
||||||
|
ip_conntrack_expect_put(exp);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
write_unlock(&ip_conntrack_lock);
|
write_unlock(&ip_conntrack_lock);
|
||||||
} else {
|
} else {
|
||||||
|
@ -1358,8 +1360,10 @@ ctnetlink_del_expect(struct sock *ctnl, struct sk_buff *skb,
|
||||||
write_lock_bh(&ip_conntrack_lock);
|
write_lock_bh(&ip_conntrack_lock);
|
||||||
list_for_each_entry_safe(exp, tmp, &ip_conntrack_expect_list,
|
list_for_each_entry_safe(exp, tmp, &ip_conntrack_expect_list,
|
||||||
list) {
|
list) {
|
||||||
if (del_timer(&exp->timeout))
|
if (del_timer(&exp->timeout)) {
|
||||||
__ip_ct_expect_unlink_destroy(exp);
|
ip_ct_unlink_expect(exp);
|
||||||
|
ip_conntrack_expect_put(exp);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
write_unlock_bh(&ip_conntrack_lock);
|
write_unlock_bh(&ip_conntrack_lock);
|
||||||
}
|
}
|
||||||
|
|
|
@ -998,7 +998,7 @@ EXPORT_SYMBOL(ip_conntrack_expect_related);
|
||||||
EXPORT_SYMBOL(ip_conntrack_unexpect_related);
|
EXPORT_SYMBOL(ip_conntrack_unexpect_related);
|
||||||
EXPORT_SYMBOL_GPL(ip_conntrack_expect_list);
|
EXPORT_SYMBOL_GPL(ip_conntrack_expect_list);
|
||||||
EXPORT_SYMBOL_GPL(__ip_conntrack_expect_find);
|
EXPORT_SYMBOL_GPL(__ip_conntrack_expect_find);
|
||||||
EXPORT_SYMBOL_GPL(__ip_ct_expect_unlink_destroy);
|
EXPORT_SYMBOL_GPL(ip_ct_unlink_expect);
|
||||||
|
|
||||||
EXPORT_SYMBOL(ip_conntrack_tuple_taken);
|
EXPORT_SYMBOL(ip_conntrack_tuple_taken);
|
||||||
EXPORT_SYMBOL(ip_ct_gather_frags);
|
EXPORT_SYMBOL(ip_ct_gather_frags);
|
||||||
|
|
Loading…
Reference in New Issue