diff options
Diffstat (limited to 'net/ipv6/reassembly.c')
-rw-r--r-- | net/ipv6/reassembly.c | 37 |
1 files changed, 5 insertions, 32 deletions
diff --git a/net/ipv6/reassembly.c b/net/ipv6/reassembly.c index db129a7a6192..c7d4961bbcf7 100644 --- a/net/ipv6/reassembly.c +++ b/net/ipv6/reassembly.c | |||
@@ -135,35 +135,12 @@ static unsigned int ip6qhashfn(__be32 id, struct in6_addr *saddr, | |||
135 | return c & (INETFRAGS_HASHSZ - 1); | 135 | return c & (INETFRAGS_HASHSZ - 1); |
136 | } | 136 | } |
137 | 137 | ||
138 | static void ip6_frag_secret_rebuild(unsigned long dummy) | 138 | static unsigned int ip6_hashfn(struct inet_frag_queue *q) |
139 | { | 139 | { |
140 | unsigned long now = jiffies; | 140 | struct frag_queue *fq; |
141 | int i; | ||
142 | |||
143 | write_lock(&ip6_frags.lock); | ||
144 | get_random_bytes(&ip6_frags.rnd, sizeof(u32)); | ||
145 | for (i = 0; i < INETFRAGS_HASHSZ; i++) { | ||
146 | struct frag_queue *q; | ||
147 | struct hlist_node *p, *n; | ||
148 | |||
149 | hlist_for_each_entry_safe(q, p, n, &ip6_frags.hash[i], q.list) { | ||
150 | unsigned int hval = ip6qhashfn(q->id, | ||
151 | &q->saddr, | ||
152 | &q->daddr); | ||
153 | |||
154 | if (hval != i) { | ||
155 | hlist_del(&q->q.list); | ||
156 | |||
157 | /* Relink to new hash chain. */ | ||
158 | hlist_add_head(&q->q.list, | ||
159 | &ip6_frags.hash[hval]); | ||
160 | |||
161 | } | ||
162 | } | ||
163 | } | ||
164 | write_unlock(&ip6_frags.lock); | ||
165 | 141 | ||
166 | mod_timer(&ip6_frags.secret_timer, now + ip6_frags_ctl.secret_interval); | 142 | fq = container_of(q, struct frag_queue, q); |
143 | return ip6qhashfn(fq->id, &fq->saddr, &fq->daddr); | ||
167 | } | 144 | } |
168 | 145 | ||
169 | /* Memory Tracking Functions. */ | 146 | /* Memory Tracking Functions. */ |
@@ -765,11 +742,7 @@ void __init ipv6_frag_init(void) | |||
765 | if (inet6_add_protocol(&frag_protocol, IPPROTO_FRAGMENT) < 0) | 742 | if (inet6_add_protocol(&frag_protocol, IPPROTO_FRAGMENT) < 0) |
766 | printk(KERN_ERR "ipv6_frag_init: Could not register protocol\n"); | 743 | printk(KERN_ERR "ipv6_frag_init: Could not register protocol\n"); |
767 | 744 | ||
768 | init_timer(&ip6_frags.secret_timer); | ||
769 | ip6_frags.secret_timer.function = ip6_frag_secret_rebuild; | ||
770 | ip6_frags.secret_timer.expires = jiffies + ip6_frags_ctl.secret_interval; | ||
771 | add_timer(&ip6_frags.secret_timer); | ||
772 | |||
773 | ip6_frags.ctl = &ip6_frags_ctl; | 745 | ip6_frags.ctl = &ip6_frags_ctl; |
746 | ip6_frags.hashfn = ip6_hashfn; | ||
774 | inet_frags_init(&ip6_frags); | 747 | inet_frags_init(&ip6_frags); |
775 | } | 748 | } |