208
209 if ((head->dev = dev_get_by_index(net, qp->iif)) != NULL) {
210 icmp_send(head, ICMP_TIME_EXCEEDED, ICMP_EXC_FRAGTIME, 0);
211 dev_put(head->dev);
212 }
213 }
214out:
215 spin_unlock(&qp->q.lock);
216 ipq_put(qp);
217}
218
219
220
221
222static inline struct ipq *ip_find(struct net *net, struct iphdr *iph, u32 user)
223{
224 struct inet_frag_queue *q;
225 struct ip4_create_arg arg;
226 unsigned int hash;
227
228 arg.iph = iph;
229 arg.user = user;
230
231 read_lock(&ip4_frags.lock);
232 hash = ipqhashfn(iph->id, iph->saddr, iph->daddr, iph->protocol);
233
234 q = inet_frag_find(&net->ipv4.frags, &ip4_frags, &arg, hash);
235 if (q == NULL)
236 goto out_nomem;
237
238 return container_of(q, struct ipq, q);
239
240out_nomem:
241 LIMIT_NETDEBUG(KERN_ERR "ip_frag_create: no memory left !\n");
242 return NULL;
243}
244
245
246static inline int ip_frag_too_far(struct ipq *qp)
247{
248 struct inet_peer *peer = qp->peer;