diff options
Diffstat (limited to 'net/ipv6/exthdrs.c')
| -rw-r--r-- | net/ipv6/exthdrs.c | 37 |
1 files changed, 30 insertions, 7 deletions
diff --git a/net/ipv6/exthdrs.c b/net/ipv6/exthdrs.c index 4bac362b1335..262f105d23b9 100644 --- a/net/ipv6/exthdrs.c +++ b/net/ipv6/exthdrs.c | |||
| @@ -29,6 +29,7 @@ | |||
| 29 | #include <linux/netdevice.h> | 29 | #include <linux/netdevice.h> |
| 30 | #include <linux/in6.h> | 30 | #include <linux/in6.h> |
| 31 | #include <linux/icmpv6.h> | 31 | #include <linux/icmpv6.h> |
| 32 | #include <linux/slab.h> | ||
| 32 | 33 | ||
| 33 | #include <net/dst.h> | 34 | #include <net/dst.h> |
| 34 | #include <net/sock.h> | 35 | #include <net/sock.h> |
| @@ -311,6 +312,7 @@ static int ipv6_destopt_rcv(struct sk_buff *skb) | |||
| 311 | Routing header. | 312 | Routing header. |
| 312 | ********************************/ | 313 | ********************************/ |
| 313 | 314 | ||
| 315 | /* called with rcu_read_lock() */ | ||
| 314 | static int ipv6_rthdr_rcv(struct sk_buff *skb) | 316 | static int ipv6_rthdr_rcv(struct sk_buff *skb) |
| 315 | { | 317 | { |
| 316 | struct inet6_skb_parm *opt = IP6CB(skb); | 318 | struct inet6_skb_parm *opt = IP6CB(skb); |
| @@ -323,12 +325,9 @@ static int ipv6_rthdr_rcv(struct sk_buff *skb) | |||
| 323 | struct net *net = dev_net(skb->dev); | 325 | struct net *net = dev_net(skb->dev); |
| 324 | int accept_source_route = net->ipv6.devconf_all->accept_source_route; | 326 | int accept_source_route = net->ipv6.devconf_all->accept_source_route; |
| 325 | 327 | ||
| 326 | idev = in6_dev_get(skb->dev); | 328 | idev = __in6_dev_get(skb->dev); |
| 327 | if (idev) { | 329 | if (idev && accept_source_route > idev->cnf.accept_source_route) |
| 328 | if (accept_source_route > idev->cnf.accept_source_route) | 330 | accept_source_route = idev->cnf.accept_source_route; |
| 329 | accept_source_route = idev->cnf.accept_source_route; | ||
| 330 | in6_dev_put(idev); | ||
| 331 | } | ||
| 332 | 331 | ||
| 333 | if (!pskb_may_pull(skb, skb_transport_offset(skb) + 8) || | 332 | if (!pskb_may_pull(skb, skb_transport_offset(skb) + 8) || |
| 334 | !pskb_may_pull(skb, (skb_transport_offset(skb) + | 333 | !pskb_may_pull(skb, (skb_transport_offset(skb) + |
| @@ -481,7 +480,7 @@ looped_back: | |||
| 481 | IP6_INC_STATS_BH(net, ip6_dst_idev(skb_dst(skb)), | 480 | IP6_INC_STATS_BH(net, ip6_dst_idev(skb_dst(skb)), |
| 482 | IPSTATS_MIB_INHDRERRORS); | 481 | IPSTATS_MIB_INHDRERRORS); |
| 483 | icmpv6_send(skb, ICMPV6_TIME_EXCEED, ICMPV6_EXC_HOPLIMIT, | 482 | icmpv6_send(skb, ICMPV6_TIME_EXCEED, ICMPV6_EXC_HOPLIMIT, |
| 484 | 0, skb->dev); | 483 | 0); |
| 485 | kfree_skb(skb); | 484 | kfree_skb(skb); |
| 486 | return -1; | 485 | return -1; |
| 487 | } | 486 | } |
| @@ -873,3 +872,27 @@ struct ipv6_txoptions *ipv6_fixup_options(struct ipv6_txoptions *opt_space, | |||
| 873 | return opt; | 872 | return opt; |
| 874 | } | 873 | } |
| 875 | 874 | ||
| 875 | /** | ||
| 876 | * fl6_update_dst - update flowi destination address with info given | ||
| 877 | * by srcrt option, if any. | ||
| 878 | * | ||
| 879 | * @fl: flowi for which fl6_dst is to be updated | ||
| 880 | * @opt: struct ipv6_txoptions in which to look for srcrt opt | ||
| 881 | * @orig: copy of original fl6_dst address if modified | ||
| 882 | * | ||
| 883 | * Returns NULL if no txoptions or no srcrt, otherwise returns orig | ||
| 884 | * and initial value of fl->fl6_dst set in orig | ||
| 885 | */ | ||
| 886 | struct in6_addr *fl6_update_dst(struct flowi *fl, | ||
| 887 | const struct ipv6_txoptions *opt, | ||
| 888 | struct in6_addr *orig) | ||
| 889 | { | ||
| 890 | if (!opt || !opt->srcrt) | ||
| 891 | return NULL; | ||
| 892 | |||
| 893 | ipv6_addr_copy(orig, &fl->fl6_dst); | ||
| 894 | ipv6_addr_copy(&fl->fl6_dst, ((struct rt0_hdr *)opt->srcrt)->addr); | ||
| 895 | return orig; | ||
| 896 | } | ||
| 897 | |||
| 898 | EXPORT_SYMBOL_GPL(fl6_update_dst); | ||
