IPv6: conntrack: Use protocol-related match routine in IPv6 connection track
Subsystems (4)
PATCH 2/2 IPv6: conntrack: Use protocol-related match routine in IPv6 connection track
IPv6 connection track and IPv6 stack separately use a different queue to manage received fragments. So using protocol-related match routine.
--- include/net/ipv6.h | 1 - net/ipv6/netfilter/nf_conntrack_reasm.c | 13 ++++++++++++- net/ipv6/reassembly.c | 3 +-- 3 files changed, 13 insertions(+), 4 deletions(-)
include/net/ipv6.h +0 -1
@@ -365,7 +365,6 @@ struct ip6_create_arg { };void ip6_frag_init (struct inet_frag_queue *q,void *a); -int ip6_frag_match (struct inet_frag_queue *q,void *a);static inline int ipv6_addr_any (const struct in6_addr *a) {
net/ipv6/netfilter/nf_conntrack_reasm.c +12 -1
@@ -146,6 +146,17 @@ static void nf_ct_frag6_evictor(void)local_bh_enable (); } +static int nf_ct_frag_match (struct inet_frag_queue *q,void *a) +{ +struct nf_ct_frag6_queue *fq; +struct ip6_create_arg *arg = a; + fq = container_of(q, struct nf_ct_frag6_queue, q); + +return (fq->id == arg->id && +ipv6_addr_equal (&fq->saddr, arg->src) && +ipv6_addr_equal (&fq->daddr, arg->dst)); +} +static void nf_ct_frag6_expire (unsigned long data) {struct nf_ct_frag6_queue *fq;
@@ -665,7 +676,7 @@ int nf_ct_frag6_init(void) nf_frags.destructor =NULL ; nf_frags.skb_free = nf_skb_free; nf_frags.qsize =sizeof (struct nf_ct_frag6_queue ); - nf_frags.match = ip6_frag_match; + nf_frags.match = nf_ct_frag_match; nf_frags.frag_expire = nf_ct_frag6_expire; nf_frags.secret_interval =10 *60 *HZ ; nf_init_frags.timeout =IPV6_FRAG_TIMEOUT ;
net/ipv6/reassembly.c +1 -2
@@ -136,7 +136,7 @@ static unsigned int ip6_hashfn(struct inet_frag_queue *q)return inet6_hash_frag (fq->id, &fq->saddr, &fq->daddr, ip6_frags.rnd); } -int ip6_frag_match (struct inet_frag_queue *q,void *a) +static int ip6_frag_match (struct inet_frag_queue *q,void *a) {struct frag_queue *fq;struct ip6_create_arg *arg = a;
@@ -146,7 +146,6 @@ int ip6_frag_match(struct inet_frag_queue *q, void *a)ipv6_addr_equal (&fq->saddr, arg->src) && ipv6_addr_equal(&fq->daddr, arg->dst)); } -EXPORT_SYMBOL (ip6_frag_match);/* Memory Tracking Functions. */ static inline void frag_kfree_skb(struct netns_frags *nf,
Signature · 1 line
1.6.3.3
David Miller
maintainerFrom: Shan Wei <[email protected]>
Date: Tue, 26 Jan 2010 10:31:16 +0800
Quoted 6 lines
IPv6 connection track and IPv6 stack separately use a different queue to manage received fragments. So using protocol-related match routine.
Signed-off-by Shan Wei <[email protected]>
This problem was also introduced by:
commit 0b5ccb2ee250136dd7385b1c7da28417d0d4d32d
Author: Patrick McHardy <[email protected]> Date: Tue Dec 15 16:59:18 2009 +0100
ipv6: reassembly: use seperate reassembly queues for conntrack and local delivery
Currently the same reassembly queue might be used for packets reassembled by conntrack in different positions in the stack (PREROUTING/LOCAL_OUT), as well as local delivery. This can cause "packet jumps" when the fragment completing a reassembled packet is queued from a different position in the stack than the previous ones.
Add a "user" identifier to the reassembly queue key to seperate the queues of each caller, similar to what we do for IPv4.