diff options
| author | Harald Welte <laforge@gnumonks.org> | 2002-10-13 14:51:42 -0700 |
|---|---|---|
| committer | David S. Miller <davem@nuts.ninka.net> | 2002-10-13 14:51:42 -0700 |
| commit | 49daee21a02ddd4584ef2492e55b3ee31d1f487d (patch) | |
| tree | 0cd529e5efe89402020cdc34d0f7919f657597bf | |
| parent | c6e56994f7b8a8f9a61199fbdd89dd00efdd7525 (diff) | |
[NETFILTER]: Avoid nesting readlocks in conntrack code.
| -rw-r--r-- | include/linux/netfilter_ipv4/ip_conntrack_core.h | 2 | ||||
| -rw-r--r-- | net/ipv4/netfilter/ip_conntrack_core.c | 4 | ||||
| -rw-r--r-- | net/ipv4/netfilter/ip_conntrack_standalone.c | 5 | ||||
| -rw-r--r-- | net/ipv4/netfilter/ip_nat_core.c | 2 |
4 files changed, 7 insertions, 6 deletions
diff --git a/include/linux/netfilter_ipv4/ip_conntrack_core.h b/include/linux/netfilter_ipv4/ip_conntrack_core.h index 7d8b393f3c44..c46f0e86fe60 100644 --- a/include/linux/netfilter_ipv4/ip_conntrack_core.h +++ b/include/linux/netfilter_ipv4/ip_conntrack_core.h @@ -17,7 +17,7 @@ extern void ip_conntrack_cleanup(void); struct ip_conntrack_protocol; extern struct ip_conntrack_protocol *ip_ct_find_proto(u_int8_t protocol); /* Like above, but you already have conntrack read lock. */ -extern struct ip_conntrack_protocol *__find_proto(u_int8_t protocol); +extern struct ip_conntrack_protocol *__ip_ct_find_proto(u_int8_t protocol); extern struct list_head protocol_list; /* Returns conntrack if it dealt with ICMP, and filled in skb->nfct */ diff --git a/net/ipv4/netfilter/ip_conntrack_core.c b/net/ipv4/netfilter/ip_conntrack_core.c index 1b576c42cc2f..712869863cd2 100644 --- a/net/ipv4/netfilter/ip_conntrack_core.c +++ b/net/ipv4/netfilter/ip_conntrack_core.c @@ -75,7 +75,7 @@ static inline int proto_cmpfn(const struct ip_conntrack_protocol *curr, return protocol == curr->proto; } -struct ip_conntrack_protocol *__find_proto(u_int8_t protocol) +struct ip_conntrack_protocol *__ip_ct_find_proto(u_int8_t protocol) { struct ip_conntrack_protocol *p; @@ -93,7 +93,7 @@ struct ip_conntrack_protocol *ip_ct_find_proto(u_int8_t protocol) struct ip_conntrack_protocol *p; READ_LOCK(&ip_conntrack_lock); - p = __find_proto(protocol); + p = __ip_ct_find_proto(protocol); READ_UNLOCK(&ip_conntrack_lock); return p; } diff --git a/net/ipv4/netfilter/ip_conntrack_standalone.c b/net/ipv4/netfilter/ip_conntrack_standalone.c index 092ea4c00f54..9cebe6d8501a 100644 --- a/net/ipv4/netfilter/ip_conntrack_standalone.c +++ b/net/ipv4/netfilter/ip_conntrack_standalone.c @@ -71,7 +71,7 @@ print_expect(char *buffer, const struct ip_conntrack_expect *expect) len += sprintf(buffer + len, "use=%u proto=%u ", atomic_read(&expect->use), expect->tuple.dst.protonum); len += print_tuple(buffer + len, &expect->tuple, - __find_proto(expect->tuple.dst.protonum)); + __ip_ct_find_proto(expect->tuple.dst.protonum)); len += sprintf(buffer + len, "\n"); return len; } @@ -81,7 +81,7 @@ print_conntrack(char *buffer, const struct ip_conntrack *conntrack) { unsigned int len; struct ip_conntrack_protocol *proto - = __find_proto(conntrack->tuplehash[IP_CT_DIR_ORIGINAL] + = __ip_ct_find_proto(conntrack->tuplehash[IP_CT_DIR_ORIGINAL] .tuple.dst.protonum); len = sprintf(buffer, "%-8s %u %lu ", @@ -361,6 +361,7 @@ EXPORT_SYMBOL(ip_conntrack_helper_unregister); EXPORT_SYMBOL(ip_ct_selective_cleanup); EXPORT_SYMBOL(ip_ct_refresh); EXPORT_SYMBOL(ip_ct_find_proto); +EXPORT_SYMBOL(__ip_ct_find_proto); EXPORT_SYMBOL(ip_ct_find_helper); EXPORT_SYMBOL(ip_conntrack_expect_related); EXPORT_SYMBOL(ip_conntrack_change_expect); diff --git a/net/ipv4/netfilter/ip_nat_core.c b/net/ipv4/netfilter/ip_nat_core.c index 38a8e37ffd9a..020a6af6acde 100644 --- a/net/ipv4/netfilter/ip_nat_core.c +++ b/net/ipv4/netfilter/ip_nat_core.c @@ -740,7 +740,7 @@ static inline int exp_for_packet(struct ip_conntrack_expect *exp, int ret = 1; MUST_BE_READ_LOCKED(&ip_conntrack_lock); - proto = ip_ct_find_proto((*pskb)->nh.iph->protocol); + proto = __ip_ct_find_proto((*pskb)->nh.iph->protocol); if (proto->exp_matches_pkt) ret = proto->exp_matches_pkt(exp, pskb); |
