reassembly.c (98b3377ca77a06a7bd75a444e9f7136e9bb5112e) | reassembly.c (3bd653c8455bc7991bae77968702b31c8f5df883) |
---|---|
1/* 2 * IPv6 fragment reassembly 3 * Linux INET6 implementation 4 * 5 * Authors: 6 * Pedro Roque <roque@di.fc.ul.pt> 7 * 8 * Based on: net/ipv4/ip_fragment.c --- 419 unchanged lines hidden (view full) --- 428 return ip6_frag_reasm(fq, prev, dev); 429 430 write_lock(&ip6_frags.lock); 431 list_move_tail(&fq->q.lru_list, &fq->q.net->lru_list); 432 write_unlock(&ip6_frags.lock); 433 return -1; 434 435err: | 1/* 2 * IPv6 fragment reassembly 3 * Linux INET6 implementation 4 * 5 * Authors: 6 * Pedro Roque <roque@di.fc.ul.pt> 7 * 8 * Based on: net/ipv4/ip_fragment.c --- 419 unchanged lines hidden (view full) --- 428 return ip6_frag_reasm(fq, prev, dev); 429 430 write_lock(&ip6_frags.lock); 431 list_move_tail(&fq->q.lru_list, &fq->q.net->lru_list); 432 write_unlock(&ip6_frags.lock); 433 return -1; 434 435err: |
436 IP6_INC_STATS(ip6_dst_idev(skb->dst), IPSTATS_MIB_REASMFAILS); | 436 IP6_INC_STATS(dev_net(skb->dst->dev), ip6_dst_idev(skb->dst), 437 IPSTATS_MIB_REASMFAILS); |
437 kfree_skb(skb); 438 return -1; 439} 440 441/* 442 * Check if this packet is complete. 443 * Returns NULL on failure by any reason, and pointer 444 * to current nexthdr field in reassembled frame. --- 123 unchanged lines hidden (view full) --- 568 return -1; 569} 570 571static int ipv6_frag_rcv(struct sk_buff *skb) 572{ 573 struct frag_hdr *fhdr; 574 struct frag_queue *fq; 575 struct ipv6hdr *hdr = ipv6_hdr(skb); | 438 kfree_skb(skb); 439 return -1; 440} 441 442/* 443 * Check if this packet is complete. 444 * Returns NULL on failure by any reason, and pointer 445 * to current nexthdr field in reassembled frame. --- 123 unchanged lines hidden (view full) --- 569 return -1; 570} 571 572static int ipv6_frag_rcv(struct sk_buff *skb) 573{ 574 struct frag_hdr *fhdr; 575 struct frag_queue *fq; 576 struct ipv6hdr *hdr = ipv6_hdr(skb); |
576 struct net *net; | 577 struct net *net = dev_net(skb->dst->dev); |
577 578 IP6_INC_STATS_BH(ip6_dst_idev(skb->dst), IPSTATS_MIB_REASMREQDS); 579 580 /* Jumbo payload inhibits frag. header */ 581 if (hdr->payload_len==0) 582 goto fail_hdr; 583 584 if (!pskb_may_pull(skb, (skb_transport_offset(skb) + --- 7 unchanged lines hidden (view full) --- 592 /* It is not a fragmented frame */ 593 skb->transport_header += sizeof(struct frag_hdr); 594 IP6_INC_STATS_BH(ip6_dst_idev(skb->dst), IPSTATS_MIB_REASMOKS); 595 596 IP6CB(skb)->nhoff = (u8 *)fhdr - skb_network_header(skb); 597 return 1; 598 } 599 | 578 579 IP6_INC_STATS_BH(ip6_dst_idev(skb->dst), IPSTATS_MIB_REASMREQDS); 580 581 /* Jumbo payload inhibits frag. header */ 582 if (hdr->payload_len==0) 583 goto fail_hdr; 584 585 if (!pskb_may_pull(skb, (skb_transport_offset(skb) + --- 7 unchanged lines hidden (view full) --- 593 /* It is not a fragmented frame */ 594 skb->transport_header += sizeof(struct frag_hdr); 595 IP6_INC_STATS_BH(ip6_dst_idev(skb->dst), IPSTATS_MIB_REASMOKS); 596 597 IP6CB(skb)->nhoff = (u8 *)fhdr - skb_network_header(skb); 598 return 1; 599 } 600 |
600 net = dev_net(skb->dev); | |
601 if (atomic_read(&net->ipv6.frags.mem) > net->ipv6.frags.high_thresh) 602 ip6_evictor(net, ip6_dst_idev(skb->dst)); 603 604 if ((fq = fq_find(net, fhdr->identification, &hdr->saddr, &hdr->daddr, 605 ip6_dst_idev(skb->dst))) != NULL) { 606 int ret; 607 608 spin_lock(&fq->q.lock); --- 5 unchanged lines hidden (view full) --- 614 return ret; 615 } 616 617 IP6_INC_STATS_BH(ip6_dst_idev(skb->dst), IPSTATS_MIB_REASMFAILS); 618 kfree_skb(skb); 619 return -1; 620 621fail_hdr: | 601 if (atomic_read(&net->ipv6.frags.mem) > net->ipv6.frags.high_thresh) 602 ip6_evictor(net, ip6_dst_idev(skb->dst)); 603 604 if ((fq = fq_find(net, fhdr->identification, &hdr->saddr, &hdr->daddr, 605 ip6_dst_idev(skb->dst))) != NULL) { 606 int ret; 607 608 spin_lock(&fq->q.lock); --- 5 unchanged lines hidden (view full) --- 614 return ret; 615 } 616 617 IP6_INC_STATS_BH(ip6_dst_idev(skb->dst), IPSTATS_MIB_REASMFAILS); 618 kfree_skb(skb); 619 return -1; 620 621fail_hdr: |
622 IP6_INC_STATS(ip6_dst_idev(skb->dst), IPSTATS_MIB_INHDRERRORS); | 622 IP6_INC_STATS(net, ip6_dst_idev(skb->dst), IPSTATS_MIB_INHDRERRORS); |
623 icmpv6_param_prob(skb, ICMPV6_HDR_FIELD, skb_network_header_len(skb)); 624 return -1; 625} 626 627static struct inet6_protocol frag_protocol = 628{ 629 .handler = ipv6_frag_rcv, 630 .flags = INET6_PROTO_NOPOLICY, --- 181 unchanged lines hidden --- | 623 icmpv6_param_prob(skb, ICMPV6_HDR_FIELD, skb_network_header_len(skb)); 624 return -1; 625} 626 627static struct inet6_protocol frag_protocol = 628{ 629 .handler = ipv6_frag_rcv, 630 .flags = INET6_PROTO_NOPOLICY, --- 181 unchanged lines hidden --- |