aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv6/udp.c
diff options
context:
space:
mode:
authorHannes Frederic Sowa <hannes@stressinduktion.org>2013-03-07 21:07:19 -0500
committerDavid S. Miller <davem@davemloft.net>2013-03-08 12:29:22 -0500
commit842df0739776fc9af7ac15968b44415a31ba9be4 (patch)
tree68bf5467c9ac66494655795fa59b4fa58ef86dd9 /net/ipv6/udp.c
parentb7ef213ef65256168df83ddfbb8131ed9adc10f9 (diff)
ipv6: use newly introduced __ipv6_addr_needs_scope_id and ipv6_iface_scope_id
This patch requires multicast interface-scoped addresses to supply a sin6_scope_id. Because the sin6_scope_id is now also correctly used in case of interface-scoped multicast traffic this enables one to use interface scoped addresses over interfaces which are not targeted by the default multicast route (the route has to be put there manually, though). getsockname() and getpeername() now return the correct sin6_scope_id in case of interface-local mc addresses. v2: a) rebased ontop of patch 1/4 (now uses ipv6_addr_props) v3: a) reverted changes for ipv6_addr_props v4: a) unchanged Cc: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org> Acked-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org> Signed-off-by: Hannes Frederic Sowa <hannes@stressinduktion.org> Acked-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>dave Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6/udp.c')
-rw-r--r--net/ipv6/udp.c13
1 files changed, 7 insertions, 6 deletions
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)