diff options
Diffstat (limited to 'net/ipv6/raw.c')
-rw-r--r-- | net/ipv6/raw.c | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/net/ipv6/raw.c b/net/ipv6/raw.c index 58916bbb1728..e24ff1df0401 100644 --- a/net/ipv6/raw.c +++ b/net/ipv6/raw.c | |||
@@ -77,20 +77,19 @@ static struct sock *__raw_v6_lookup(struct net *net, struct sock *sk, | |||
77 | 77 | ||
78 | sk_for_each_from(sk) | 78 | sk_for_each_from(sk) |
79 | if (inet_sk(sk)->inet_num == num) { | 79 | if (inet_sk(sk)->inet_num == num) { |
80 | struct ipv6_pinfo *np = inet6_sk(sk); | ||
81 | 80 | ||
82 | if (!net_eq(sock_net(sk), net)) | 81 | if (!net_eq(sock_net(sk), net)) |
83 | continue; | 82 | continue; |
84 | 83 | ||
85 | if (!ipv6_addr_any(&np->daddr) && | 84 | if (!ipv6_addr_any(&sk->sk_v6_daddr) && |
86 | !ipv6_addr_equal(&np->daddr, rmt_addr)) | 85 | !ipv6_addr_equal(&sk->sk_v6_daddr, rmt_addr)) |
87 | continue; | 86 | continue; |
88 | 87 | ||
89 | if (sk->sk_bound_dev_if && sk->sk_bound_dev_if != dif) | 88 | if (sk->sk_bound_dev_if && sk->sk_bound_dev_if != dif) |
90 | continue; | 89 | continue; |
91 | 90 | ||
92 | if (!ipv6_addr_any(&np->rcv_saddr)) { | 91 | if (!ipv6_addr_any(&sk->sk_v6_rcv_saddr)) { |
93 | if (ipv6_addr_equal(&np->rcv_saddr, loc_addr)) | 92 | if (ipv6_addr_equal(&sk->sk_v6_rcv_saddr, loc_addr)) |
94 | goto found; | 93 | goto found; |
95 | if (is_multicast && | 94 | if (is_multicast && |
96 | inet6_mc_check(sk, loc_addr, rmt_addr)) | 95 | inet6_mc_check(sk, loc_addr, rmt_addr)) |
@@ -302,7 +301,7 @@ static int rawv6_bind(struct sock *sk, struct sockaddr *uaddr, int addr_len) | |||
302 | } | 301 | } |
303 | 302 | ||
304 | inet->inet_rcv_saddr = inet->inet_saddr = v4addr; | 303 | inet->inet_rcv_saddr = inet->inet_saddr = v4addr; |
305 | np->rcv_saddr = addr->sin6_addr; | 304 | sk->sk_v6_rcv_saddr = addr->sin6_addr; |
306 | if (!(addr_type & IPV6_ADDR_MULTICAST)) | 305 | if (!(addr_type & IPV6_ADDR_MULTICAST)) |
307 | np->saddr = addr->sin6_addr; | 306 | np->saddr = addr->sin6_addr; |
308 | err = 0; | 307 | err = 0; |
@@ -335,8 +334,10 @@ static void rawv6_err(struct sock *sk, struct sk_buff *skb, | |||
335 | ip6_sk_update_pmtu(skb, sk, info); | 334 | ip6_sk_update_pmtu(skb, sk, info); |
336 | harderr = (np->pmtudisc == IPV6_PMTUDISC_DO); | 335 | harderr = (np->pmtudisc == IPV6_PMTUDISC_DO); |
337 | } | 336 | } |
338 | if (type == NDISC_REDIRECT) | 337 | if (type == NDISC_REDIRECT) { |
339 | ip6_sk_redirect(skb, sk); | 338 | ip6_sk_redirect(skb, sk); |
339 | return; | ||
340 | } | ||
340 | if (np->recverr) { | 341 | if (np->recverr) { |
341 | u8 *payload = skb->data; | 342 | u8 *payload = skb->data; |
342 | if (!inet->hdrincl) | 343 | if (!inet->hdrincl) |
@@ -464,9 +465,6 @@ static int rawv6_recvmsg(struct kiocb *iocb, struct sock *sk, | |||
464 | if (flags & MSG_OOB) | 465 | if (flags & MSG_OOB) |
465 | return -EOPNOTSUPP; | 466 | return -EOPNOTSUPP; |
466 | 467 | ||
467 | if (addr_len) | ||
468 | *addr_len=sizeof(*sin6); | ||
469 | |||
470 | if (flags & MSG_ERRQUEUE) | 468 | if (flags & MSG_ERRQUEUE) |
471 | return ipv6_recv_error(sk, msg, len); | 469 | return ipv6_recv_error(sk, msg, len); |
472 | 470 | ||
@@ -505,6 +503,7 @@ static int rawv6_recvmsg(struct kiocb *iocb, struct sock *sk, | |||
505 | sin6->sin6_flowinfo = 0; | 503 | sin6->sin6_flowinfo = 0; |
506 | sin6->sin6_scope_id = ipv6_iface_scope_id(&sin6->sin6_addr, | 504 | sin6->sin6_scope_id = ipv6_iface_scope_id(&sin6->sin6_addr, |
507 | IP6CB(skb)->iif); | 505 | IP6CB(skb)->iif); |
506 | *addr_len = sizeof(*sin6); | ||
508 | } | 507 | } |
509 | 508 | ||
510 | sock_recv_ts_and_drops(msg, sk, skb); | 509 | sock_recv_ts_and_drops(msg, sk, skb); |
@@ -802,8 +801,8 @@ static int rawv6_sendmsg(struct kiocb *iocb, struct sock *sk, | |||
802 | * sk->sk_dst_cache. | 801 | * sk->sk_dst_cache. |
803 | */ | 802 | */ |
804 | if (sk->sk_state == TCP_ESTABLISHED && | 803 | if (sk->sk_state == TCP_ESTABLISHED && |
805 | ipv6_addr_equal(daddr, &np->daddr)) | 804 | ipv6_addr_equal(daddr, &sk->sk_v6_daddr)) |
806 | daddr = &np->daddr; | 805 | daddr = &sk->sk_v6_daddr; |
807 | 806 | ||
808 | if (addr_len >= sizeof(struct sockaddr_in6) && | 807 | if (addr_len >= sizeof(struct sockaddr_in6) && |
809 | sin6->sin6_scope_id && | 808 | sin6->sin6_scope_id && |
@@ -814,7 +813,7 @@ static int rawv6_sendmsg(struct kiocb *iocb, struct sock *sk, | |||
814 | return -EDESTADDRREQ; | 813 | return -EDESTADDRREQ; |
815 | 814 | ||
816 | proto = inet->inet_num; | 815 | proto = inet->inet_num; |
817 | daddr = &np->daddr; | 816 | daddr = &sk->sk_v6_daddr; |
818 | fl6.flowlabel = np->flow_label; | 817 | fl6.flowlabel = np->flow_label; |
819 | } | 818 | } |
820 | 819 | ||