ip6_output.c (0b0588d42b2774734b51525fe6550d77f8ea9bc0) | ip6_output.c (3bd653c8455bc7991bae77968702b31c8f5df883) |
---|---|
1/* 2 * IPv6 output functions 3 * Linux INET6 implementation 4 * 5 * Authors: 6 * Pedro Roque <roque@di.fc.ul.pt> 7 * 8 * Based on linux/net/ipv4/ip_output.c --- 136 unchanged lines hidden (view full) --- 145 is not supported in any case. 146 */ 147 if (newskb) 148 NF_HOOK(PF_INET6, NF_INET_POST_ROUTING, newskb, 149 NULL, newskb->dev, 150 ip6_dev_loopback_xmit); 151 152 if (ipv6_hdr(skb)->hop_limit == 0) { | 1/* 2 * IPv6 output functions 3 * Linux INET6 implementation 4 * 5 * Authors: 6 * Pedro Roque <roque@di.fc.ul.pt> 7 * 8 * Based on linux/net/ipv4/ip_output.c --- 136 unchanged lines hidden (view full) --- 145 is not supported in any case. 146 */ 147 if (newskb) 148 NF_HOOK(PF_INET6, NF_INET_POST_ROUTING, newskb, 149 NULL, newskb->dev, 150 ip6_dev_loopback_xmit); 151 152 if (ipv6_hdr(skb)->hop_limit == 0) { |
153 IP6_INC_STATS(idev, IPSTATS_MIB_OUTDISCARDS); | 153 IP6_INC_STATS(dev_net(dev), idev, 154 IPSTATS_MIB_OUTDISCARDS); |
154 kfree_skb(skb); 155 return 0; 156 } 157 } 158 | 155 kfree_skb(skb); 156 return 0; 157 } 158 } 159 |
159 IP6_INC_STATS(idev, IPSTATS_MIB_OUTMCASTPKTS); | 160 IP6_INC_STATS(dev_net(dev), idev, IPSTATS_MIB_OUTMCASTPKTS); |
160 } 161 162 return NF_HOOK(PF_INET6, NF_INET_POST_ROUTING, skb, NULL, skb->dev, 163 ip6_output_finish); 164} 165 166static inline int ip6_skb_dst_mtu(struct sk_buff *skb) 167{ 168 struct ipv6_pinfo *np = skb->sk ? inet6_sk(skb->sk) : NULL; 169 170 return (np && np->pmtudisc == IPV6_PMTUDISC_PROBE) ? 171 skb->dst->dev->mtu : dst_mtu(skb->dst); 172} 173 174int ip6_output(struct sk_buff *skb) 175{ 176 struct inet6_dev *idev = ip6_dst_idev(skb->dst); 177 if (unlikely(idev->cnf.disable_ipv6)) { | 161 } 162 163 return NF_HOOK(PF_INET6, NF_INET_POST_ROUTING, skb, NULL, skb->dev, 164 ip6_output_finish); 165} 166 167static inline int ip6_skb_dst_mtu(struct sk_buff *skb) 168{ 169 struct ipv6_pinfo *np = skb->sk ? inet6_sk(skb->sk) : NULL; 170 171 return (np && np->pmtudisc == IPV6_PMTUDISC_PROBE) ? 172 skb->dst->dev->mtu : dst_mtu(skb->dst); 173} 174 175int ip6_output(struct sk_buff *skb) 176{ 177 struct inet6_dev *idev = ip6_dst_idev(skb->dst); 178 if (unlikely(idev->cnf.disable_ipv6)) { |
178 IP6_INC_STATS(idev, IPSTATS_MIB_OUTDISCARDS); | 179 IP6_INC_STATS(dev_net(skb->dst->dev), idev, 180 IPSTATS_MIB_OUTDISCARDS); |
179 kfree_skb(skb); 180 return 0; 181 } 182 183 if ((skb->len > ip6_skb_dst_mtu(skb) && !skb_is_gso(skb)) || 184 dst_allfrag(skb->dst)) 185 return ip6_fragment(skb, ip6_output2); 186 else 187 return ip6_output2(skb); 188} 189 190/* 191 * xmit an sk_buff (used by TCP) 192 */ 193 194int ip6_xmit(struct sock *sk, struct sk_buff *skb, struct flowi *fl, 195 struct ipv6_txoptions *opt, int ipfragok) 196{ | 181 kfree_skb(skb); 182 return 0; 183 } 184 185 if ((skb->len > ip6_skb_dst_mtu(skb) && !skb_is_gso(skb)) || 186 dst_allfrag(skb->dst)) 187 return ip6_fragment(skb, ip6_output2); 188 else 189 return ip6_output2(skb); 190} 191 192/* 193 * xmit an sk_buff (used by TCP) 194 */ 195 196int ip6_xmit(struct sock *sk, struct sk_buff *skb, struct flowi *fl, 197 struct ipv6_txoptions *opt, int ipfragok) 198{ |
199 struct net *net = sock_net(sk); |
|
197 struct ipv6_pinfo *np = inet6_sk(sk); 198 struct in6_addr *first_hop = &fl->fl6_dst; 199 struct dst_entry *dst = skb->dst; 200 struct ipv6hdr *hdr; 201 u8 proto = fl->proto; 202 int seg_len = skb->len; 203 int hlimit, tclass; 204 u32 mtu; --- 6 unchanged lines hidden (view full) --- 211 */ 212 head_room = opt->opt_nflen + opt->opt_flen; 213 seg_len += head_room; 214 head_room += sizeof(struct ipv6hdr) + LL_RESERVED_SPACE(dst->dev); 215 216 if (skb_headroom(skb) < head_room) { 217 struct sk_buff *skb2 = skb_realloc_headroom(skb, head_room); 218 if (skb2 == NULL) { | 200 struct ipv6_pinfo *np = inet6_sk(sk); 201 struct in6_addr *first_hop = &fl->fl6_dst; 202 struct dst_entry *dst = skb->dst; 203 struct ipv6hdr *hdr; 204 u8 proto = fl->proto; 205 int seg_len = skb->len; 206 int hlimit, tclass; 207 u32 mtu; --- 6 unchanged lines hidden (view full) --- 214 */ 215 head_room = opt->opt_nflen + opt->opt_flen; 216 seg_len += head_room; 217 head_room += sizeof(struct ipv6hdr) + LL_RESERVED_SPACE(dst->dev); 218 219 if (skb_headroom(skb) < head_room) { 220 struct sk_buff *skb2 = skb_realloc_headroom(skb, head_room); 221 if (skb2 == NULL) { |
219 IP6_INC_STATS(ip6_dst_idev(skb->dst), | 222 IP6_INC_STATS(net, ip6_dst_idev(skb->dst), |
220 IPSTATS_MIB_OUTDISCARDS); 221 kfree_skb(skb); 222 return -ENOBUFS; 223 } 224 kfree_skb(skb); 225 skb = skb2; 226 if (sk) 227 skb_set_owner_w(skb, sk); --- 37 unchanged lines hidden (view full) --- 265 ipv6_addr_copy(&hdr->saddr, &fl->fl6_src); 266 ipv6_addr_copy(&hdr->daddr, first_hop); 267 268 skb->priority = sk->sk_priority; 269 skb->mark = sk->sk_mark; 270 271 mtu = dst_mtu(dst); 272 if ((skb->len <= mtu) || skb->local_df || skb_is_gso(skb)) { | 223 IPSTATS_MIB_OUTDISCARDS); 224 kfree_skb(skb); 225 return -ENOBUFS; 226 } 227 kfree_skb(skb); 228 skb = skb2; 229 if (sk) 230 skb_set_owner_w(skb, sk); --- 37 unchanged lines hidden (view full) --- 268 ipv6_addr_copy(&hdr->saddr, &fl->fl6_src); 269 ipv6_addr_copy(&hdr->daddr, first_hop); 270 271 skb->priority = sk->sk_priority; 272 skb->mark = sk->sk_mark; 273 274 mtu = dst_mtu(dst); 275 if ((skb->len <= mtu) || skb->local_df || skb_is_gso(skb)) { |
273 IP6_INC_STATS(ip6_dst_idev(skb->dst), | 276 IP6_INC_STATS(net, ip6_dst_idev(skb->dst), |
274 IPSTATS_MIB_OUTREQUESTS); 275 return NF_HOOK(PF_INET6, NF_INET_LOCAL_OUT, skb, NULL, dst->dev, 276 dst_output); 277 } 278 279 if (net_ratelimit()) 280 printk(KERN_DEBUG "IPv6: sending pkt_too_big to self\n"); 281 skb->dev = dst->dev; 282 icmpv6_send(skb, ICMPV6_PKT_TOOBIG, 0, mtu, skb->dev); | 277 IPSTATS_MIB_OUTREQUESTS); 278 return NF_HOOK(PF_INET6, NF_INET_LOCAL_OUT, skb, NULL, dst->dev, 279 dst_output); 280 } 281 282 if (net_ratelimit()) 283 printk(KERN_DEBUG "IPv6: sending pkt_too_big to self\n"); 284 skb->dev = dst->dev; 285 icmpv6_send(skb, ICMPV6_PKT_TOOBIG, 0, mtu, skb->dev); |
283 IP6_INC_STATS(ip6_dst_idev(skb->dst), IPSTATS_MIB_FRAGFAILS); | 286 IP6_INC_STATS(net, ip6_dst_idev(skb->dst), IPSTATS_MIB_FRAGFAILS); |
284 kfree_skb(skb); 285 return -EMSGSIZE; 286} 287 288EXPORT_SYMBOL(ip6_xmit); 289 290/* 291 * To avoid extra problems ND packets are send through this --- 125 unchanged lines hidden (view full) --- 417 418 if (net->ipv6.devconf_all->forwarding == 0) 419 goto error; 420 421 if (skb_warn_if_lro(skb)) 422 goto drop; 423 424 if (!xfrm6_policy_check(NULL, XFRM_POLICY_FWD, skb)) { | 287 kfree_skb(skb); 288 return -EMSGSIZE; 289} 290 291EXPORT_SYMBOL(ip6_xmit); 292 293/* 294 * To avoid extra problems ND packets are send through this --- 125 unchanged lines hidden (view full) --- 420 421 if (net->ipv6.devconf_all->forwarding == 0) 422 goto error; 423 424 if (skb_warn_if_lro(skb)) 425 goto drop; 426 427 if (!xfrm6_policy_check(NULL, XFRM_POLICY_FWD, skb)) { |
425 IP6_INC_STATS(ip6_dst_idev(dst), IPSTATS_MIB_INDISCARDS); | 428 IP6_INC_STATS(net, ip6_dst_idev(dst), IPSTATS_MIB_INDISCARDS); |
426 goto drop; 427 } 428 429 skb_forward_csum(skb); 430 431 /* 432 * We DO NOT make any processing on 433 * RA packets, pushing them to user level AS IS --- 29 unchanged lines hidden (view full) --- 463 464 /* XXX: idev->cnf.proxy_ndp? */ 465 if (net->ipv6.devconf_all->proxy_ndp && 466 pneigh_lookup(&nd_tbl, net, &hdr->daddr, skb->dev, 0)) { 467 int proxied = ip6_forward_proxy_check(skb); 468 if (proxied > 0) 469 return ip6_input(skb); 470 else if (proxied < 0) { | 429 goto drop; 430 } 431 432 skb_forward_csum(skb); 433 434 /* 435 * We DO NOT make any processing on 436 * RA packets, pushing them to user level AS IS --- 29 unchanged lines hidden (view full) --- 466 467 /* XXX: idev->cnf.proxy_ndp? */ 468 if (net->ipv6.devconf_all->proxy_ndp && 469 pneigh_lookup(&nd_tbl, net, &hdr->daddr, skb->dev, 0)) { 470 int proxied = ip6_forward_proxy_check(skb); 471 if (proxied > 0) 472 return ip6_input(skb); 473 else if (proxied < 0) { |
471 IP6_INC_STATS(ip6_dst_idev(dst), IPSTATS_MIB_INDISCARDS); | 474 IP6_INC_STATS(net, ip6_dst_idev(dst), 475 IPSTATS_MIB_INDISCARDS); |
472 goto drop; 473 } 474 } 475 476 if (!xfrm6_route_forward(skb)) { | 476 goto drop; 477 } 478 } 479 480 if (!xfrm6_route_forward(skb)) { |
477 IP6_INC_STATS(ip6_dst_idev(dst), IPSTATS_MIB_INDISCARDS); | 481 IP6_INC_STATS(net, ip6_dst_idev(dst), IPSTATS_MIB_INDISCARDS); |
478 goto drop; 479 } 480 dst = skb->dst; 481 482 /* IPv6 specs say nothing about it, but it is clear that we cannot 483 send redirects to source routed frames. 484 We don't send redirects to frames decapsulated from IPsec. 485 */ --- 39 unchanged lines hidden (view full) --- 525 icmpv6_send(skb, ICMPV6_PKT_TOOBIG, 0, dst_mtu(dst), skb->dev); 526 IP6_INC_STATS_BH(ip6_dst_idev(dst), IPSTATS_MIB_INTOOBIGERRORS); 527 IP6_INC_STATS_BH(ip6_dst_idev(dst), IPSTATS_MIB_FRAGFAILS); 528 kfree_skb(skb); 529 return -EMSGSIZE; 530 } 531 532 if (skb_cow(skb, dst->dev->hard_header_len)) { | 482 goto drop; 483 } 484 dst = skb->dst; 485 486 /* IPv6 specs say nothing about it, but it is clear that we cannot 487 send redirects to source routed frames. 488 We don't send redirects to frames decapsulated from IPsec. 489 */ --- 39 unchanged lines hidden (view full) --- 529 icmpv6_send(skb, ICMPV6_PKT_TOOBIG, 0, dst_mtu(dst), skb->dev); 530 IP6_INC_STATS_BH(ip6_dst_idev(dst), IPSTATS_MIB_INTOOBIGERRORS); 531 IP6_INC_STATS_BH(ip6_dst_idev(dst), IPSTATS_MIB_FRAGFAILS); 532 kfree_skb(skb); 533 return -EMSGSIZE; 534 } 535 536 if (skb_cow(skb, dst->dev->hard_header_len)) { |
533 IP6_INC_STATS(ip6_dst_idev(dst), IPSTATS_MIB_OUTDISCARDS); | 537 IP6_INC_STATS(net, ip6_dst_idev(dst), IPSTATS_MIB_OUTDISCARDS); |
534 goto drop; 535 } 536 537 hdr = ipv6_hdr(skb); 538 539 /* Mangling hops number delayed to point after skb COW */ 540 541 hdr->hop_limit--; --- 75 unchanged lines hidden (view full) --- 617 struct rt6_info *rt = (struct rt6_info*)skb->dst; 618 struct ipv6_pinfo *np = skb->sk ? inet6_sk(skb->sk) : NULL; 619 struct ipv6hdr *tmp_hdr; 620 struct frag_hdr *fh; 621 unsigned int mtu, hlen, left, len; 622 __be32 frag_id = 0; 623 int ptr, offset = 0, err=0; 624 u8 *prevhdr, nexthdr = 0; | 538 goto drop; 539 } 540 541 hdr = ipv6_hdr(skb); 542 543 /* Mangling hops number delayed to point after skb COW */ 544 545 hdr->hop_limit--; --- 75 unchanged lines hidden (view full) --- 621 struct rt6_info *rt = (struct rt6_info*)skb->dst; 622 struct ipv6_pinfo *np = skb->sk ? inet6_sk(skb->sk) : NULL; 623 struct ipv6hdr *tmp_hdr; 624 struct frag_hdr *fh; 625 unsigned int mtu, hlen, left, len; 626 __be32 frag_id = 0; 627 int ptr, offset = 0, err=0; 628 u8 *prevhdr, nexthdr = 0; |
629 struct net *net = dev_net(skb->dst->dev); |
|
625 626 hlen = ip6_find_1stfragopt(skb, &prevhdr); 627 nexthdr = *prevhdr; 628 629 mtu = ip6_skb_dst_mtu(skb); 630 631 /* We must not fragment if the socket is set to force MTU discovery 632 * or if the skb it not generated by a local socket. (This last 633 * check should be redundant, but it's free.) 634 */ 635 if (!skb->local_df) { 636 skb->dev = skb->dst->dev; 637 icmpv6_send(skb, ICMPV6_PKT_TOOBIG, 0, mtu, skb->dev); | 630 631 hlen = ip6_find_1stfragopt(skb, &prevhdr); 632 nexthdr = *prevhdr; 633 634 mtu = ip6_skb_dst_mtu(skb); 635 636 /* We must not fragment if the socket is set to force MTU discovery 637 * or if the skb it not generated by a local socket. (This last 638 * check should be redundant, but it's free.) 639 */ 640 if (!skb->local_df) { 641 skb->dev = skb->dst->dev; 642 icmpv6_send(skb, ICMPV6_PKT_TOOBIG, 0, mtu, skb->dev); |
638 IP6_INC_STATS(ip6_dst_idev(skb->dst), IPSTATS_MIB_FRAGFAILS); | 643 IP6_INC_STATS(net, ip6_dst_idev(skb->dst), 644 IPSTATS_MIB_FRAGFAILS); |
639 kfree_skb(skb); 640 return -EMSGSIZE; 641 } 642 643 if (np && np->frag_size < mtu) { 644 if (np->frag_size) 645 mtu = np->frag_size; 646 } --- 32 unchanged lines hidden (view full) --- 679 offset = 0; 680 frag = skb_shinfo(skb)->frag_list; 681 skb_shinfo(skb)->frag_list = NULL; 682 /* BUILD HEADER */ 683 684 *prevhdr = NEXTHDR_FRAGMENT; 685 tmp_hdr = kmemdup(skb_network_header(skb), hlen, GFP_ATOMIC); 686 if (!tmp_hdr) { | 645 kfree_skb(skb); 646 return -EMSGSIZE; 647 } 648 649 if (np && np->frag_size < mtu) { 650 if (np->frag_size) 651 mtu = np->frag_size; 652 } --- 32 unchanged lines hidden (view full) --- 685 offset = 0; 686 frag = skb_shinfo(skb)->frag_list; 687 skb_shinfo(skb)->frag_list = NULL; 688 /* BUILD HEADER */ 689 690 *prevhdr = NEXTHDR_FRAGMENT; 691 tmp_hdr = kmemdup(skb_network_header(skb), hlen, GFP_ATOMIC); 692 if (!tmp_hdr) { |
687 IP6_INC_STATS(ip6_dst_idev(skb->dst), IPSTATS_MIB_FRAGFAILS); | 693 IP6_INC_STATS(net, ip6_dst_idev(skb->dst), 694 IPSTATS_MIB_FRAGFAILS); |
688 return -ENOMEM; 689 } 690 691 __skb_pull(skb, hlen); 692 fh = (struct frag_hdr*)__skb_push(skb, sizeof(struct frag_hdr)); 693 __skb_push(skb, hlen); 694 skb_reset_network_header(skb); 695 memcpy(skb_network_header(skb), tmp_hdr, hlen); --- 34 unchanged lines hidden (view full) --- 730 ipv6_hdr(frag)->payload_len = 731 htons(frag->len - 732 sizeof(struct ipv6hdr)); 733 ip6_copy_metadata(frag, skb); 734 } 735 736 err = output(skb); 737 if(!err) | 695 return -ENOMEM; 696 } 697 698 __skb_pull(skb, hlen); 699 fh = (struct frag_hdr*)__skb_push(skb, sizeof(struct frag_hdr)); 700 __skb_push(skb, hlen); 701 skb_reset_network_header(skb); 702 memcpy(skb_network_header(skb), tmp_hdr, hlen); --- 34 unchanged lines hidden (view full) --- 737 ipv6_hdr(frag)->payload_len = 738 htons(frag->len - 739 sizeof(struct ipv6hdr)); 740 ip6_copy_metadata(frag, skb); 741 } 742 743 err = output(skb); 744 if(!err) |
738 IP6_INC_STATS(ip6_dst_idev(&rt->u.dst), IPSTATS_MIB_FRAGCREATES); | 745 IP6_INC_STATS(net, ip6_dst_idev(&rt->u.dst), 746 IPSTATS_MIB_FRAGCREATES); |
739 740 if (err || !frag) 741 break; 742 743 skb = frag; 744 frag = skb->next; 745 skb->next = NULL; 746 } 747 748 kfree(tmp_hdr); 749 750 if (err == 0) { | 747 748 if (err || !frag) 749 break; 750 751 skb = frag; 752 frag = skb->next; 753 skb->next = NULL; 754 } 755 756 kfree(tmp_hdr); 757 758 if (err == 0) { |
751 IP6_INC_STATS(ip6_dst_idev(&rt->u.dst), IPSTATS_MIB_FRAGOKS); | 759 IP6_INC_STATS(net, ip6_dst_idev(&rt->u.dst), 760 IPSTATS_MIB_FRAGOKS); |
752 dst_release(&rt->u.dst); 753 return 0; 754 } 755 756 while (frag) { 757 skb = frag->next; 758 kfree_skb(frag); 759 frag = skb; 760 } 761 | 761 dst_release(&rt->u.dst); 762 return 0; 763 } 764 765 while (frag) { 766 skb = frag->next; 767 kfree_skb(frag); 768 frag = skb; 769 } 770 |
762 IP6_INC_STATS(ip6_dst_idev(&rt->u.dst), IPSTATS_MIB_FRAGFAILS); | 771 IP6_INC_STATS(net, ip6_dst_idev(&rt->u.dst), 772 IPSTATS_MIB_FRAGFAILS); |
763 dst_release(&rt->u.dst); 764 return err; 765 } 766 767slow_path: 768 left = skb->len - hlen; /* Space per frame */ 769 ptr = hlen; /* Where to start from */ 770 --- 17 unchanged lines hidden (view full) --- 788 len &= ~7; 789 } 790 /* 791 * Allocate buffer. 792 */ 793 794 if ((frag = alloc_skb(len+hlen+sizeof(struct frag_hdr)+LL_ALLOCATED_SPACE(rt->u.dst.dev), GFP_ATOMIC)) == NULL) { 795 NETDEBUG(KERN_INFO "IPv6: frag: no memory for new fragment!\n"); | 773 dst_release(&rt->u.dst); 774 return err; 775 } 776 777slow_path: 778 left = skb->len - hlen; /* Space per frame */ 779 ptr = hlen; /* Where to start from */ 780 --- 17 unchanged lines hidden (view full) --- 798 len &= ~7; 799 } 800 /* 801 * Allocate buffer. 802 */ 803 804 if ((frag = alloc_skb(len+hlen+sizeof(struct frag_hdr)+LL_ALLOCATED_SPACE(rt->u.dst.dev), GFP_ATOMIC)) == NULL) { 805 NETDEBUG(KERN_INFO "IPv6: frag: no memory for new fragment!\n"); |
796 IP6_INC_STATS(ip6_dst_idev(skb->dst), | 806 IP6_INC_STATS(net, ip6_dst_idev(skb->dst), |
797 IPSTATS_MIB_FRAGFAILS); 798 err = -ENOMEM; 799 goto fail; 800 } 801 802 /* 803 * Set up data on packet 804 */ --- 47 unchanged lines hidden (view full) --- 852 853 /* 854 * Put this fragment into the sending queue. 855 */ 856 err = output(frag); 857 if (err) 858 goto fail; 859 | 807 IPSTATS_MIB_FRAGFAILS); 808 err = -ENOMEM; 809 goto fail; 810 } 811 812 /* 813 * Set up data on packet 814 */ --- 47 unchanged lines hidden (view full) --- 862 863 /* 864 * Put this fragment into the sending queue. 865 */ 866 err = output(frag); 867 if (err) 868 goto fail; 869 |
860 IP6_INC_STATS(ip6_dst_idev(skb->dst), IPSTATS_MIB_FRAGCREATES); | 870 IP6_INC_STATS(net, ip6_dst_idev(skb->dst), 871 IPSTATS_MIB_FRAGCREATES); |
861 } | 872 } |
862 IP6_INC_STATS(ip6_dst_idev(skb->dst), | 873 IP6_INC_STATS(net, ip6_dst_idev(skb->dst), |
863 IPSTATS_MIB_FRAGOKS); 864 kfree_skb(skb); 865 return err; 866 867fail: | 874 IPSTATS_MIB_FRAGOKS); 875 kfree_skb(skb); 876 return err; 877 878fail: |
868 IP6_INC_STATS(ip6_dst_idev(skb->dst), | 879 IP6_INC_STATS(net, ip6_dst_idev(skb->dst), |
869 IPSTATS_MIB_FRAGFAILS); 870 kfree_skb(skb); 871 return err; 872} 873 874static inline int ip6_rt_check(struct rt6key *rt_key, 875 struct in6_addr *fl_addr, 876 struct in6_addr *addr_cache) --- 503 unchanged lines hidden (view full) --- 1380 atomic_add(copy, &sk->sk_wmem_alloc); 1381 } 1382 offset += copy; 1383 length -= copy; 1384 } 1385 return 0; 1386error: 1387 inet->cork.length -= length; | 880 IPSTATS_MIB_FRAGFAILS); 881 kfree_skb(skb); 882 return err; 883} 884 885static inline int ip6_rt_check(struct rt6key *rt_key, 886 struct in6_addr *fl_addr, 887 struct in6_addr *addr_cache) --- 503 unchanged lines hidden (view full) --- 1391 atomic_add(copy, &sk->sk_wmem_alloc); 1392 } 1393 offset += copy; 1394 length -= copy; 1395 } 1396 return 0; 1397error: 1398 inet->cork.length -= length; |
1388 IP6_INC_STATS(rt->rt6i_idev, IPSTATS_MIB_OUTDISCARDS); | 1399 IP6_INC_STATS(sock_net(sk), rt->rt6i_idev, IPSTATS_MIB_OUTDISCARDS); |
1389 return err; 1390} 1391 1392static void ip6_cork_release(struct inet_sock *inet, struct ipv6_pinfo *np) 1393{ 1394 inet->cork.flags &= ~IPCORK_OPT; 1395 kfree(np->cork.opt); 1396 np->cork.opt = NULL; --- 7 unchanged lines hidden (view full) --- 1404 1405int ip6_push_pending_frames(struct sock *sk) 1406{ 1407 struct sk_buff *skb, *tmp_skb; 1408 struct sk_buff **tail_skb; 1409 struct in6_addr final_dst_buf, *final_dst = &final_dst_buf; 1410 struct inet_sock *inet = inet_sk(sk); 1411 struct ipv6_pinfo *np = inet6_sk(sk); | 1400 return err; 1401} 1402 1403static void ip6_cork_release(struct inet_sock *inet, struct ipv6_pinfo *np) 1404{ 1405 inet->cork.flags &= ~IPCORK_OPT; 1406 kfree(np->cork.opt); 1407 np->cork.opt = NULL; --- 7 unchanged lines hidden (view full) --- 1415 1416int ip6_push_pending_frames(struct sock *sk) 1417{ 1418 struct sk_buff *skb, *tmp_skb; 1419 struct sk_buff **tail_skb; 1420 struct in6_addr final_dst_buf, *final_dst = &final_dst_buf; 1421 struct inet_sock *inet = inet_sk(sk); 1422 struct ipv6_pinfo *np = inet6_sk(sk); |
1423 struct net *net = sock_net(sk); |
|
1412 struct ipv6hdr *hdr; 1413 struct ipv6_txoptions *opt = np->cork.opt; 1414 struct rt6_info *rt = (struct rt6_info *)inet->cork.dst; 1415 struct flowi *fl = &inet->cork.fl; 1416 unsigned char proto = fl->proto; 1417 int err = 0; 1418 1419 if ((skb = __skb_dequeue(&sk->sk_write_queue)) == NULL) --- 37 unchanged lines hidden (view full) --- 1457 hdr->nexthdr = proto; 1458 ipv6_addr_copy(&hdr->saddr, &fl->fl6_src); 1459 ipv6_addr_copy(&hdr->daddr, final_dst); 1460 1461 skb->priority = sk->sk_priority; 1462 skb->mark = sk->sk_mark; 1463 1464 skb->dst = dst_clone(&rt->u.dst); | 1424 struct ipv6hdr *hdr; 1425 struct ipv6_txoptions *opt = np->cork.opt; 1426 struct rt6_info *rt = (struct rt6_info *)inet->cork.dst; 1427 struct flowi *fl = &inet->cork.fl; 1428 unsigned char proto = fl->proto; 1429 int err = 0; 1430 1431 if ((skb = __skb_dequeue(&sk->sk_write_queue)) == NULL) --- 37 unchanged lines hidden (view full) --- 1469 hdr->nexthdr = proto; 1470 ipv6_addr_copy(&hdr->saddr, &fl->fl6_src); 1471 ipv6_addr_copy(&hdr->daddr, final_dst); 1472 1473 skb->priority = sk->sk_priority; 1474 skb->mark = sk->sk_mark; 1475 1476 skb->dst = dst_clone(&rt->u.dst); |
1465 IP6_INC_STATS(rt->rt6i_idev, IPSTATS_MIB_OUTREQUESTS); | 1477 IP6_INC_STATS(net, rt->rt6i_idev, IPSTATS_MIB_OUTREQUESTS); |
1466 if (proto == IPPROTO_ICMPV6) { 1467 struct inet6_dev *idev = ip6_dst_idev(skb->dst); 1468 1469 ICMP6MSGOUT_INC_STATS_BH(idev, icmp6_hdr(skb)->icmp6_type); 1470 ICMP6_INC_STATS_BH(idev, ICMP6_MIB_OUTMSGS); 1471 } 1472 1473 err = ip6_local_out(skb); --- 12 unchanged lines hidden (view full) --- 1486} 1487 1488void ip6_flush_pending_frames(struct sock *sk) 1489{ 1490 struct sk_buff *skb; 1491 1492 while ((skb = __skb_dequeue_tail(&sk->sk_write_queue)) != NULL) { 1493 if (skb->dst) | 1478 if (proto == IPPROTO_ICMPV6) { 1479 struct inet6_dev *idev = ip6_dst_idev(skb->dst); 1480 1481 ICMP6MSGOUT_INC_STATS_BH(idev, icmp6_hdr(skb)->icmp6_type); 1482 ICMP6_INC_STATS_BH(idev, ICMP6_MIB_OUTMSGS); 1483 } 1484 1485 err = ip6_local_out(skb); --- 12 unchanged lines hidden (view full) --- 1498} 1499 1500void ip6_flush_pending_frames(struct sock *sk) 1501{ 1502 struct sk_buff *skb; 1503 1504 while ((skb = __skb_dequeue_tail(&sk->sk_write_queue)) != NULL) { 1505 if (skb->dst) |
1494 IP6_INC_STATS(ip6_dst_idev(skb->dst), | 1506 IP6_INC_STATS(sock_net(sk), ip6_dst_idev(skb->dst), |
1495 IPSTATS_MIB_OUTDISCARDS); 1496 kfree_skb(skb); 1497 } 1498 1499 ip6_cork_release(inet_sk(sk), inet6_sk(sk)); 1500} | 1507 IPSTATS_MIB_OUTDISCARDS); 1508 kfree_skb(skb); 1509 } 1510 1511 ip6_cork_release(inet_sk(sk), inet6_sk(sk)); 1512} |