icmp.c (9a64e8e0ace51b309fdcff4b4754b3649250382a) | icmp.c (81aded24675ebda5de8a68843250ad15584ac38a) |
---|---|
1/* 2 * Internet Control Message Protocol (ICMPv6) 3 * Linux INET6 implementation 4 * 5 * Authors: 6 * Pedro Roque <roque@di.fc.ul.pt> 7 * 8 * Based on net/ipv4/icmp.c --- 174 unchanged lines hidden (view full) --- 183 if (dst->error) { 184 IP6_INC_STATS(net, ip6_dst_idev(dst), 185 IPSTATS_MIB_OUTNOROUTES); 186 } else if (dst->dev && (dst->dev->flags&IFF_LOOPBACK)) { 187 res = true; 188 } else { 189 struct rt6_info *rt = (struct rt6_info *)dst; 190 int tmo = net->ipv6.sysctl.icmpv6_time; | 1/* 2 * Internet Control Message Protocol (ICMPv6) 3 * Linux INET6 implementation 4 * 5 * Authors: 6 * Pedro Roque <roque@di.fc.ul.pt> 7 * 8 * Based on net/ipv4/icmp.c --- 174 unchanged lines hidden (view full) --- 183 if (dst->error) { 184 IP6_INC_STATS(net, ip6_dst_idev(dst), 185 IPSTATS_MIB_OUTNOROUTES); 186 } else if (dst->dev && (dst->dev->flags&IFF_LOOPBACK)) { 187 res = true; 188 } else { 189 struct rt6_info *rt = (struct rt6_info *)dst; 190 int tmo = net->ipv6.sysctl.icmpv6_time; |
191 struct inet_peer *peer; |
|
191 192 /* Give more bandwidth to wider prefixes. */ 193 if (rt->rt6i_dst.plen < 128) 194 tmo >>= ((128 - rt->rt6i_dst.plen)>>5); 195 | 192 193 /* Give more bandwidth to wider prefixes. */ 194 if (rt->rt6i_dst.plen < 128) 195 tmo >>= ((128 - rt->rt6i_dst.plen)>>5); 196 |
196 if (!rt->rt6i_peer) 197 rt6_bind_peer(rt, 1); 198 res = inet_peer_xrlim_allow(rt->rt6i_peer, tmo); | 197 peer = rt6_get_peer_create(rt); 198 res = inet_peer_xrlim_allow(peer, tmo); |
199 } 200 dst_release(dst); 201 return res; 202} 203 204/* 205 * an inline helper for the "simple" if statement below 206 * checks if parameter problem report is caused by an --- 437 unchanged lines hidden (view full) --- 644 * Handle icmp messages 645 */ 646 647static int icmpv6_rcv(struct sk_buff *skb) 648{ 649 struct net_device *dev = skb->dev; 650 struct inet6_dev *idev = __in6_dev_get(dev); 651 const struct in6_addr *saddr, *daddr; | 199 } 200 dst_release(dst); 201 return res; 202} 203 204/* 205 * an inline helper for the "simple" if statement below 206 * checks if parameter problem report is caused by an --- 437 unchanged lines hidden (view full) --- 644 * Handle icmp messages 645 */ 646 647static int icmpv6_rcv(struct sk_buff *skb) 648{ 649 struct net_device *dev = skb->dev; 650 struct inet6_dev *idev = __in6_dev_get(dev); 651 const struct in6_addr *saddr, *daddr; |
652 const struct ipv6hdr *orig_hdr; | |
653 struct icmp6hdr *hdr; 654 u8 type; 655 656 if (!xfrm6_policy_check(NULL, XFRM_POLICY_IN, skb)) { 657 struct sec_path *sp = skb_sec_path(skb); 658 int nh; 659 660 if (!(sp && sp->xvec[sp->len - 1]->props.flags & 661 XFRM_STATE_ICMP)) 662 goto drop_no_count; 663 | 652 struct icmp6hdr *hdr; 653 u8 type; 654 655 if (!xfrm6_policy_check(NULL, XFRM_POLICY_IN, skb)) { 656 struct sec_path *sp = skb_sec_path(skb); 657 int nh; 658 659 if (!(sp && sp->xvec[sp->len - 1]->props.flags & 660 XFRM_STATE_ICMP)) 661 goto drop_no_count; 662 |
664 if (!pskb_may_pull(skb, sizeof(*hdr) + sizeof(*orig_hdr))) | 663 if (!pskb_may_pull(skb, sizeof(*hdr) + sizeof(struct ipv6hdr))) |
665 goto drop_no_count; 666 667 nh = skb_network_offset(skb); 668 skb_set_network_header(skb, sizeof(*hdr)); 669 670 if (!xfrm6_policy_check_reverse(NULL, XFRM_POLICY_IN, skb)) 671 goto drop_no_count; 672 --- 44 unchanged lines hidden (view full) --- 717 /* BUGGG_FUTURE: if packet contains rthdr, we cannot update 718 standard destination cache. Seems, only "advanced" 719 destination cache will allow to solve this problem 720 --ANK (980726) 721 */ 722 if (!pskb_may_pull(skb, sizeof(struct ipv6hdr))) 723 goto discard_it; 724 hdr = icmp6_hdr(skb); | 664 goto drop_no_count; 665 666 nh = skb_network_offset(skb); 667 skb_set_network_header(skb, sizeof(*hdr)); 668 669 if (!xfrm6_policy_check_reverse(NULL, XFRM_POLICY_IN, skb)) 670 goto drop_no_count; 671 --- 44 unchanged lines hidden (view full) --- 716 /* BUGGG_FUTURE: if packet contains rthdr, we cannot update 717 standard destination cache. Seems, only "advanced" 718 destination cache will allow to solve this problem 719 --ANK (980726) 720 */ 721 if (!pskb_may_pull(skb, sizeof(struct ipv6hdr))) 722 goto discard_it; 723 hdr = icmp6_hdr(skb); |
725 orig_hdr = (struct ipv6hdr *) (hdr + 1); 726 rt6_pmtu_discovery(&orig_hdr->daddr, &orig_hdr->saddr, dev, 727 ntohl(hdr->icmp6_mtu)); | |
728 729 /* 730 * Drop through to notify 731 */ 732 733 case ICMPV6_DEST_UNREACH: 734 case ICMPV6_TIME_EXCEED: 735 case ICMPV6_PARAMPROB: --- 246 unchanged lines hidden --- | 724 725 /* 726 * Drop through to notify 727 */ 728 729 case ICMPV6_DEST_UNREACH: 730 case ICMPV6_TIME_EXCEED: 731 case ICMPV6_PARAMPROB: --- 246 unchanged lines hidden --- |