aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrick McHardy <kaber@trash.net>2006-01-07 02:06:10 -0500
committerDavid S. Miller <davem@sunset.davemloft.net>2006-01-07 15:57:36 -0500
commitb59c270104f03960069596722fea70340579244d (patch)
tree5d038835626047899097b622695ead5c1eb1c499
parent5c901daaea3be0d900b3ae1fc9b5f64ff94e4f02 (diff)
[NETFILTER]: Keep conntrack reference until IPsec policy checks are done
Keep the conntrack reference until policy checks have been performed for IPsec NAT support. The reference needs to be dropped before a packet is queued to avoid having the conntrack module unloadable. Signed-off-by: Patrick McHardy <kaber@trash.net> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--net/dccp/ipv4.c1
-rw-r--r--net/ipv4/ip_input.c15
-rw-r--r--net/ipv4/raw.c1
-rw-r--r--net/ipv4/tcp_ipv4.c1
-rw-r--r--net/ipv4/udp.c2
-rw-r--r--net/sctp/input.c1
6 files changed, 12 insertions, 9 deletions
diff --git a/net/dccp/ipv4.c b/net/dccp/ipv4.c
index 3f244670764a..23ba177c1150 100644
--- a/net/dccp/ipv4.c
+++ b/net/dccp/ipv4.c
@@ -1099,6 +1099,7 @@ int dccp_v4_destroy_sock(struct sock *sk)
1099 kfree_skb(sk->sk_send_head); 1099 kfree_skb(sk->sk_send_head);
1100 sk->sk_send_head = NULL; 1100 sk->sk_send_head = NULL;
1101 } 1101 }
1102 nf_reset(skb);
1102 1103
1103 /* Clean up a referenced DCCP bind bucket. */ 1104 /* Clean up a referenced DCCP bind bucket. */
1104 if (inet_csk(sk)->icsk_bind_hash != NULL) 1105 if (inet_csk(sk)->icsk_bind_hash != NULL)
diff --git a/net/ipv4/ip_input.c b/net/ipv4/ip_input.c
index e45846ae570b..18d7fad474d7 100644
--- a/net/ipv4/ip_input.c
+++ b/net/ipv4/ip_input.c
@@ -185,7 +185,6 @@ int ip_call_ra_chain(struct sk_buff *skb)
185 raw_rcv(last, skb2); 185 raw_rcv(last, skb2);
186 } 186 }
187 last = sk; 187 last = sk;
188 nf_reset(skb);
189 } 188 }
190 } 189 }
191 190
@@ -204,10 +203,6 @@ static inline int ip_local_deliver_finish(struct sk_buff *skb)
204 203
205 __skb_pull(skb, ihl); 204 __skb_pull(skb, ihl);
206 205
207 /* Free reference early: we don't need it any more, and it may
208 hold ip_conntrack module loaded indefinitely. */
209 nf_reset(skb);
210
211 /* Point into the IP datagram, just past the header. */ 206 /* Point into the IP datagram, just past the header. */
212 skb->h.raw = skb->data; 207 skb->h.raw = skb->data;
213 208
@@ -232,10 +227,12 @@ static inline int ip_local_deliver_finish(struct sk_buff *skb)
232 if ((ipprot = rcu_dereference(inet_protos[hash])) != NULL) { 227 if ((ipprot = rcu_dereference(inet_protos[hash])) != NULL) {
233 int ret; 228 int ret;
234 229
235 if (!ipprot->no_policy && 230 if (!ipprot->no_policy) {
236 !xfrm4_policy_check(NULL, XFRM_POLICY_IN, skb)) { 231 if (!xfrm4_policy_check(NULL, XFRM_POLICY_IN, skb)) {
237 kfree_skb(skb); 232 kfree_skb(skb);
238 goto out; 233 goto out;
234 }
235 nf_reset(skb);
239 } 236 }
240 ret = ipprot->handler(skb); 237 ret = ipprot->handler(skb);
241 if (ret < 0) { 238 if (ret < 0) {
diff --git a/net/ipv4/raw.c b/net/ipv4/raw.c
index 4b0d7e4d6269..165a4d81efa4 100644
--- a/net/ipv4/raw.c
+++ b/net/ipv4/raw.c
@@ -255,6 +255,7 @@ int raw_rcv(struct sock *sk, struct sk_buff *skb)
255 kfree_skb(skb); 255 kfree_skb(skb);
256 return NET_RX_DROP; 256 return NET_RX_DROP;
257 } 257 }
258 nf_reset(skb);
258 259
259 skb_push(skb, skb->data - skb->nh.raw); 260 skb_push(skb, skb->data - skb->nh.raw);
260 261
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
index e9f83e5b28ce..6ea353907af5 100644
--- a/net/ipv4/tcp_ipv4.c
+++ b/net/ipv4/tcp_ipv4.c
@@ -1080,6 +1080,7 @@ process:
1080 1080
1081 if (!xfrm4_policy_check(sk, XFRM_POLICY_IN, skb)) 1081 if (!xfrm4_policy_check(sk, XFRM_POLICY_IN, skb))
1082 goto discard_and_relse; 1082 goto discard_and_relse;
1083 nf_reset(skb);
1083 1084
1084 if (sk_filter(sk, skb, 0)) 1085 if (sk_filter(sk, skb, 0))
1085 goto discard_and_relse; 1086 goto discard_and_relse;
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
index 223abaa72bc5..00840474a449 100644
--- a/net/ipv4/udp.c
+++ b/net/ipv4/udp.c
@@ -989,6 +989,7 @@ static int udp_queue_rcv_skb(struct sock * sk, struct sk_buff *skb)
989 kfree_skb(skb); 989 kfree_skb(skb);
990 return -1; 990 return -1;
991 } 991 }
992 nf_reset(skb);
992 993
993 if (up->encap_type) { 994 if (up->encap_type) {
994 /* 995 /*
@@ -1149,6 +1150,7 @@ int udp_rcv(struct sk_buff *skb)
1149 1150
1150 if (!xfrm4_policy_check(NULL, XFRM_POLICY_IN, skb)) 1151 if (!xfrm4_policy_check(NULL, XFRM_POLICY_IN, skb))
1151 goto drop; 1152 goto drop;
1153 nf_reset(skb);
1152 1154
1153 /* No socket. Drop packet silently, if checksum is wrong */ 1155 /* No socket. Drop packet silently, if checksum is wrong */
1154 if (udp_checksum_complete(skb)) 1156 if (udp_checksum_complete(skb))
diff --git a/net/sctp/input.c b/net/sctp/input.c
index 238f1bffa684..4aa6fc60357c 100644
--- a/net/sctp/input.c
+++ b/net/sctp/input.c
@@ -225,6 +225,7 @@ int sctp_rcv(struct sk_buff *skb)
225 225
226 if (!xfrm_policy_check(sk, XFRM_POLICY_IN, skb, family)) 226 if (!xfrm_policy_check(sk, XFRM_POLICY_IN, skb, family))
227 goto discard_release; 227 goto discard_release;
228 nf_reset(skb);
228 229
229 ret = sk_filter(sk, skb, 1); 230 ret = sk_filter(sk, skb, 1);
230 if (ret) 231 if (ret)