319
320 return 0;
321drop:
322 return -1;
323}
324
325static int ip_rcv_finish(struct sk_buff *skb)
326{
327 const struct iphdr *iph = ip_hdr(skb);
328 struct rtable *rt;
329
330
331
332
333
334 if (skb->dst == NULL) {
335 int err = ip_route_input(skb, iph->daddr, iph->saddr, iph->tos,
336 skb->dev);
337 if (unlikely(err)) {
338 if (err == -EHOSTUNREACH)
339 IP_INC_STATS_BH(dev_net(skb->dev),
340 IPSTATS_MIB_INADDRERRORS);
341 else if (err == -ENETUNREACH)
342 IP_INC_STATS_BH(dev_net(skb->dev),
343 IPSTATS_MIB_INNOROUTES);
344 goto drop;
345 }
346 }
347
348#ifdef CONFIG_NET_CLS_ROUTE
349 if (unlikely(skb->dst->tclassid)) {
350 struct ip_rt_acct *st = per_cpu_ptr(ip_rt_acct, smp_processor_id());
351 u32 idx = skb->dst->tclassid;
352 st[idx&0xFF].o_packets++;
353 st[idx&0xFF].o_bytes+=skb->len;
354 st[(idx>>16)&0xFF].i_packets++;
355 st[(idx>>16)&0xFF].i_bytes+=skb->len;
356 }
357#endif
358
359 if (iph->ihl > 5 && ip_rcv_options(skb))