diff options
Diffstat (limited to 'net/ipv6')
-rw-r--r-- | net/ipv6/icmp.c | 6 | ||||
-rw-r--r-- | net/ipv6/ip6_output.c | 11 | ||||
-rw-r--r-- | net/ipv6/ndisc.c | 6 | ||||
-rw-r--r-- | net/ipv6/route.c | 5 | ||||
-rw-r--r-- | net/ipv6/tcp_ipv6.c | 4 |
5 files changed, 12 insertions, 20 deletions
diff --git a/net/ipv6/icmp.c b/net/ipv6/icmp.c index 091a2971c7b7..ed89bba745a1 100644 --- a/net/ipv6/icmp.c +++ b/net/ipv6/icmp.c | |||
@@ -188,14 +188,14 @@ static inline bool icmpv6_xrlim_allow(struct sock *sk, u8 type, | |||
188 | } else { | 188 | } else { |
189 | struct rt6_info *rt = (struct rt6_info *)dst; | 189 | struct rt6_info *rt = (struct rt6_info *)dst; |
190 | int tmo = net->ipv6.sysctl.icmpv6_time; | 190 | int tmo = net->ipv6.sysctl.icmpv6_time; |
191 | struct inet_peer *peer; | ||
191 | 192 | ||
192 | /* Give more bandwidth to wider prefixes. */ | 193 | /* Give more bandwidth to wider prefixes. */ |
193 | if (rt->rt6i_dst.plen < 128) | 194 | if (rt->rt6i_dst.plen < 128) |
194 | tmo >>= ((128 - rt->rt6i_dst.plen)>>5); | 195 | tmo >>= ((128 - rt->rt6i_dst.plen)>>5); |
195 | 196 | ||
196 | if (!rt->rt6i_peer) | 197 | peer = rt6_get_peer_create(rt); |
197 | rt6_bind_peer(rt, 1); | 198 | res = inet_peer_xrlim_allow(peer, tmo); |
198 | res = inet_peer_xrlim_allow(rt->rt6i_peer, tmo); | ||
199 | } | 199 | } |
200 | dst_release(dst); | 200 | dst_release(dst); |
201 | return res; | 201 | return res; |
diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c index 17b8c67998bb..62fcf3e48aca 100644 --- a/net/ipv6/ip6_output.c +++ b/net/ipv6/ip6_output.c | |||
@@ -463,6 +463,7 @@ int ip6_forward(struct sk_buff *skb) | |||
463 | */ | 463 | */ |
464 | if (skb->dev == dst->dev && opt->srcrt == 0 && !skb_sec_path(skb)) { | 464 | if (skb->dev == dst->dev && opt->srcrt == 0 && !skb_sec_path(skb)) { |
465 | struct in6_addr *target = NULL; | 465 | struct in6_addr *target = NULL; |
466 | struct inet_peer *peer; | ||
466 | struct rt6_info *rt; | 467 | struct rt6_info *rt; |
467 | 468 | ||
468 | /* | 469 | /* |
@@ -476,13 +477,12 @@ int ip6_forward(struct sk_buff *skb) | |||
476 | else | 477 | else |
477 | target = &hdr->daddr; | 478 | target = &hdr->daddr; |
478 | 479 | ||
479 | if (!rt->rt6i_peer) | 480 | peer = rt6_get_peer_create(rt); |
480 | rt6_bind_peer(rt, 1); | ||
481 | 481 | ||
482 | /* Limit redirects both by destination (here) | 482 | /* Limit redirects both by destination (here) |
483 | and by source (inside ndisc_send_redirect) | 483 | and by source (inside ndisc_send_redirect) |
484 | */ | 484 | */ |
485 | if (inet_peer_xrlim_allow(rt->rt6i_peer, 1*HZ)) | 485 | if (inet_peer_xrlim_allow(peer, 1*HZ)) |
486 | ndisc_send_redirect(skb, target); | 486 | ndisc_send_redirect(skb, target); |
487 | } else { | 487 | } else { |
488 | int addrtype = ipv6_addr_type(&hdr->saddr); | 488 | int addrtype = ipv6_addr_type(&hdr->saddr); |
@@ -602,11 +602,8 @@ void ipv6_select_ident(struct frag_hdr *fhdr, struct rt6_info *rt) | |||
602 | int old, new; | 602 | int old, new; |
603 | 603 | ||
604 | if (rt && !(rt->dst.flags & DST_NOPEER)) { | 604 | if (rt && !(rt->dst.flags & DST_NOPEER)) { |
605 | struct inet_peer *peer; | 605 | struct inet_peer *peer = rt6_get_peer_create(rt); |
606 | 606 | ||
607 | if (!rt->rt6i_peer) | ||
608 | rt6_bind_peer(rt, 1); | ||
609 | peer = rt->rt6i_peer; | ||
610 | if (peer) { | 607 | if (peer) { |
611 | fhdr->identification = htonl(inet_getid(peer, 0)); | 608 | fhdr->identification = htonl(inet_getid(peer, 0)); |
612 | return; | 609 | return; |
diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c index 54f62d3b8dd6..69a6330dea91 100644 --- a/net/ipv6/ndisc.c +++ b/net/ipv6/ndisc.c | |||
@@ -1472,6 +1472,7 @@ void ndisc_send_redirect(struct sk_buff *skb, const struct in6_addr *target) | |||
1472 | struct net *net = dev_net(dev); | 1472 | struct net *net = dev_net(dev); |
1473 | struct sock *sk = net->ipv6.ndisc_sk; | 1473 | struct sock *sk = net->ipv6.ndisc_sk; |
1474 | int len = sizeof(struct icmp6hdr) + 2 * sizeof(struct in6_addr); | 1474 | int len = sizeof(struct icmp6hdr) + 2 * sizeof(struct in6_addr); |
1475 | struct inet_peer *peer; | ||
1475 | struct sk_buff *buff; | 1476 | struct sk_buff *buff; |
1476 | struct icmp6hdr *icmph; | 1477 | struct icmp6hdr *icmph; |
1477 | struct in6_addr saddr_buf; | 1478 | struct in6_addr saddr_buf; |
@@ -1518,9 +1519,8 @@ void ndisc_send_redirect(struct sk_buff *skb, const struct in6_addr *target) | |||
1518 | "Redirect: destination is not a neighbour\n"); | 1519 | "Redirect: destination is not a neighbour\n"); |
1519 | goto release; | 1520 | goto release; |
1520 | } | 1521 | } |
1521 | if (!rt->rt6i_peer) | 1522 | peer = rt6_get_peer_create(rt); |
1522 | rt6_bind_peer(rt, 1); | 1523 | if (!inet_peer_xrlim_allow(peer, 1*HZ)) |
1523 | if (!inet_peer_xrlim_allow(rt->rt6i_peer, 1*HZ)) | ||
1524 | goto release; | 1524 | goto release; |
1525 | 1525 | ||
1526 | if (dev->addr_len) { | 1526 | if (dev->addr_len) { |
diff --git a/net/ipv6/route.c b/net/ipv6/route.c index 4eca0130cce7..8a986be4aeda 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c | |||
@@ -99,10 +99,7 @@ static u32 *ipv6_cow_metrics(struct dst_entry *dst, unsigned long old) | |||
99 | if (!(rt->dst.flags & DST_HOST)) | 99 | if (!(rt->dst.flags & DST_HOST)) |
100 | return NULL; | 100 | return NULL; |
101 | 101 | ||
102 | if (!rt->rt6i_peer) | 102 | peer = rt6_get_peer_create(rt); |
103 | rt6_bind_peer(rt, 1); | ||
104 | |||
105 | peer = rt->rt6i_peer; | ||
106 | if (peer) { | 103 | if (peer) { |
107 | u32 *old_p = __DST_METRICS_PTR(old); | 104 | u32 *old_p = __DST_METRICS_PTR(old); |
108 | unsigned long prev, new; | 105 | unsigned long prev, new; |
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c index 1a9cdd09f11c..218433cb9928 100644 --- a/net/ipv6/tcp_ipv6.c +++ b/net/ipv6/tcp_ipv6.c | |||
@@ -1744,9 +1744,7 @@ static struct inet_peer *tcp_v6_get_peer(struct sock *sk, bool *release_it) | |||
1744 | peer = inet_getpeer_v6(net, &np->daddr, 1); | 1744 | peer = inet_getpeer_v6(net, &np->daddr, 1); |
1745 | *release_it = true; | 1745 | *release_it = true; |
1746 | } else { | 1746 | } else { |
1747 | if (!rt->rt6i_peer) | 1747 | peer = rt6_get_peer_create(rt); |
1748 | rt6_bind_peer(rt, 1); | ||
1749 | peer = rt->rt6i_peer; | ||
1750 | *release_it = false; | 1748 | *release_it = false; |
1751 | } | 1749 | } |
1752 | 1750 | ||