diff options
-rw-r--r-- | net/ipv6/af_inet6.c | 6 | ||||
-rw-r--r-- | net/ipv6/datagram.c | 16 | ||||
-rw-r--r-- | net/ipv6/icmp.c | 2 | ||||
-rw-r--r-- | net/ipv6/inet6_connection_sock.c | 6 | ||||
-rw-r--r-- | net/ipv6/raw.c | 9 | ||||
-rw-r--r-- | net/ipv6/udp.c | 13 |
6 files changed, 26 insertions, 26 deletions
diff --git a/net/ipv6/af_inet6.c b/net/ipv6/af_inet6.c index 6b793bfc0e10..f56277f15903 100644 --- a/net/ipv6/af_inet6.c +++ b/net/ipv6/af_inet6.c | |||
@@ -323,7 +323,7 @@ int inet6_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) | |||
323 | struct net_device *dev = NULL; | 323 | struct net_device *dev = NULL; |
324 | 324 | ||
325 | rcu_read_lock(); | 325 | rcu_read_lock(); |
326 | if (addr_type & IPV6_ADDR_LINKLOCAL) { | 326 | if (__ipv6_addr_needs_scope_id(addr_type)) { |
327 | if (addr_len >= sizeof(struct sockaddr_in6) && | 327 | if (addr_len >= sizeof(struct sockaddr_in6) && |
328 | addr->sin6_scope_id) { | 328 | addr->sin6_scope_id) { |
329 | /* Override any existing binding, if another one | 329 | /* Override any existing binding, if another one |
@@ -471,8 +471,8 @@ int inet6_getname(struct socket *sock, struct sockaddr *uaddr, | |||
471 | 471 | ||
472 | sin->sin6_port = inet->inet_sport; | 472 | sin->sin6_port = inet->inet_sport; |
473 | } | 473 | } |
474 | if (ipv6_addr_type(&sin->sin6_addr) & IPV6_ADDR_LINKLOCAL) | 474 | sin->sin6_scope_id = ipv6_iface_scope_id(&sin->sin6_addr, |
475 | sin->sin6_scope_id = sk->sk_bound_dev_if; | 475 | sk->sk_bound_dev_if); |
476 | *uaddr_len = sizeof(*sin); | 476 | *uaddr_len = sizeof(*sin); |
477 | return 0; | 477 | return 0; |
478 | } | 478 | } |
diff --git a/net/ipv6/datagram.c b/net/ipv6/datagram.c index f5a54782a340..b55e70add93c 100644 --- a/net/ipv6/datagram.c +++ b/net/ipv6/datagram.c | |||
@@ -124,7 +124,7 @@ ipv4_connected: | |||
124 | goto out; | 124 | goto out; |
125 | } | 125 | } |
126 | 126 | ||
127 | if (addr_type&IPV6_ADDR_LINKLOCAL) { | 127 | if (__ipv6_addr_needs_scope_id(addr_type)) { |
128 | if (addr_len >= sizeof(struct sockaddr_in6) && | 128 | if (addr_len >= sizeof(struct sockaddr_in6) && |
129 | usin->sin6_scope_id) { | 129 | usin->sin6_scope_id) { |
130 | if (sk->sk_bound_dev_if && | 130 | if (sk->sk_bound_dev_if && |
@@ -355,18 +355,19 @@ int ipv6_recv_error(struct sock *sk, struct msghdr *msg, int len) | |||
355 | sin->sin6_family = AF_INET6; | 355 | sin->sin6_family = AF_INET6; |
356 | sin->sin6_flowinfo = 0; | 356 | sin->sin6_flowinfo = 0; |
357 | sin->sin6_port = serr->port; | 357 | sin->sin6_port = serr->port; |
358 | sin->sin6_scope_id = 0; | ||
359 | if (skb->protocol == htons(ETH_P_IPV6)) { | 358 | if (skb->protocol == htons(ETH_P_IPV6)) { |
360 | const struct ipv6hdr *ip6h = container_of((struct in6_addr *)(nh + serr->addr_offset), | 359 | const struct ipv6hdr *ip6h = container_of((struct in6_addr *)(nh + serr->addr_offset), |
361 | struct ipv6hdr, daddr); | 360 | struct ipv6hdr, daddr); |
362 | sin->sin6_addr = ip6h->daddr; | 361 | sin->sin6_addr = ip6h->daddr; |
363 | if (np->sndflow) | 362 | if (np->sndflow) |
364 | sin->sin6_flowinfo = ip6_flowinfo(ip6h); | 363 | sin->sin6_flowinfo = ip6_flowinfo(ip6h); |
365 | if (ipv6_addr_type(&sin->sin6_addr) & IPV6_ADDR_LINKLOCAL) | 364 | sin->sin6_scope_id = |
366 | sin->sin6_scope_id = IP6CB(skb)->iif; | 365 | ipv6_iface_scope_id(&sin->sin6_addr, |
366 | IP6CB(skb)->iif); | ||
367 | } else { | 367 | } else { |
368 | ipv6_addr_set_v4mapped(*(__be32 *)(nh + serr->addr_offset), | 368 | ipv6_addr_set_v4mapped(*(__be32 *)(nh + serr->addr_offset), |
369 | &sin->sin6_addr); | 369 | &sin->sin6_addr); |
370 | sin->sin6_scope_id = 0; | ||
370 | } | 371 | } |
371 | } | 372 | } |
372 | 373 | ||
@@ -376,18 +377,19 @@ int ipv6_recv_error(struct sock *sk, struct msghdr *msg, int len) | |||
376 | if (serr->ee.ee_origin != SO_EE_ORIGIN_LOCAL) { | 377 | if (serr->ee.ee_origin != SO_EE_ORIGIN_LOCAL) { |
377 | sin->sin6_family = AF_INET6; | 378 | sin->sin6_family = AF_INET6; |
378 | sin->sin6_flowinfo = 0; | 379 | sin->sin6_flowinfo = 0; |
379 | sin->sin6_scope_id = 0; | ||
380 | if (skb->protocol == htons(ETH_P_IPV6)) { | 380 | if (skb->protocol == htons(ETH_P_IPV6)) { |
381 | sin->sin6_addr = ipv6_hdr(skb)->saddr; | 381 | sin->sin6_addr = ipv6_hdr(skb)->saddr; |
382 | if (np->rxopt.all) | 382 | if (np->rxopt.all) |
383 | ip6_datagram_recv_ctl(sk, msg, skb); | 383 | ip6_datagram_recv_ctl(sk, msg, skb); |
384 | if (ipv6_addr_type(&sin->sin6_addr) & IPV6_ADDR_LINKLOCAL) | 384 | sin->sin6_scope_id = |
385 | sin->sin6_scope_id = IP6CB(skb)->iif; | 385 | ipv6_iface_scope_id(&sin->sin6_addr, |
386 | IP6CB(skb)->iif); | ||
386 | } else { | 387 | } else { |
387 | struct inet_sock *inet = inet_sk(sk); | 388 | struct inet_sock *inet = inet_sk(sk); |
388 | 389 | ||
389 | ipv6_addr_set_v4mapped(ip_hdr(skb)->saddr, | 390 | ipv6_addr_set_v4mapped(ip_hdr(skb)->saddr, |
390 | &sin->sin6_addr); | 391 | &sin->sin6_addr); |
392 | sin->sin6_scope_id = 0; | ||
391 | if (inet->cmsg_flags) | 393 | if (inet->cmsg_flags) |
392 | ip_cmsg_recv(msg, skb); | 394 | ip_cmsg_recv(msg, skb); |
393 | } | 395 | } |
diff --git a/net/ipv6/icmp.c b/net/ipv6/icmp.c index fff5bdd8b680..71b900c3f4ff 100644 --- a/net/ipv6/icmp.c +++ b/net/ipv6/icmp.c | |||
@@ -434,7 +434,7 @@ void icmpv6_send(struct sk_buff *skb, u8 type, u8 code, __u32 info) | |||
434 | * Source addr check | 434 | * Source addr check |
435 | */ | 435 | */ |
436 | 436 | ||
437 | if (addr_type & IPV6_ADDR_LINKLOCAL) | 437 | if (__ipv6_addr_needs_scope_id(addr_type)) |
438 | iif = skb->dev->ifindex; | 438 | iif = skb->dev->ifindex; |
439 | 439 | ||
440 | /* | 440 | /* |
diff --git a/net/ipv6/inet6_connection_sock.c b/net/ipv6/inet6_connection_sock.c index 5f25510f584e..e4311cbc8b4e 100644 --- a/net/ipv6/inet6_connection_sock.c +++ b/net/ipv6/inet6_connection_sock.c | |||
@@ -173,10 +173,8 @@ void inet6_csk_addr2sockaddr(struct sock *sk, struct sockaddr * uaddr) | |||
173 | sin6->sin6_port = inet_sk(sk)->inet_dport; | 173 | sin6->sin6_port = inet_sk(sk)->inet_dport; |
174 | /* We do not store received flowlabel for TCP */ | 174 | /* We do not store received flowlabel for TCP */ |
175 | sin6->sin6_flowinfo = 0; | 175 | sin6->sin6_flowinfo = 0; |
176 | sin6->sin6_scope_id = 0; | 176 | sin6->sin6_scope_id = ipv6_iface_scope_id(&sin6->sin6_addr, |
177 | if (sk->sk_bound_dev_if && | 177 | sk->sk_bound_dev_if); |
178 | ipv6_addr_type(&sin6->sin6_addr) & IPV6_ADDR_LINKLOCAL) | ||
179 | sin6->sin6_scope_id = sk->sk_bound_dev_if; | ||
180 | } | 178 | } |
181 | 179 | ||
182 | EXPORT_SYMBOL_GPL(inet6_csk_addr2sockaddr); | 180 | EXPORT_SYMBOL_GPL(inet6_csk_addr2sockaddr); |
diff --git a/net/ipv6/raw.c b/net/ipv6/raw.c index 330b5e7b7df6..eedff8ccded5 100644 --- a/net/ipv6/raw.c +++ b/net/ipv6/raw.c | |||
@@ -263,7 +263,7 @@ static int rawv6_bind(struct sock *sk, struct sockaddr *uaddr, int addr_len) | |||
263 | if (addr_type != IPV6_ADDR_ANY) { | 263 | if (addr_type != IPV6_ADDR_ANY) { |
264 | struct net_device *dev = NULL; | 264 | struct net_device *dev = NULL; |
265 | 265 | ||
266 | if (addr_type & IPV6_ADDR_LINKLOCAL) { | 266 | if (__ipv6_addr_needs_scope_id(addr_type)) { |
267 | if (addr_len >= sizeof(struct sockaddr_in6) && | 267 | if (addr_len >= sizeof(struct sockaddr_in6) && |
268 | addr->sin6_scope_id) { | 268 | addr->sin6_scope_id) { |
269 | /* Override any existing binding, if another | 269 | /* Override any existing binding, if another |
@@ -498,9 +498,8 @@ static int rawv6_recvmsg(struct kiocb *iocb, struct sock *sk, | |||
498 | sin6->sin6_port = 0; | 498 | sin6->sin6_port = 0; |
499 | sin6->sin6_addr = ipv6_hdr(skb)->saddr; | 499 | sin6->sin6_addr = ipv6_hdr(skb)->saddr; |
500 | sin6->sin6_flowinfo = 0; | 500 | sin6->sin6_flowinfo = 0; |
501 | sin6->sin6_scope_id = 0; | 501 | sin6->sin6_scope_id = ipv6_iface_scope_id(&sin6->sin6_addr, |
502 | if (ipv6_addr_type(&sin6->sin6_addr) & IPV6_ADDR_LINKLOCAL) | 502 | IP6CB(skb)->iif); |
503 | sin6->sin6_scope_id = IP6CB(skb)->iif; | ||
504 | } | 503 | } |
505 | 504 | ||
506 | sock_recv_ts_and_drops(msg, sk, skb); | 505 | sock_recv_ts_and_drops(msg, sk, skb); |
@@ -802,7 +801,7 @@ static int rawv6_sendmsg(struct kiocb *iocb, struct sock *sk, | |||
802 | 801 | ||
803 | if (addr_len >= sizeof(struct sockaddr_in6) && | 802 | if (addr_len >= sizeof(struct sockaddr_in6) && |
804 | sin6->sin6_scope_id && | 803 | sin6->sin6_scope_id && |
805 | ipv6_addr_type(daddr)&IPV6_ADDR_LINKLOCAL) | 804 | __ipv6_addr_needs_scope_id(__ipv6_addr_type(daddr))) |
806 | fl6.flowi6_oif = sin6->sin6_scope_id; | 805 | fl6.flowi6_oif = sin6->sin6_scope_id; |
807 | } else { | 806 | } else { |
808 | if (sk->sk_state != TCP_ESTABLISHED) | 807 | if (sk->sk_state != TCP_ESTABLISHED) |
diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c index 599e1ba6d1ce..3ed57eced376 100644 --- a/net/ipv6/udp.c +++ b/net/ipv6/udp.c | |||
@@ -450,15 +450,16 @@ try_again: | |||
450 | sin6->sin6_family = AF_INET6; | 450 | sin6->sin6_family = AF_INET6; |
451 | sin6->sin6_port = udp_hdr(skb)->source; | 451 | sin6->sin6_port = udp_hdr(skb)->source; |
452 | sin6->sin6_flowinfo = 0; | 452 | sin6->sin6_flowinfo = 0; |
453 | sin6->sin6_scope_id = 0; | ||
454 | 453 | ||
455 | if (is_udp4) | 454 | if (is_udp4) { |
456 | ipv6_addr_set_v4mapped(ip_hdr(skb)->saddr, | 455 | ipv6_addr_set_v4mapped(ip_hdr(skb)->saddr, |
457 | &sin6->sin6_addr); | 456 | &sin6->sin6_addr); |
458 | else { | 457 | sin6->sin6_scope_id = 0; |
458 | } else { | ||
459 | sin6->sin6_addr = ipv6_hdr(skb)->saddr; | 459 | sin6->sin6_addr = ipv6_hdr(skb)->saddr; |
460 | if (ipv6_addr_type(&sin6->sin6_addr) & IPV6_ADDR_LINKLOCAL) | 460 | sin6->sin6_scope_id = |
461 | sin6->sin6_scope_id = IP6CB(skb)->iif; | 461 | ipv6_iface_scope_id(&sin6->sin6_addr, |
462 | IP6CB(skb)->iif); | ||
462 | } | 463 | } |
463 | 464 | ||
464 | } | 465 | } |
@@ -1118,7 +1119,7 @@ do_udp_sendmsg: | |||
1118 | 1119 | ||
1119 | if (addr_len >= sizeof(struct sockaddr_in6) && | 1120 | if (addr_len >= sizeof(struct sockaddr_in6) && |
1120 | sin6->sin6_scope_id && | 1121 | sin6->sin6_scope_id && |
1121 | ipv6_addr_type(daddr)&IPV6_ADDR_LINKLOCAL) | 1122 | __ipv6_addr_needs_scope_id(__ipv6_addr_type(daddr))) |
1122 | fl6.flowi6_oif = sin6->sin6_scope_id; | 1123 | fl6.flowi6_oif = sin6->sin6_scope_id; |
1123 | } else { | 1124 | } else { |
1124 | if (sk->sk_state != TCP_ESTABLISHED) | 1125 | if (sk->sk_state != TCP_ESTABLISHED) |