aboutsummaryrefslogtreecommitdiff
path: root/net/netfilter/nf_tproxy_core.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2011-02-19 16:42:37 -0800
committerDavid S. Miller <davem@davemloft.net>2011-02-19 16:42:37 -0800
commitece639caa33c85c8805fa4a0a5955b8de9c95346 (patch)
tree5b8d613601c2e01e876a7d241923e90a0e759c3b /net/netfilter/nf_tproxy_core.c
parent0cc9d5257857608ba85885b75fcada13d359b5d1 (diff)
parent0af320fb4627033e49cbc6e8138e7aa75ab8352a (diff)
downloadlinux-linaro-stable-ece639caa33c85c8805fa4a0a5955b8de9c95346.tar.gz
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/kaber/nf-2.6
Diffstat (limited to 'net/netfilter/nf_tproxy_core.c')
-rw-r--r--net/netfilter/nf_tproxy_core.c27
1 files changed, 12 insertions, 15 deletions
diff --git a/net/netfilter/nf_tproxy_core.c b/net/netfilter/nf_tproxy_core.c
index 4d87befb04c0..474d621cbc2e 100644
--- a/net/netfilter/nf_tproxy_core.c
+++ b/net/netfilter/nf_tproxy_core.c
@@ -28,26 +28,23 @@ nf_tproxy_destructor(struct sk_buff *skb)
skb->destructor = NULL;
if (sk)
- nf_tproxy_put_sock(sk);
+ sock_put(sk);
}
/* consumes sk */
-int
+void
nf_tproxy_assign_sock(struct sk_buff *skb, struct sock *sk)
{
- bool transparent = (sk->sk_state == TCP_TIME_WAIT) ?
- inet_twsk(sk)->tw_transparent :
- inet_sk(sk)->transparent;
-
- if (transparent) {
- skb_orphan(skb);
- skb->sk = sk;
- skb->destructor = nf_tproxy_destructor;
- return 1;
- } else
- nf_tproxy_put_sock(sk);
-
- return 0;
+ /* assigning tw sockets complicates things; most
+ * skb->sk->X checks would have to test sk->sk_state first */
+ if (sk->sk_state == TCP_TIME_WAIT) {
+ inet_twsk_put(inet_twsk(sk));
+ return;
+ }
+
+ skb_orphan(skb);
+ skb->sk = sk;
+ skb->destructor = nf_tproxy_destructor;
}
EXPORT_SYMBOL_GPL(nf_tproxy_assign_sock);